Fix export announcement bug.

This commit is contained in:
Peter Chiu 2025-06-05 09:26:03 +08:00
parent 8467fd9e51
commit 4ed76d7b82
4 changed files with 4 additions and 2 deletions

View File

@ -194,7 +194,7 @@ class Admin::AnnouncementsController < OrbitAdminController
@thread.update(:status=>{:status=>'finish','finish_percent'=>100,'info'=>I18n.t('announcement.read_from_cache')})
else
excel_contents = render_to_string( handlers: [:axlsx], formats: [:xlsx] ,partial: 'export_excel.xlsx' )
File.open(filename, 'w') do |f|
File.open(filename, 'wb') do |f|
f.write excel_contents
end
end

View File

@ -6,7 +6,7 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 id="threadModal"><%=t("e_paper.#{@thread.key}")%></h3>
<h3 id="threadModal"><%=t("announcement.#{@thread.key}")%></h3>
</div>
<div class="modal-body">
<div class="thread-status"><%= @thread.status[:status] %></div>

View File

@ -96,6 +96,7 @@ en:
add_new: Add New
export_to_excel: Export to Excel
export_all_anns: Export all Announcement
export_announcements: Export Announcements
import_from_excel: Import from Excel
download_example_sheet_here: Download example sheet here
please_create_tags_cats: Please create all the tags and categories before hand. Only excel file is allowed

View File

@ -97,6 +97,7 @@ zh_tw:
add_new: 新建
export_to_excel: 匯出至Excel檔
export_all_anns: 匯出所有公告
export_announcements: 匯出公告
import_from_excel: 從Excel檔匯入
download_example_sheet_here: 在此下載範例
please_create_tags_cats: 請事先建立所有標籤及分類。 僅限Excel檔。