2015-12-17 13:58:04 +00:00
|
|
|
# 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 = []
|
|
|
|
row1 = []
|
|
|
|
row2 = []
|
|
|
|
|
|
|
|
@table.table_columns.asc(:order).each do |column|
|
|
|
|
case column.type
|
|
|
|
when "text"
|
2015-12-18 07:33:43 +00:00
|
|
|
@site_in_use_locales.sort.each do |locale|
|
2015-12-17 13:58:04 +00:00
|
|
|
row << column.title + " - " + t(locale.to_s)
|
|
|
|
row1 << column.key
|
|
|
|
row2 << column.type + "-#{locale}"
|
|
|
|
end
|
|
|
|
when "editor"
|
2015-12-18 07:33:43 +00:00
|
|
|
@site_in_use_locales.sort.each do |locale|
|
2015-12-17 13:58:04 +00:00
|
|
|
row << column.title + " - " + t(locale.to_s)
|
|
|
|
row1 << column.key
|
|
|
|
row2 << column.type + "-#{locale}"
|
|
|
|
end
|
|
|
|
when "image"
|
|
|
|
row << column.title
|
|
|
|
row1 << column.key
|
|
|
|
row2 << "Please leave this column blank. Upload the image manually."
|
|
|
|
when "date"
|
|
|
|
row << column.title
|
|
|
|
row1 << column.key
|
|
|
|
row2 << column.type + " : " + column.date_format.upcase
|
|
|
|
when "period"
|
|
|
|
row << column.title + "-From"
|
|
|
|
row1 << column.key
|
|
|
|
row2 << column.type + " : " + column.date_format.upcase + "-period_from"
|
|
|
|
row << column.title + "-To"
|
|
|
|
row1 << column.key
|
|
|
|
row2 << column.type + " : " + column.date_format.upcase + "-period_to"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
sheet.add_row row, :style => heading
|
|
|
|
sheet.add_row row1
|
|
|
|
sheet.add_row row2, :style => type
|
|
|
|
|
|
|
|
end
|