Fix Rails 7 / Mongoid 8 compatibility and frontend issues
This commit is contained in:
1 parent
de03d1308c
commit
824bf50bf6
3 files changed
+13
-9
No files matched your search
@@ -246,7 +246,7 @@ end
|
||||
elsif title_for_category["zh_tw"] == "" && title_for_category["en"] != ""
|
||||
title_for_category["zh_tw"] = title_for_category["en"]
|
||||
end
|
||||
category.title_translations = title_for_category
|
||||
category.title_translations = title_for_category.to_unsafe_h
|
||||
category.module_app = @module_app
|
||||
category.save
|
||||
p = table_params
|
||||
@@ -276,7 +276,7 @@ end
|
||||
elsif title_for_category["zh_tw"] == "" && title_for_category["en"] != ""
|
||||
title_for_category["zh_tw"] = title_for_category["en"]
|
||||
end
|
||||
cat.title_translations = title_for_category
|
||||
cat.title_translations = title_for_category.to_unsafe_h
|
||||
cat.save
|
||||
p[:category_id] = cat.id
|
||||
table.update_attributes(p)
|
||||
|
||||
@@ -120,10 +120,11 @@ class UniversalTablesController < ApplicationController
|
||||
end
|
||||
|
||||
def get_query(params)
|
||||
if params["column"].present?
|
||||
if params["column"].present? && params["q"].is_a?(String)
|
||||
q = {params["column"] => params["q"]}
|
||||
else
|
||||
q = params["q"]
|
||||
q = q.to_unsafe_h if q.respond_to?(:to_unsafe_h)
|
||||
end
|
||||
if q.present?
|
||||
q.map{|k,v| [k, v.to_s.strip] if v.present?}.compact.to_h
|
||||
@@ -401,6 +402,7 @@ class UniversalTablesController < ApplicationController
|
||||
rows = []
|
||||
entries = get_entries(params, table, page)
|
||||
total_pages = entries.total_pages
|
||||
show_hashtags = Hashtagging.where(:hashtaggable_id.in => TableEntry.where(:u_table_id => table.id).pluck(:id)).exists?
|
||||
table_heads << {
|
||||
"title" => t("universal_table.hashtags"),
|
||||
"type" => "hashtag",
|
||||
@@ -411,7 +413,7 @@ class UniversalTablesController < ApplicationController
|
||||
"sort-class" => "sort hide",
|
||||
"sort-url" => "",
|
||||
"title-class" => " no-search"
|
||||
}
|
||||
}if show_hashtags
|
||||
if have_serial_number
|
||||
page_no_offset = (params_no.present? ? [0, params_no.to_i - 1].max : 0)
|
||||
serial_number_count = page_no_offset * OrbitHelper.page_data_count
|
||||
@@ -455,9 +457,11 @@ class UniversalTablesController < ApplicationController
|
||||
cols << {"text" => ""}
|
||||
end
|
||||
end
|
||||
text = te.hashtags_for_frontend
|
||||
cols << {"text" => text}
|
||||
rows << {
|
||||
if show_hashtags
|
||||
text = te.hashtags_for_frontend
|
||||
cols << {"text" => text}
|
||||
end
|
||||
rows << {
|
||||
"columns" => cols
|
||||
}
|
||||
end
|
||||
|
||||
@@ -17,8 +17,8 @@ module Admin::UniversalTablesHelper
|
||||
end
|
||||
|
||||
def render_unique_texts(f,column,i)
|
||||
select_values = column.column_entries.distinct(:text)
|
||||
select = "<select id='#{column.key}_#{i}'>"
|
||||
select_values = column.column_entries.distinct(:text_translations)
|
||||
select = "<select id='#{column.key}_#{i}'>"
|
||||
s = {"en" => "", "zh_tw" => ""}
|
||||
select = select + "<option class='muted' value='#{s.to_json.html_safe}'>---------------Select---------------</option>"
|
||||
select_values.each do |sv|
|
||||
|
||||
Reference in new issue
Block a user