personal-conference/app/views/admin/writing_conferences/excel_format.xlsx.axlsx

156 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

2015-12-15 11:33:41 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "Journal Paper") do |sheet|
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 << ""
row << t("personal_conference.paper_title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_conference.paper_title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_conference.conference_title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_conference.conference_title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_conference.location") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_conference.location") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_conference.sponsor") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_conference.sponsor") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_conference.authors") + " - " + t("en")
row1 << "textarea"
row2 << ""
row << t("personal_conference.authors") + " - " + t("zh_tw")
row1 << "textarea"
row2 << ""
row << t("personal_conference.year")
row1 << "number"
row2 << "Example : 2015 or 2014 or 1987"
row << t("personal_conference.language")
row1 << "select"
row2 << "en -> English, zh_tw -> Chinese"
row << t("personal_conference.period_start_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_conference.period_end_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_conference.paper_level")
row1 << "checkbox"
t = ""
ConferencePaperLevel.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ConferencePaperLevel.count > 0
t = t + " Example : 0, if more than one then : 0,1"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_conference.paper_type")
row1 << "checkbox"
t = ""
ConferencePaperType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ConferencePaperType.count > 0
t = t + " Example : 0, if more than one then : 0,1"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_conference.author_type")
row1 << "checkbox"
t = ""
ConferenceAuthorType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
if ConferenceAuthorType.count > 0
t = t + " Example : 0, if more than one then : 0,1"
else
t = "Leave this field blank"
end
row2 << t
row << t("personal_conference.number_of_authors")
row1 << "number"
row2 << "Example: 1 or 2 or 10"
row << t("personal_conference.isbn")
row1 << "textfield"
row2 << ""
row << t("personal_conference.publication_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_conference.isi_number")
row1 << "textfield"
row2 << ""
row << t("personal_conference.url")
row1 << "textfield"
row2 << "http://domain.com/path"
row << t("personal_conference.keywords")
row1 << "textfield"
row2 << "Example: keyword1,keyword2"
row << t("personal_conference.abstract")
row1 << "textarea"
row2 << ""
row << t("personal_conference.note")
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