forked from saurabh/personal-project
75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
# encoding: utf-8
|
|
|
|
wb = xlsx_package.workbook
|
|
@data.each_with_index do |role,idx|
|
|
data = role["data"]
|
|
wb.add_worksheet(name: role["name"] + "-" + idx.to_s) do |sheet|
|
|
|
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
|
|
|
row = ["Name"]
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_project.project_title") + " - " + t(locale.to_s)
|
|
end
|
|
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_project.job_title") + " - " + t(locale.to_s)
|
|
end
|
|
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_project.participator") + " - " + t(locale.to_s)
|
|
end
|
|
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_project.unit") + " - " + t(locale.to_s)
|
|
end
|
|
|
|
row << t("personal_project.year")
|
|
|
|
row << t("personal_project.language")
|
|
|
|
row << t("personal_project.project_category")
|
|
|
|
row << t("personal_project.start_date")
|
|
|
|
row << t("personal_project.end_date")
|
|
|
|
row << t("personal_project.url")
|
|
|
|
row << t("personal_project.keywords")
|
|
|
|
row << t("personal_project.abstract")
|
|
|
|
row << t("personal_project.note")
|
|
|
|
sheet.add_row row, :style => heading
|
|
|
|
|
|
data.each do |proj|
|
|
row = [proj.member_profile.name]
|
|
@site_in_use_locales.each do |locale|
|
|
row << proj.project_title_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << proj.job_title_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << proj.participator_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << proj.unit_translations[locale.to_s]
|
|
end
|
|
|
|
row << proj.year
|
|
row << proj.language
|
|
row << (proj.project_types.map{|jl| jl.title}.join(", ") rescue "")
|
|
row << proj.start_date.strftime("%Y-%m-%d") rescue ""
|
|
row << proj.end_date.strftime("%Y-%m-%d") rescue ""
|
|
row << proj.url
|
|
row << proj.keywords
|
|
row << proj.abstract
|
|
row << proj.note
|
|
sheet.add_row row
|
|
end
|
|
end
|
|
end |