# 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_plugin_template.author_name_translation")] parse_again_start @site_in_use_locales.each do |locale| row << t("personal_plugin_template.locale_fields") + " - " + t(locale.to_s) end parse_again_end parse_again_start row << t("personal_plugin_template.none_locale_fields") parse_again_end parse_again_start row << t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") parse_again_end parse_again_start row << t("personal_plugin_template.plugin_template_file") @site_in_use_locales.each do |locale| row << t("personal_plugin_template.plugin_template_file") + " " + t("description") + " - " + t(locale.to_s) end @site_in_use_locales.each do |locale| row << t("personal_plugin_template.plugin_template_file") + " " + t("alternative") + " - " + t(locale.to_s) end parse_again_end parse_again_start row << t("personal_plugin_template.plugin_template_link") @site_in_use_locales.each do |locale| row << t("personal_plugin_template.plugin_template_link") + " " + t("url_alt") + " - " + t(locale.to_s) end parse_again_end sheet.add_row row, :style => heading data.each do |plugin_template| row = [(plugin_template.member_profile.name rescue "")] parse_again_start @site_in_use_locales.each do |locale| row << plugin_template.locale_fields_translations[locale.to_s] end parse_again_end parse_again_start row << plugin_template.display_field("none_locale_fields",true) parse_again_end parse_again_start row << (plugin_template.plugin_template_related.plugin_template_related_main_field rescue "") parse_again_end parse_again_start plugin_template_files = plugin_template.plugin_template_files.asc(:created_at) row << plugin_template_files.collect{|f| (@host_url + f.file.url rescue nil)}.join(";") @site_in_use_locales.each do |locale| row << plugin_template_files.collect{|l| l.description_translations[locale]}.join(";") end @site_in_use_locales.each do |locale| row << plugin_template_files.collect{|l| l.title_translations[locale]}.join(";") end parse_again_end parse_again_start plugin_template_links = plugin_template.plugin_template_links.asc(:created_at) row << plugin_template_links.collect{|l| l.url}.join(";") @site_in_use_locales.each do |locale| row << plugin_template_links.collect{|l| l.title_translations[locale]}.join(";") end parse_again_end sheet.add_row row end end end