Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

@import "font-awesome-sprockets";
@import "font-awesome";

@import "tinymce/skins/ui/oxide/skin.css";
7 changes: 7 additions & 0 deletions app/controllers/plan_exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
5 changes: 3 additions & 2 deletions app/javascript/src/utils/tinymce.js.erb
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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]',
Expand Down
28 changes: 25 additions & 3 deletions app/models/concerns/exportable_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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 : ''

Expand All @@ -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])]
Expand Down
7 changes: 4 additions & 3 deletions app/views/org_admin/questions/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@
) %>
<% if theme_guidances.length > 0 %>
<% has_org_themed_guidance = true %>
<p><%= _("Click the links below to view organisational guidance
related to the themes associated with this question.") %></p>
<% break %>
<% break %>
<% end %>
<% end %>
<% break if has_org_themed_guidance %>
<% end %>

<% if has_org_themed_guidance %>
<p><%= _("Click the links below to view organisational guidance
related to the themes associated with this question.") %></p>
<% ggs.each do |guidance_group| %>
<% themes_q.each do |theme| %>
<% theme_guidances = theme.guidances.where(
Expand Down
5 changes: 4 additions & 1 deletion app/views/plans/_download_form.html.erb
Original file line number Diff line number Diff line change
@@ -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| %>

<h2><%= _('Format') %></h2>
Expand All @@ -23,7 +26,7 @@
<legend><%= _("Optional plan components") %></legend>
<div class="checkbox">
<%= 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 %>
</div>
Expand Down
16 changes: 16 additions & 0 deletions app/views/shared/export/_plan_coversheet.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@

<p><strong><%= _("Creator:") %></strong><%= @hash[:attribution] %></p><br>

<%# 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? %>
<p><b><%= _("Principal Investigator: ") %></b><%= @hash[:investigation].map(&:name).join(', ') %></p><br>
<% end %>
<% if @hash[:data_curation].present? %>
<p><b><%= _("Data Manager: ") %></b><%= @hash[:data_curation].map(&:name).join(', ') %></p><br>
<% end %>
<% if @hash[:pa].present? %>
<p><b><%= _("Project Administrator: ") %></b><%= @hash[:pa].map(&:name).join(', ') %></p><br>
<% end %>
<% if @hash[:other].present? %>
<p><b><%= _("Contributor: ") %></b><%= @hash[:other].map(&:name).join(', ') %></p><br>
<% end %>

<p><b><%= _("Affiliation: ") %></b><%= @hash[:affiliation] %></p><br>

<% if @hash[:funder].present? %>
Expand Down
15 changes: 15 additions & 0 deletions app/views/shared/export/_plan_txt.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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] %>
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/_dmproadmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) #
# ---------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down