diff --git a/app/models/settings/template.rb b/app/models/settings/template.rb index d4cab3d..79a8941 100644 --- a/app/models/settings/template.rb +++ b/app/models/settings/template.rb @@ -24,7 +24,9 @@ VALID_ADMIN_FIELDS = ['project_name', 'project_identifier', 'grant_title', 'principal_investigator', 'project_data_contact', 'project_description', 'funder', 'institution', 'orcid'] - + + VALID_FORMATS = ['csv', 'html', 'pdf', 'text', 'docx'] + DEFAULT_SETTINGS = { formatting: { margin: { diff --git a/app/views/plans/_download_form.html.erb b/app/views/plans/_download_form.html.erb index 296e2e0..2e19d6e 100644 --- a/app/views/plans/_download_form.html.erb +++ b/app/views/plans/_download_form.html.erb @@ -30,7 +30,7 @@

<%= _('Format') %>

- <%= select_tag :format, options_for_select(ExportedPlan::VALID_FORMATS, :pdf), + <%= select_tag :format, options_for_select(Settings::Template::VALID_FORMATS, :pdf), class: 'form-control', "aria-labelledby": "format" %>
@@ -48,54 +48,54 @@
<%= label_tag "export[formatting][font_face]", _('Face'), class: 'control-label' %> - <%= select_tag "export[formatting][font_face]", - options_for_select(Settings::Template::VALID_FONT_FACES, - @export_settings.formatting[:font_face]), - class: 'form-control', + <%= select_tag "export[formatting][font_face]", + options_for_select(Settings::Template::VALID_FONT_FACES, + @export_settings.formatting[:font_face]), + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:font_face] %>
<%= label_tag "export[formatting][font_size]", _('Size') + " (pt)", class: 'control-label' %> - <%= select_tag "export[formatting][font_size]", + <%= select_tag "export[formatting][font_size]", options_for_select(Settings::Template::VALID_FONT_SIZE_RANGE.to_a, @export_settings.formatting[:font_size]), - class: 'form-control', + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:font_size] %>
- <%= label_tag "export[formatting][margin][top]", _('Top'), + <%= label_tag "export[formatting][margin][top]", _('Top'), class: 'control-label' %> - <%= select_tag "export[formatting][margin][top]", - options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, - @export_settings.formatting[:margin][:top]), - class: 'form-control', + <%= select_tag "export[formatting][margin][top]", + options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, + @export_settings.formatting[:margin][:top]), + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:margin][:top] %>
- <%= label_tag "export[formatting][margin][bottom]", _('Bottom'), + <%= label_tag "export[formatting][margin][bottom]", _('Bottom'), class: 'control-label' %> - <%= select_tag "export[formatting][margin][bottom]", - options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, - @export_settings.formatting[:margin][:bottom]), - class: 'form-control', + <%= select_tag "export[formatting][margin][bottom]", + options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, + @export_settings.formatting[:margin][:bottom]), + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:margin][:bottom] %>
- <%= label_tag "export[formatting][margin][left]", _('Left'), + <%= label_tag "export[formatting][margin][left]", _('Left'), class: 'control-label' %> - <%= select_tag "export[formatting][margin][left]", - options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, - @export_settings.formatting[:margin][:left]), - class: 'form-control', + <%= select_tag "export[formatting][margin][left]", + options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, + @export_settings.formatting[:margin][:left]), + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:margin][:left] %>
- <%= label_tag "export[formatting][margin][right]", _('Right'), + <%= label_tag "export[formatting][margin][right]", _('Right'), class: 'control-label' %> - <%= select_tag "export[formatting][margin][right]", - options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, - @export_settings.formatting[:margin][:right]), - class: 'form-control', + <%= select_tag "export[formatting][margin][right]", + options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, + @export_settings.formatting[:margin][:right]), + class: 'form-control', "data-default": @plan.template.settings(:export).formatting[:margin][:rigth] %>