95 lines
2.1 KiB
Plaintext
95 lines
2.1 KiB
Plaintext
# encoding: utf-8
|
|
|
|
wb = xlsx_package.workbook
|
|
|
|
wb.add_worksheet(name: "Annoucement") do |sheet|
|
|
|
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
|
example = sheet.styles.add_style(:i => true)
|
|
row = []
|
|
row1 = []
|
|
row2 = []
|
|
|
|
row << t("category")
|
|
row1 << "select"
|
|
t = ""
|
|
@module_app.categories.asc(:created_at).each_with_index do |cat,i|
|
|
t = t + "#{i}" + " -> " + cat.title + ", "
|
|
end
|
|
if @module_app.categories.count > 0
|
|
t = t + " Example : 0"
|
|
else
|
|
t = "Leave this field blank"
|
|
end
|
|
row2 << t
|
|
|
|
row << t("tags")
|
|
row1 << "select"
|
|
t = ""
|
|
@module_app.tags.asc(:created_at).each_with_index do |tag,i|
|
|
t = t + "#{i}" + " -> " + tag.name + ", "
|
|
end
|
|
if @module_app.tags.count > 0
|
|
t = t + " Example : 0,1,2"
|
|
else
|
|
t = "Leave this field blank"
|
|
end
|
|
row2 << t
|
|
|
|
row << t("start_date")
|
|
row1 << "date"
|
|
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
|
|
|
|
row << t("end_date")
|
|
row1 << "date"
|
|
row2 << "Format: YYYY/MM/DD, Example: 2015/12/12"
|
|
|
|
row << t("top")
|
|
row1 << "boolean"
|
|
row2 << "0 for false, 1 for true"
|
|
|
|
row << t("hot")
|
|
row1 << "boolean"
|
|
row2 << "0 for false, 1 for true"
|
|
|
|
row << t("hide")
|
|
row1 << "boolean"
|
|
row2 << "0 for false, 1 for true "
|
|
|
|
row << t("image")
|
|
row1 << "url"
|
|
row2 << "http://www.example.com/images/example.png"
|
|
|
|
row << t("image") + " " + t("description") + " - " + t("en")
|
|
row1 << "textfield"
|
|
row2 << ""
|
|
row << t("image") + " " + t("description") + " - " + t("zh_tw")
|
|
row1 << "textfield"
|
|
row2 << ""
|
|
|
|
row << t("title") + " - " + t("en")
|
|
row1 << "textfield"
|
|
row2 << ""
|
|
row << t("title") + " - " + t("zh_tw")
|
|
row1 << "textfield"
|
|
row2 << ""
|
|
|
|
row << t("subtitle") + " - " + t("en")
|
|
row1 << "textarea"
|
|
row2 << ""
|
|
row << t("subtitle") + " - " + t("zh_tw")
|
|
row1 << "textarea"
|
|
row2 << ""
|
|
|
|
row << t("content") + " - " + t("en")
|
|
row1 << "editor"
|
|
row2 << ""
|
|
row << t("content") + " - " + t("zh_tw")
|
|
row1 << "editor"
|
|
row2 << ""
|
|
|
|
sheet.add_row row, :style => heading
|
|
sheet.add_row row1
|
|
sheet.add_row row2, :style => example
|
|
|
|
end |