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| %>

<%= _('Format') %>

@@ -23,7 +26,7 @@ <%= _("Optional plan components") %>
<%= label_tag 'export[project_details]' do %> - <%= check_box_tag 'export[project_details]', true, false %> + <%= check_box_tag 'export[project_details]', true, download_coversheet_tickbox_checked %> <%= _('project details coversheet') %> <% end %>
diff --git a/app/views/shared/export/_plan_coversheet.erb b/app/views/shared/export/_plan_coversheet.erb index 17051e6e7b..8c3d465800 100644 --- a/app/views/shared/export/_plan_coversheet.erb +++ b/app/views/shared/export/_plan_coversheet.erb @@ -7,6 +7,22 @@

<%= _("Creator:") %><%= @hash[:attribution] %>


+ <%# Added contributors to coverage of plans. + # Users will see both roles and contributor names if the role is filled %> + <%# Roles are ranked by PI -> DM -> PA -> Other (if any) %> + <% if @hash[:investigation].present? %> +

<%= _("Principal Investigator: ") %><%= @hash[:investigation].map(&:name).join(', ') %>


+ <% end %> + <% if @hash[:data_curation].present? %> +

<%= _("Data Manager: ") %><%= @hash[:data_curation].map(&:name).join(', ') %>


+ <% end %> + <% if @hash[:pa].present? %> +

<%= _("Project Administrator: ") %><%= @hash[:pa].map(&:name).join(', ') %>


+ <% end %> + <% if @hash[:other].present? %> +

<%= _("Contributor: ") %><%= @hash[:other].map(&:name).join(', ') %>


+ <% end %> +

<%= _("Affiliation: ") %><%= @hash[:affiliation] %>


<% if @hash[:funder].present? %> diff --git a/app/views/shared/export/_plan_txt.erb b/app/views/shared/export/_plan_txt.erb index ce479c16cd..7a9c42b87f 100644 --- a/app/views/shared/export/_plan_txt.erb +++ b/app/views/shared/export/_plan_txt.erb @@ -2,6 +2,21 @@ <%= "----------------------------------------------------------\n" %> <% if @show_coversheet %> <%= Array(@hash[:attribution]).many? ? _("Creators: ") + Array(@hash[:attribution]).join(", ") : _('Creator:') + @hash[:attribution] %> +<%# Added contributors to coverage of plans. + # Users will see both roles and contributor names if the role is filled %> +<%# Roles are ranked by PI -> DM -> PA -> Other (if any) %> + <% if @hash[:investigation].present? %> +<%= _("Principal Investigator: ") + @hash[:investigation].map(&:name).join(', ') %> + <% end %> + <% if @hash[:data_curation].present? %> +<%= _("Data Manager: ") + @hash[:data_curation].map(&:name).join(', ') %> + <% end %> + <% if @hash[:pa].present? %> +<%= _("Project Administrator: ") + @hash[:pa].map(&:name).join(', ') %> + <% end %> + <% if @hash[:other].present? %> +<%= _("Contributor: ") + @hash[:other].map(&:name).join(', ') %> + <% end %> <%= _("Affiliation: ") + @hash[:affiliation] %> <% if @hash[:funder].present? %> <%= _("Template: ") + @hash[:funder] %> diff --git a/config/initializers/_dmproadmap.rb b/config/initializers/_dmproadmap.rb index a4b810a5ea..c0d18df059 100644 --- a/config/initializers/_dmproadmap.rb +++ b/config/initializers/_dmproadmap.rb @@ -194,6 +194,9 @@ class Application < Rails::Application # regardless of the plans visibility and whether or not the plan has been shared config.x.plans.super_admins_read_all = true + # Check download of a plan coversheet tickbox + config.x.plans.download_coversheet_tickbox_checked = false + # ---------------------------------------------------- # # CACHING - all values are in seconds (86400 == 1 Day) # # ---------------------------------------------------- # diff --git a/package.json b/package.json index 7bc502af32..149fe44c5e 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "rails-erb-loader": "^5.5.2", "regenerator-runtime": "^0.13.5", "timeago.js": "^4.0.2", - "tinymce": "4.9.11", + "tinymce": "^5.10.0", "turbolinks": "^5.2.0", "webpack": "^4.42.1" }, diff --git a/yarn.lock b/yarn.lock index 32f6980787..8570a9a235 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7479,10 +7479,10 @@ timsort@^0.3.0: resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= -tinymce@4.9.11: - version "4.9.11" - resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-4.9.11.tgz#e3dae099722294c5b8d84ba7ef18dd126de6b582" - integrity sha512-nkSLsax+VY5DBRjMFnHFqPwTnlLEGHCco82FwJF2JNH6W+5/ClvNC1P4uhD5lXPDNiDykSHR0XJdEh7w/ICHzA== +tinymce@^5.10.0: + version "5.10.4" + resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-5.10.4.tgz#24ee843c7648ade708605dec15d8dad07809f7db" + integrity sha512-L0ivAhGu7bEo6cUBrCzhtKlkIQqG2sTcL+uu7soMSxrECQIC5VwUnzp9HCEf+fRl36q6zavLV48lf8jelj+gXA== tmp@^0.2.1: version "0.2.1"