personal_activity/app/views/admin/activities/download_excel.xlsx.axlsx

92 lines
3.1 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_activity.member_profile")]
@site_in_use_locales.each do |locale|
row << t("personal_activity.activity_name") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.work_title") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.activity_organizer") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.activity_co_organizer") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.region") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.road_show") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.tour_details") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.award_name") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.awarding_unit") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.authors_type") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_activity.authors") + " - " + t(locale.to_s)
end
row << t("personal_activity.year")
row << t("personal_activity.publish_date")
row << t("personal_activity.start_date")
row << t("personal_activity.end_date")
sheet.add_row row, :style => heading
data.each do |activity|
row = [(activity.member_profile.name rescue "")]
@site_in_use_locales.each do |locale|
row << activity.activity_name_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.work_title_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.activity_organizer_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.activity_co_organizer_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.region_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.road_show_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.tour_details_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.award_name_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.awarding_unit_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.authors_type_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << activity.authors_translations[locale.to_s]
end
row << activity.display_field("year",true)
row << activity.display_field("publish_date",true)
row << activity.display_field("start_date",true)
row << activity.display_field("end_date",true)
sheet.add_row row
end
end
end