diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 48b544d..ac9ec75 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -254,6 +254,7 @@ @formatting = params[:export][:formatting] || @plan.settings(:export).formatting file_name = @plan.title.gsub(/ /, "_") + respond_to do |format| format.html { render layout: false } format.csv { send_data @plan.as_csv(@show_sections_questions), filename: "#{file_name}.csv" } @@ -261,13 +262,13 @@ format.docx { render docx: "#{file_name}.docx", content: render_to_string(partial: 'shared/export/plan') } format.pdf do render pdf: file_name, - margin: @formatting[:margin], - footer: { - center: _('Created using the %{application_name}. Last modified %{date}') % {application_name: Rails.configuration.branding[:application][:name], date: l(@plan.updated_at.to_date, formats: :short)}, - font_size: 8, - spacing: (Integer(@formatting[:margin][:bottom]) / 2) - 4, - right: '[page] of [topage]' - } + margin: @formatting[:margin], + footer: { + center: _('Created using the %{application_name}. Last modified %{date}') % {application_name: Rails.configuration.branding[:application][:name], date: l(@plan.updated_at.to_date, formats: :short)}, + font_size: 8, + spacing: (Integer(@formatting[:margin][:bottom]) / 2) - 4, + right: '[page] of [topage]' + } end end end diff --git a/app/views/shared/export/_plan.erb b/app/views/shared/export/_plan.erb index f9fdf65..fb9acb4 100644 --- a/app/views/shared/export/_plan.erb +++ b/app/views/shared/export/_plan.erb @@ -1,9 +1,30 @@ +<% + font_face = (@formatting[:font_face].present? ? "#{@formatting[:font_face]}" : 'Arial, Helvetica, Sans-Serif') + font_size = (@formatting[:font_size].present? ? "#{@formatting[:font_size]}" : '12') + margin_top = '5' + margin_bottom = '10' + margin_left = '12' + margin_right = '12' + + if @formatting[:margin].present? + margin_top = (@formatting[:margin][:top].is_a?(Integer) ? @formatting[:margin][:top] * 4 : @formatting[:margin][:top]) if @formatting[:margin][:top].present? + margin_right = (@formatting[:margin][:right].is_a?(Integer) ? @formatting[:margin][:right] * 4 : @formatting[:margin][:right]) if @formatting[:margin][:right].present? + margin_bottom = (@formatting[:margin][:bottom].is_a?(Integer) ? @formatting[:margin][:bottom] * 4 : @formatting[:margin][:bottom]) if @formatting[:margin][:bottom].present? + margin_left = (@formatting[:margin][:left].is_a?(Integer) ? @formatting[:margin][:left] * 4 : @formatting[:margin][:left]) if @formatting[:margin][:left].present? + end +%> +
- <%= _("A Data Management Plan created using ") + Rails.configuration.branding[:application][:name] %> -
-+ <%= _("A Data Management Plan created using ") + Rails.configuration.branding[:application][:name] %> +
<%= @hash[:attribution].length > 1 ? _("Creators: ") : _('Creator:') %> <%= @hash[:attribution].join(', ') %>