44 lines
1.4 KiB
Plaintext
44 lines
1.4 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 = [t("personal_project.member_profile")]
|
||
|
@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.unit") + " - " + t(locale.to_s)
|
||
|
end
|
||
|
@site_in_use_locales.each do |locale|
|
||
|
row << t("personal_project.participants") + " - " + t(locale.to_s)
|
||
|
end
|
||
|
row << t("personal_project.year")
|
||
|
row << t("personal_project.project_number")
|
||
|
row << t("personal_project.period_start_date")
|
||
|
row << t("personal_project.period_end_date")
|
||
|
sheet.add_row row, :style => heading
|
||
|
|
||
|
data.each do |project|
|
||
|
row = [(project.member_profile.name rescue "")]
|
||
|
@site_in_use_locales.each do |locale|
|
||
|
row << project.project_title_translations[locale.to_s]
|
||
|
end
|
||
|
@site_in_use_locales.each do |locale|
|
||
|
row << project.unit_translations[locale.to_s]
|
||
|
end
|
||
|
@site_in_use_locales.each do |locale|
|
||
|
row << project.participants_translations[locale.to_s]
|
||
|
end
|
||
|
row << project.display_field("year",true)
|
||
|
row << project.display_field("project_number",true)
|
||
|
row << project.display_field("period_start_date",true)
|
||
|
row << project.display_field("period_end_date",true)
|
||
|
sheet.add_row row
|
||
|
end
|
||
|
end
|
||
|
end
|