diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 4e5640a461..ebc4124654 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -15,3 +15,5 @@ @import "font-awesome-sprockets"; @import "font-awesome"; + +@import "tinymce/skins/ui/oxide/skin.css"; \ No newline at end of file diff --git a/app/controllers/plan_exports_controller.rb b/app/controllers/plan_exports_controller.rb index 46bcbef953..e442f3d60c 100644 --- a/app/controllers/plan_exports_controller.rb +++ b/app/controllers/plan_exports_controller.rb @@ -43,6 +43,13 @@ def show .detect { |p| p.visibility_allowed?(@plan) } end + # Added contributors to coverage of plans. + # Users will see both roles and contributor names if the role is filled + @hash[:data_curation] = Contributor.where(plan_id: @plan.id).data_curation + @hash[:investigation] = Contributor.where(plan_id: @plan.id).investigation + @hash[:pa] = Contributor.where(plan_id: @plan.id).project_administration + @hash[:other] = Contributor.where(plan_id: @plan.id).other + respond_to do |format| format.html { show_html } format.csv { show_csv } diff --git a/app/javascript/src/utils/tinymce.js.erb b/app/javascript/src/utils/tinymce.js.erb index 6e523855b4..b1a474a7c1 100644 --- a/app/javascript/src/utils/tinymce.js.erb +++ b/app/javascript/src/utils/tinymce.js.erb @@ -1,7 +1,8 @@ // Import TinyMCE import tinymce from 'tinymce/tinymce'; // Import TinyMCE theme -import 'tinymce/themes/modern/theme'; +import 'tinymce/themes/silver/theme'; +import 'tinymce/icons/default'; // Plugins import 'tinymce/plugins/table'; import 'tinymce/plugins/lists'; @@ -29,7 +30,7 @@ export const defaultOptions = { target_list: false, elementpath: false, resize: true, - autoresize_min_height: 230, + min_height: 230, autoresize_bottom_margin: 10, branding: false, extended_valid_elements: 'iframe[tooltip] , a[href|target=_blank]', diff --git a/app/models/concerns/exportable_plan.rb b/app/models/concerns/exportable_plan.rb index b106db3a7a..7936eaffd3 100644 --- a/app/models/concerns/exportable_plan.rb +++ b/app/models/concerns/exportable_plan.rb @@ -97,10 +97,9 @@ def prepare(user, coversheet = false) hash end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Style/OptionalBooleanParameter - # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def prepare_coversheet hash = {} @@ -110,6 +109,13 @@ def prepare_coversheet roles.administrator.not_creator.first&.user&.name(false) unless attribution.present? hash[:attribution] = attribution + # Added contributors to coverage of plans. + # Users will see both roles and contributor names if the role is filled + hash[:data_curation] = Contributor.where(plan_id: id).data_curation + hash[:investigation] = Contributor.where(plan_id: id).investigation + hash[:pa] = Contributor.where(plan_id: id).project_administration + hash[:other] = Contributor.where(plan_id: id).other + # Org name of plan owner's org hash[:affiliation] = owner.present? ? owner.org.name : '' @@ -132,13 +138,29 @@ def prepare_coversheet end # rubocop:enable Metrics/AbcSize - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + # rubocop:disable Metrics/AbcSize def prepare_coversheet_for_csv(csv, _headings, hash) + csv << [_('Title: '), format(_('%{title}'), title: title)] csv << if Array(hash[:attribution]).many? [_('Creators: '), format(_('%{authors}'), authors: Array(hash[:attribution]).join(', '))] else [_('Creator:'), format(_('%{authors}'), authors: hash[:attribution])] end + if hash[:investigation].present? + csv << [_('Principal Investigator: '), + format(_('%{investigation}'), investigation: hash[:investigation].map(&:name).join(', '))] + end + if hash[:data_curation].present? + csv << [_('Date Manager: '), + format(_('%{data_curation}'), data_curation: hash[:data_curation].map(&:name).join(', '))] + end + if hash[:pa].present? + csv << [_('Project Administrator: '), format(_('%{pa}'), pa: hash[:pa].map(&:name).join(', '))] + end + if hash[:other].present? + csv << [_('Contributor: '), format(_('%{other}'), other: hash[:other].map(&:name).join(', '))] + end + csv << [_('Affiliation: '), format(_('%{affiliation}'), affiliation: hash[:affiliation])] csv << ['Affiliation: ', format(_('%{affiliation}'), affiliation: hash[:affiliation])] csv << if hash[:funder].present? [_('Template: '), format(_('%{funder}'), funder: hash[:funder])] diff --git a/app/views/org_admin/questions/_show.html.erb b/app/views/org_admin/questions/_show.html.erb index 80b5203134..2de1aeda85 100644 --- a/app/views/org_admin/questions/_show.html.erb +++ b/app/views/org_admin/questions/_show.html.erb @@ -108,14 +108,15 @@ ) %> <% if theme_guidances.length > 0 %> <% has_org_themed_guidance = true %> -
<%= _("Click the links below to view organisational guidance - related to the themes associated with this question.") %>
- <% break %> + <% break %> <% end %> <% end %> + <% break if has_org_themed_guidance %> <% end %> <% if has_org_themed_guidance %> +<%= _("Click the links below to view organisational guidance + related to the themes associated with this question.") %>
<% ggs.each do |guidance_group| %> <% themes_q.each do |theme| %> <% theme_guidances = theme.guidances.where( diff --git a/app/views/plans/_download_form.html.erb b/app/views/plans/_download_form.html.erb index b9cb41799c..930d9b6a04 100644 --- a/app/views/plans/_download_form.html.erb +++ b/app/views/plans/_download_form.html.erb @@ -1,3 +1,6 @@ +<% + download_coversheet_tickbox_checked = Rails.configuration.x.plans.download_coversheet_tickbox_checked || false +%> <%= form_tag(plan_export_path(@plan), method: :get, target: '_blank', id: 'download_form') do |f| %><%= _("Creator:") %><%= @hash[:attribution] %>
<%= _("Principal Investigator: ") %><%= @hash[:investigation].map(&:name).join(', ') %>
<%= _("Data Manager: ") %><%= @hash[:data_curation].map(&:name).join(', ') %>
<%= _("Project Administrator: ") %><%= @hash[:pa].map(&:name).join(', ') %>
<%= _("Contributor: ") %><%= @hash[:other].map(&:name).join(', ') %>
<%= _("Affiliation: ") %><%= @hash[:affiliation] %>