diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index b18af12..48b544d 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -251,7 +251,7 @@ @public_plan = false @hash = @plan.as_pdf(@show_coversheet) - @formatting = @plan.settings(:export).formatting + @formatting = params[:export][:formatting] || @plan.settings(:export).formatting file_name = @plan.title.gsub(/ /, "_") respond_to do |format| @@ -265,7 +265,7 @@ 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: (@formatting[:margin][:bottom] / 2) - 4, + spacing: (Integer(@formatting[:margin][:bottom]) / 2) - 4, right: '[page] of [topage]' } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1d1e2fe..992c6ab 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,6 +30,10 @@ end end + def is_integer?(string) + return string.present? && string.match(/^(\d)+$/) + end + def fingerprinted_asset(name) Rails.env.production? ? "#{name}-#{ASSET_FINGERPRINT}" : name end diff --git a/app/views/shared/export/_plan.erb b/app/views/shared/export/_plan.erb index 467665f..a17f464 100644 --- a/app/views/shared/export/_plan.erb +++ b/app/views/shared/export/_plan.erb @@ -3,6 +3,7 @@ <%= @plan.title %> +<%= @formatting[:font_face] %> <%= render partial: '/shared/export/plan_styling' %> @@ -13,7 +14,7 @@ <% @hash[:phases].each do |phase| %>
-

+

<%= (@hash[:phases].length > 1 ? "#{@plan.title} - #{phase[:title]}" : @plan.title) %>

diff --git a/app/views/shared/export/_plan_styling.erb b/app/views/shared/export/_plan_styling.erb index c013651..e4fc253 100644 --- a/app/views/shared/export/_plan_styling.erb +++ b/app/views/shared/export/_plan_styling.erb @@ -1,22 +1,24 @@ +<% font_size = is_integer?(@formatting[:font_size]) ? Integer(@formatting[:font_size]) : 10 %> +