75 lines
1.9 KiB
Plaintext
Executable File
75 lines
1.9 KiB
Plaintext
Executable File
# encoding: utf-8
|
|
|
|
wb = xlsx_package.workbook
|
|
|
|
wb.add_worksheet(name: "Structure") do |sheet|
|
|
heading = sheet.styles.add_style(b: true, locked: true)
|
|
type = sheet.styles.add_style(i: true)
|
|
|
|
row = ['UID']
|
|
row1 = ['uid']
|
|
row2 = ['Use to update existing entries. Leave blank to create new.']
|
|
|
|
@table.table_columns.asc(:order).each do |column|
|
|
case column.type
|
|
when "text", "editor"
|
|
@site_in_use_locales.sort.each do |locale|
|
|
row << "#{column.title} - #{t(locale.to_s)}"
|
|
row1 << column.key
|
|
row2 << "#{column.type}-#{locale}"
|
|
end
|
|
|
|
when "integer"
|
|
row << column.title
|
|
row1 << column.key
|
|
row2 << "integer"
|
|
|
|
when "image"
|
|
row << column.title
|
|
row1 << column.key
|
|
row2 << "Public URL"
|
|
|
|
when "date"
|
|
row << column.title
|
|
row1 << column.key
|
|
row2 << "date : #{column.date_format.upcase}"
|
|
|
|
when "period"
|
|
row << "#{column.title}-From"
|
|
row1 << column.key
|
|
row2 << "period : #{column.date_format.upcase}-period_from"
|
|
|
|
row << "#{column.title}-To"
|
|
row1 << column.key
|
|
row2 << "period : #{column.date_format.upcase}-period_to"
|
|
|
|
when "file"
|
|
# 多語系 file_title 欄位
|
|
row << "#{column.title}"
|
|
row1 << column.key
|
|
row2 << "Separate the files by ;"
|
|
|
|
@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 # <-- 正確結束 case 區塊
|
|
end
|
|
|
|
# 加入 hashtags 與 related_entries 欄位
|
|
row << t("universal_table.hashtags")
|
|
row1 << "table_tags"
|
|
row2 << "Separate tags by ;"
|
|
|
|
row << t("universal_table.related_entries")
|
|
row1 << "related_entries"
|
|
row2 << "Separate UIDs with ;"
|
|
|
|
sheet.add_row row, style: heading
|
|
sheet.add_row row1
|
|
sheet.add_row row2, style: type
|
|
end
|