From 16a3b54942ea9bdfe1acad5e23696e240cdf099f Mon Sep 17 00:00:00 2001 From: rulingcom Date: Mon, 7 Jul 2025 21:54:31 +0800 Subject: [PATCH] export fix --- app/views/utable_export/export.xlsx.axlsx | 43 ++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/views/utable_export/export.xlsx.axlsx b/app/views/utable_export/export.xlsx.axlsx index 1ead0d9..e5112c7 100755 --- a/app/views/utable_export/export.xlsx.axlsx +++ b/app/views/utable_export/export.xlsx.axlsx @@ -44,9 +44,12 @@ wb.add_worksheet(name: "Structure") do |sheet| row1 << column.key row2 << "Separate the files by ;" - row << "#{column.title} 註解" - row1 << column.key - row2 << "file_title-#{locale}" + site_in_use_locales.sort.each do |locale| + # URL 欄位 + row << "#{column.title} (註解) - #{t(locale.to_s)}" + row1 << column.key + row2 << "file_title - #{locale} ;" + end end end @@ -102,27 +105,35 @@ wb.add_worksheet(name: "Structure") do |sheet| row << "#{from} ~ #{to}" when "file" file_links = [] - file_titles = [] - locale = "zh_tw" + file_titles = {} + site_in_use_locales.sort.each do |locale| + file_titles[locale.to_s] = [] + end if column column.column_entry_files.desc(:sort_number).each do |entry_file| - next unless entry_file.choose_lang_display(locale) + # next unless entry_file.choose_lang_display(locale) file_links << (url + entry_file.get_link) - title = if entry_file.respond_to?(:file_title_translations) && entry_file.file_title_translations.is_a?(Hash) - entry_file.file_title_translations[locale] - elsif entry_file.file_title.is_a?(Hash) - entry_file.file_title[locale] - else - entry_file.file_title - end + # title = if entry_file.respond_to?(:file_title_translations) && entry_file.file_title_translations.is_a?(Hash) + # entry_file.file_title_translations[locale] + # elsif entry_file.file_title.is_a?(Hash) + # entry_file.file_title[locale] + # else + # entry_file.file_title + # end - title = entry_file.file.filename.to_s if title.blank? - file_titles << title + # title = entry_file.file.filename.to_s if title.blank? + # file_titles << title + + site_in_use_locales.sort.each do |locale| + file_titles[locale.to_s] << entry_file.file_title_translations[locale] + end end end row << file_links.join(";") - row << file_titles.join(";") + file_titles.each_key do |locale| + row << file_titles[locale.to_s].join(";") + end end end