academic_advising/app/views/admin/academic_advisings/excel_format.xlsx.axlsx

77 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-12-14 07:18:27 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
2021-02-07 14:56:22 +00:00
wb.add_worksheet(name: "AcademicAdvising") do |sheet|
2015-12-14 07:18:27 +00:00
heading = sheet.styles.add_style(:b => true, :locked => true)
example = sheet.styles.add_style(:i => true)
row = ["user_id"]
row1 = [""]
row2 = [""]
row << "name"
row1 << ""
row2 << ""
2021-02-07 14:56:22 +00:00
row << t("academic_advising.award_name") + " - " + t("en")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << ""
2021-02-07 14:56:22 +00:00
row << t("academic_advising.award_name") + " - " + t("zh_tw")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << ""
2021-02-07 14:56:22 +00:00
row << t("academic_advising.awarding_unit") + " - " + t("en")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << ""
2021-02-07 14:56:22 +00:00
row << t("academic_advising.awarding_unit") + " - " + t("zh_tw")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << ""
2021-02-07 14:56:22 +00:00
row << t("academic_advising.year")
2015-12-14 07:18:27 +00:00
row1 << "number"
row2 << "Example : 2015 or 2014 or 1987"
2021-02-07 14:56:22 +00:00
row << t("academic_advising.language")
2015-12-14 07:18:27 +00:00
row1 << "select"
row2 << "en -> English, zh_tw -> Chinese"
2021-02-07 14:56:22 +00:00
row << t("academic_advising.academic_advising_category")
2015-12-14 07:18:27 +00:00
row1 << "select"
t = ""
2021-02-07 14:56:22 +00:00
AdvisingType.asc(:created_at).each_with_index do |jl,i|
2015-12-14 07:18:27 +00:00
t = t + "#{i}" + " -> " + jl.title + ", "
end
2021-02-07 14:56:22 +00:00
if AdvisingType.count > 0
2015-12-14 07:18:27 +00:00
t = t + " Example : 0"
else
t = "Leave this field blank"
end
row2 << t
2021-02-07 14:56:22 +00:00
row << t("academic_advising.url")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << "http://domain.com/path"
2021-02-07 14:56:22 +00:00
row << t("academic_advising.keywords")
2015-12-14 07:18:27 +00:00
row1 << "textfield"
row2 << "Example: keyword1,keyword2"
2021-02-07 14:56:22 +00:00
row << t("academic_advising.note")
2015-12-14 07:18:27 +00:00
row1 << "textarea"
row2 << ""
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
User.where(:user_name.ne => "rulingcom").each do |user|
r = [user.user_name]
r << user.name
sheet.add_row r
end
end