fix bug for deleted entries and hashtabgs

This commit is contained in:
rulingcom 2025-07-14 21:37:54 +08:00
parent 4247599fd5
commit 4bff2dfaa2
2 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class CurationPostSection
def get_table_entries_for_frontend
module_app = ModuleApp.find_by_key("universal_table")
tids = self.table_entries.split(',')
table_entries = TableEntry.find(tids)
table_entries = TableEntry.find(tids) rescue []
table_entries.map do |entry|
rows = []
entry.column_entries.each do |ce|
@ -33,6 +33,10 @@ class CurationPostSection
"text" => text
} if text != ""
end
rows << {
"title" => I18n.t("universal_table.hashtags"),
"text" => entry.tags_for_frontend
}
{
"uid" => entry.uid,
"type" => self.section_type,
@ -43,7 +47,7 @@ class CurationPostSection
def get_table_entries
tids = self.table_entries.split(',')
TableEntry.find(tids)
TableEntry.find(tids) rescue []
end
def get_frontend_object

View File

@ -60,7 +60,7 @@
<span class="add-on"><%= t("curation.tables") %></span>
<%= f.select :universal_table, UTable.all.map { |table| [table.title, table.uid] },
{ include_blank: t("curation.please_select") },
class: 'form-control' %>
class: 'form-control universal_table' %>
</span>
<% if !form_section_post.new_record? && form_section_post.section_type == "universal_table" %>
<%
@ -69,6 +69,7 @@
<span class="tab-content section_type_ut_entries">
<span class="add-on"><%= t("curation.table_entries") %></span>
<%= f.text_field :table_entries, :class => "select2", data: { value: tbData } %>
<%#= f.select :universal_table, [], {}, class: 'form-control select2', multiple: true, data: { value: tbData } %>
</span>
<% else %>
<span class="tab-content section_type_ut_entries" style="display:none">