updates by Junyi

This commit is contained in:
rulingcom 2025-09-03 17:31:59 +08:00
parent c5390eb00a
commit 105e4969d0
4 changed files with 37 additions and 38 deletions

View File

@ -6,7 +6,7 @@ class Admin::PropertyHiresController < OrbitAdminController
@filter_fields = filter_fields(@categories, @tags)
@table_fields = ["property_hire.title", :category, "property_hire.location", "property_hire.available_for_hire"]
@properties = Property.order_by(sort)
@properties = Property.order_by(order_position: :asc)
.with_categories(filters("category"))
.with_tags(filters("tag"))
@ -27,7 +27,7 @@ class Admin::PropertyHiresController < OrbitAdminController
redirect_to params[:referer_url]
end
def order
@properties = Property.all.sort_order
@properties = Property.order_by(order_position: :asc)
end
def updateorder
ids_with_order = params[:order]

View File

@ -2,7 +2,7 @@ class PropertyHiresController < ApplicationController
include Admin::PropertyHiresHelper
FrontendMethods = ["hire", "view_calendar", "hire_success"]
def index
properties = Property.can_display.filter_by_categories.sort_order
properties = Property.can_display.filter_by_categories.order_by(order_position: :asc)
url = "/#{I18n.locale}#{OrbitHelper.page.get_url}"
data = index_data(properties, url)
filterprops = data.dup
@ -82,7 +82,7 @@ class PropertyHiresController < ApplicationController
end
def widget
properties = Property.filter_by_widget_categories.sort_order.can_display
properties = Property.filter_by_widget_categories.order_by(order_position: :asc).can_display
url = OrbitHelper.get_current_widget.get_read_more_page_url
data = index_data(properties, url)
headers = [

View File

@ -23,11 +23,11 @@
<th><%= t("property_hire.title") %></th>
</thead>
<tbody>
<% @properties.each_with_index do |property,i| %>
<tr data-index="<%=i%>">
<% @properties.each do |property| %>
<tr data-index="<%= property.order_position %>">
<td><span class="brand"><i class="icons-list-2"></i></span></td>
<td class="position-text">
<div class="position-text-div" data-value="<%= (i + 1).to_s %>"><%= (i + 1).to_s %></div>
<div class="position-text-div" data-value="<%= property.order_position %>"><%= property.order_position %></div>
</td>
<td>
<div class="property-text-id" data-property-id="<%= property.id.to_s %>"><%= property.title %></div>

View File

@ -37,11 +37,10 @@
fields_name = fields_name - basic_keys
keys = basic_keys + fields_name
keys = keys.select do |field_name|
return true if field_name.include?('p_hire_fields.')
next true if field_name.include?('p_hire_fields.')
tmp = property[field_name]
tmp.is_a?(Hash) ? (tmp["enable"] == "1") : true
end
p_hire_fields = property.p_hire_fields_enabled.map{|rf| [rf.id.to_s,rf]}.to_h
has_p_hire_fields = p_hire_fields.count != 0
tmp_keys = []
all_trans = keys.map do |k|