diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27731cc..2c30573 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,10 +17,10 @@ On your local machine, add a remote that points to the original DMPRoadmap codebase. This will allow you to pull down the latest changes and sync up your forked repository -Run the following from your local clone of the repository to setup a remote that will allow you to pull down the latest changes from DMPRoadmap. Then pull down the contributions branch: +Run the following from your local clone of the repository to setup a remote that will allow you to pull down the latest changes from DMPRoadmap. Then pull down the development branch: ```bash git remote add upstream https://github.com/DMPRoadmap/roadmap.git -git fetch contributions +git fetch development ``` ### Pulling down the latest changes from DMPRoadmap into your fork @@ -31,12 +31,12 @@ ### Create a new feature/bug fix/translations branch -You should always base your new branch off of the contributions branch. We keep this branch up to date with the latest release. Checkout the contributions branch, sync it with DMPRoadmap and then push the latest up to your own fork: +You should always base your new branch off of the development branch. We keep this branch up to date with the latest release. Checkout the development branch, sync it with DMPRoadmap and then push the latest up to your own fork: ```bash -git checkout contributions -git pull upstream contributions -git push origin contributions +git checkout development +git pull upstream development +git push origin development git checkout -b [my-branch] ``` @@ -50,7 +50,7 @@ When you are finished making changes, we ask that all contributors squash their commits into a single git commit. This helps us keep the git history clean and makes it easier to revert any changes if necessary. -_Note that if this is your first time rebasing a branch we recommend making a buckup of the branch first since a rebase creates the potential for you to lose your changes if its done incorrectly: `git checkout -b [feature branch]-bak && git checkout [feature branch]`_ +_Note that if this is your first time rebasing a branch we recommend making a backup of the branch first since a rebase creates the potential for you to lose your changes if its done incorrectly: `git checkout -b [feature branch]-bak && git checkout [feature branch]`_ To rebase your feature branch you should follow this example: @@ -130,7 +130,7 @@ Once your changes are complete, push your branch up to your fork, `git push origin [my-branch]` -Then login to Github and go to your fork. Select your branch from the list and click 'New Pull Request'. On the page that opens, select the 'contributions' branch on the DMPRoadmap section. +Then login to Github and go to your fork. Select your branch from the list and click 'New Pull Request'. On the page that opens, select the 'development' branch on the DMPRoadmap section. Then review your code and provide us with detailed comments about what the changes are doing (e.g. adding a new feature, fixing a recorded bug, etc.). If you are working off of one of our Github issues, then please note that in the PR message with a `Fixes #1234`. @@ -142,11 +142,11 @@ ### Acceptence of your PR -Once your code has been approved a member of the core development team will merge it into the contributions branch and then into development when we are ready to include it in a sprint. +Once your code has been approved a member of the core development team will merge it into the development branchand include it in an upcoming release. At this point its a good idea to delete the branch from your fork in Github and also delete it from your local machine via: ```bash -git checkout contributions +git checkout development git branch -D [my-branch] ``` diff --git a/app/controllers/concerns/paginable.rb b/app/controllers/concerns/paginable.rb index 0c58199..ef6fcc9 100644 --- a/app/controllers/concerns/paginable.rb +++ b/app/controllers/concerns/paginable.rb @@ -96,7 +96,7 @@ if @paginable_params[:sort_field] == sort_field className = upcasing_sort_direction == 'ASC'? 'fa-sort-asc' : 'fa-sort-desc' end - return raw("") + return raw("Sort by #{sort_field.split('.').first}") end # Returns the sort url for a given sort_field. def sort_link_url(sort_field) diff --git a/app/controllers/org_admin/questions_controller.rb b/app/controllers/org_admin/questions_controller.rb index 555b105..69d008b 100644 --- a/app/controllers/org_admin/questions_controller.rb +++ b/app/controllers/org_admin/questions_controller.rb @@ -1,7 +1,7 @@ module OrgAdmin class QuestionsController < ApplicationController include Versionable - + respond_to :html after_action :verify_authorized @@ -9,32 +9,32 @@ def show question = Question.includes(:annotations, :question_options, section: { phase: :template }).find(params[:id]) authorize question - render partial: 'show', locals: { - template: question.section.phase.template, + render partial: 'show', locals: { + template: question.section.phase.template, section: question.section, - question: question + question: question } end - + # GET /org_admin/templates/[:template_id]/phases/[:phase_id]/sections/[:section_id]/question/[:id]/edit def edit question = Question.includes(:annotations, :question_options, section: { phase: :template }).find(params[:id]) authorize question - render partial: 'edit', locals: { - template: question.section.phase.template, + render partial: 'edit', locals: { + template: question.section.phase.template, section: question.section, - question: question + question: question } end - + # GET /org_admin/templates/[:template_id]/phases/[:phase_id]/sections/[:section_id]/questions/new def new section = Section.includes(:questions, phase: :template).find(params[:section_id]) nbr = section.questions.maximum(:number) question = Question.new({ section_id: section.id, question_format: QuestionFormat.find_by(title: 'Text area'), number: nbr.present? ? nbr + 1 : 1 }) authorize question - render partial: 'form', locals: { - template: section.phase.template, + render partial: 'form', locals: { + template: section.phase.template, section: section, question: question, method: 'post', @@ -66,12 +66,15 @@ authorize question begin question = get_modifiable(question) - # Need to reattach the incoming annotation's and question_options to the + # Need to reattach the incoming annotation's and question_options to the # modifiable (versioned) question attrs = question_params attrs = transfer_associations(question) if question.id != params[:id] # If the user unchecked all of the themes set the association to an empty array - attrs[:theme_ids] = [] unless attrs[:theme_ids].present? + # add check for number present to ensure this is not just an annotation + if attrs[:theme_ids].blank? && attrs[:number].present? + attrs[:theme_ids] = [] + end if question.update!(attrs) flash[:notice] = success_message(_('question'), _('updated')) else @@ -83,14 +86,14 @@ end if question.section.phase.template.customization_of.present? redirect_to org_admin_template_phase_path({ - template_id: question.section.phase.template.id, - id: question.section.phase.id, + template_id: question.section.phase.template.id, + id: question.section.phase.id, section: question.section.id }) else redirect_to edit_org_admin_template_phase_path({ - template_id: question.section.phase.template.id, - id: question.section.phase.id, + template_id: question.section.phase.template.id, + id: question.section.phase.id, section: question.section.id }) end @@ -112,8 +115,8 @@ flash[:alert] = _('Unable to create a new version of this template.') end redirect_to edit_org_admin_template_phase_path({ - template_id: section.phase.template.id, - id: section.phase.id, + template_id: section.phase.template.id, + id: section.phase.id, section: section.id }) end @@ -122,23 +125,23 @@ def question_params params.require(:question).permit(:number, :text, :question_format_id, :option_comment_display, :default_value, question_options_attributes: [:id, :number, :text, :is_default, :_destroy], annotations_attributes: [:id, :text, :org_id, :org, :type], theme_ids: []) end - - # When a template gets versioned by changes to one of its questions we need to loop + + # When a template gets versioned by changes to one of its questions we need to loop # through the incoming params and ensure that the annotations and question_options # get attached to the new question def transfer_associations(question) attrs = question_params if attrs[:annotations_attributes].present? attrs[:annotations_attributes].each_key do |key| - old_annotation = question.annotations.select do |a| - a.org_id.to_s == attrs[:annotations_attributes][key][:org_id] && a.type.to_s == attrs[:annotations_attributes][key][:type] + old_annotation = question.annotations.select do |a| + a.org_id.to_s == attrs[:annotations_attributes][key][:org_id] && a.type.to_s == attrs[:annotations_attributes][key][:type] end attrs[:annotations_attributes][key][:id] = old_annotation.first.id unless old_annotation.empty? end end # TODO: This question_options id swap feel fragile. We cannot really match on any of the # data elements because the user may have changed them so we rely on its position - # within the array/query since they should be equivalent. + # within the array/query since they should be equivalent. if attrs[:question_options_attributes].present? attrs[:question_options_attributes].each_key do |key| attrs[:question_options_attributes][key][:id] = question.question_options[key.to_i].id.to_s if question.question_options[key.to_i].present? @@ -147,4 +150,4 @@ attrs end end -end \ No newline at end of file +end diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 6376398..fc734e3 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -29,11 +29,11 @@ # Only allow super admins to change the org types and shib info if current_user.can_super_admin? # Handle Shibboleth identifiers if that is enabled - if Rails.application.config.shibboleth_use_filtered_discovery_service + if Rails.application.config.shibboleth_use_filtered_discovery_service && params[:shib_id].present? shib = IdentifierScheme.find_by(name: 'shibboleth') shib_settings = @org.org_identifiers.select{ |ids| ids.identifier_scheme == shib}.first - if params[:shib_id].present? || params[:shib_domain].present? + if !params[:shib_id].blank? shib_settings = OrgIdentifier.new(org: @org, identifier_scheme: shib) unless shib_settings.present? shib_settings.identifier = params[:shib_id] shib_settings.attrs = {domain: params[:shib_domain]} @@ -81,7 +81,7 @@ session['org_id'] = params[:org_name] scheme = IdentifierScheme.find_by(name: 'shibboleth') - shib_entity = OrgIdentifier.where(org_id: params[:org_name], identifier_scheme: scheme) + shib_entity = OrgIdentifier.where(org_id: params['shib-ds'][:org_id], identifier_scheme: scheme) if !shib_entity.empty? # Force SSL @@ -104,6 +104,6 @@ private def org_params params.require(:org).permit(:name, :abbreviation, :logo, :contact_email, :contact_name, :remove_logo, :org_type, - :feedback_enabled, :feedback_email_subject, :feedback_email_msg, :banner_text) + :feedback_enabled, :feedback_email_msg) end end diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 6cba2fb..a5deb9a 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -3,6 +3,8 @@ require 'pp' helper PaginableHelper helper SettingsTemplateHelper + include FeedbacksHelper + after_action :verify_authorized, except: [:overview] def index @@ -165,6 +167,7 @@ guidance_groups_ids = plan.guidance_groups.collect(&:id) guidance_groups = GuidanceGroup.where(published: true, id: guidance_groups_ids) + # Since the answers have been pre-fetched through plan (see Plan.load_for_phase) # we create a hash whose keys are question id and value is the answer associated answers = plan.answers.reduce({}){ |m, a| m[a.question_id] = a; m } @@ -354,18 +357,19 @@ end def request_feedback - plan = Plan.find(params[:id]) - authorize plan + @plan = Plan.find(params[:id]) + authorize @plan alert = _('Unable to submit your request for feedback at this time.') begin - if plan.request_feedback(current_user) - redirect_to share_plan_path(plan), notice: _('Your request for feedback has been submitted.') + if @plan.request_feedback(current_user) + redirect_to share_plan_path(@plan), + notice: _(request_feedback_flash_notice) else - redirect_to share_plan_path(plan), alert: alert + redirect_to share_plan_path(@plan), alert: alert end rescue Exception - redirect_to share_plan_path(plan), alert: alert + redirect_to share_plan_path(@plan), alert: alert end end @@ -451,4 +455,15 @@ end plan.delete(src_plan_key) end + + # Flash notice for successful feedback requests + # + # @return [String] + def request_feedback_flash_notice + # Use the generic feedback confirmation message unless the Org has + # specified one + text = current_user.org.feedback_email_msg || + feedback_confirmation_default_message + feedback_constant_to_text(text, current_user, @plan, current_user.org) + end end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 3d69e9e..bd73760 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -7,7 +7,7 @@ registered = true @role = Role.new(role_params) authorize @role - + access_level = params[:role][:access_level].to_i @role.set_access_level(access_level) message = '' @@ -30,7 +30,8 @@ if @role.save if registered deliver_if(recipients: user, key: 'users.added_as_coowner') do |r| - UserMailer.sharing_notification(@role, r, current_user).deliver_now + UserMailer.sharing_notification(@role, r, inviter: current_user) + .deliver_now end end flash[:notice] = message @@ -73,7 +74,7 @@ end redirect_to controller: 'plans', action: 'share', id: @role.plan.id end - + # This function makes user's role on a plan inactive - i.e. "removes" this from their plans def deactivate role = Role.find(params[:id]) diff --git a/app/helpers/feedbacks_helper.rb b/app/helpers/feedbacks_helper.rb new file mode 100644 index 0000000..15fca1b --- /dev/null +++ b/app/helpers/feedbacks_helper.rb @@ -0,0 +1,18 @@ +module FeedbacksHelper + def feedback_confirmation_default_subject + _('%{application_name}: Your plan has been submitted for feedback') + end + + def feedback_confirmation_default_message + _('

Hello %{user_name}.

'\ + '

Your plan "%{plan_name}" has been submitted for feedback from an administrator at your organisation. '\ + 'If you have questions pertaining to this action, please contact us at %{organisation_email}.

') + end + + def feedback_constant_to_text(text, user, plan, org) + _("#{text}") % {application_name: Rails.configuration.branding[:application][:name], + user_name: user.name, + plan_name: plan.title, + organisation_email: org.contact_email} + end +end diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index a7ee2df..d837693 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -1,21 +1,5 @@ module MailerHelper include PermsHelper - def feedback_confirmation_default_subject - _('%{application_name}: Your plan has been submitted for feedback') - end - - def feedback_confirmation_default_message - _('

Hello %{user_name}.

'\ - '

Your plan "%{plan_name}" has been submitted for feedback from an administrator at your organisation. '\ - 'If you have questions pertaining to this action, please contact us at %{organisation_email}.

') - end - - def feedback_constant_to_text(text, user, plan, org) - _("#{text}") % {application_name: Rails.configuration.branding[:application][:name], - user_name: user.name, - plan_name: plan.title, - organisation_email: org.contact_email} - end # Returns an unordered HTML list with the permissions associated to the user passed def privileges_list(user) @@ -23,7 +7,7 @@ names = name_and_text r= "" end diff --git a/app/helpers/orgs_helper.rb b/app/helpers/orgs_helper.rb new file mode 100644 index 0000000..f106fa1 --- /dev/null +++ b/app/helpers/orgs_helper.rb @@ -0,0 +1,19 @@ +module OrgsHelper + # frozen_string_literal: true + + DEFAULT_EMAIL = '%{organisation_email}' + + # Tooltip string for Org feedback form. + # + # @param org [Org] The current Org we're updating feedback form for. + # @return [String] The tooltip message + def tooltip_for_org_feedback_form(org) + email = org.contact_email.presence || DEFAULT_EMAIL + _("SAMPLE MESSAGE: A data librarian from %{org_name} will respond to your request within 48 + hours. If you have questions pertaining to this action please contact us + at %{organisation_email}.") % { + organisation_email: email, + org_name: org.name + } + end +end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 6a16a99..3dcd176 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,95 +1,97 @@ class UserMailer < ActionMailer::Base include MailerHelper helper MailerHelper + helper FeedbacksHelper + default from: Rails.configuration.branding[:organisation][:email] - + def welcome_notification(user) @user = user FastGettext.with_locale FastGettext.default_locale do - mail(to: @user.email, + mail(to: @user.email, subject: _('Welcome to %{tool_name}') %{ :tool_name => Rails.configuration.branding[:application][:name] }) end end - def sharing_notification(role, user, current_user) + def sharing_notification(role, user, inviter:) @role = role @user = user - @current_user = current_user - FastGettext.with_locale FastGettext.default_locale do - mail(to: @role.user.email, - subject: d_('dmpopidor', '%{user_name} has shared a Data Management Plan with you in %{tool_name}') %{ - :user_name => current_user.name(false), - :tool_name => Rails.configuration.branding[:application][:name] - }) + @inviter = inviter + subject = d_('dmpopidor', '%{user_name} has shared a Data Management Plan with you in %{tool_name}') % { + :user_name => @inviter.name(false), + :tool_name => Rails.configuration.branding[:application][:name] + } + FastGettext.with_locale FastGettext.default_locale do + mail(to: @role.user.email, subject: subject) end end - + def permissions_change_notification(role, user) @role = role @user = user if user.active? FastGettext.with_locale FastGettext.default_locale do - mail(to: @role.user.email, + mail(to: @role.user.email, subject: _('Changed permissions on a Data Management Plan in %{tool_name}') %{ :tool_name => Rails.configuration.branding[:application][:name] }) end end end - + def plan_access_removed(user, plan, current_user) @user = user @plan = plan @current_user = current_user if user.active? FastGettext.with_locale FastGettext.default_locale do - mail(to: @user.email, + mail(to: @user.email, subject: "#{_('Permissions removed on a DMP in %{tool_name}') %{ :tool_name => Rails.configuration.branding[:application][:name] }}") end end end - + def feedback_notification(recipient, plan, requestor) @user = requestor - + if @user.org.present? && recipient.active? @org = @user.org @plan = plan @recipient = recipient - + FastGettext.with_locale FastGettext.default_locale do - mail(to: recipient.email, + mail(to: recipient.email, subject: _("%{application_name}: %{user_name} requested feedback on a plan") % {application_name: Rails.configuration.branding[:application][:name], user_name: @user.name(false)}) end end end - + def feedback_complete(recipient, plan, requestor) @requestor = requestor - @user = recipient - @plan = plan - + @user = recipient + @plan = plan + @phase = plan.phases.first if recipient.active? FastGettext.with_locale FastGettext.default_locale do - mail(to: recipient.email, + mail(to: recipient.email, subject: _("%{application_name}: Expert feedback has been provided for %{plan_title}") % {application_name: Rails.configuration.branding[:application][:name], plan_title: @plan.title}) end end end - + def feedback_confirmation(recipient, plan, requestor) user = requestor if user.org.present? && recipient.active? org = user.org plan = plan - + # Use the generic feedback confirmation message unless the Org has specified one subject = (org.feedback_email_subject.present? ? org.feedback_email_subject : feedback_confirmation_default_subject) message = (org.feedback_email_msg.present? ? org.feedback_email_msg : feedback_confirmation_default_message) @body = feedback_constant_to_text(message, user, plan, org) - + FastGettext.with_locale FastGettext.default_locale do - mail(to: recipient.email, + mail(to: recipient.email, subject: feedback_constant_to_text(subject, user, plan, org)) end end @@ -105,7 +107,7 @@ end end end - + # @param commenter - User who wrote the comment # @param plan - Plan for which the comment is associated to def new_comment(commenter, plan) @@ -123,7 +125,7 @@ end def admin_privileges(user) - @user = user + @user = user if user.active? FastGettext.with_locale FastGettext.default_locale do mail(to: user.email, subject: diff --git a/app/models/plan.rb b/app/models/plan.rb index 79c50b6..55a18eb 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -194,11 +194,6 @@ end if self.save! - # Send an email confirmation to the owners and co-owners - owners = User.joins(:roles).where('roles.plan_id =? AND roles.access IN (?)', self.id, Role.access_values_for(:administrator)) - deliver_if(recipients: owners, key: 'users.feedback_requested') do |r| - UserMailer.feedback_confirmation(r, self, user).deliver_now - end # Send an email to the org-admin contact if user.org.contact_email.present? contact = User.new(email: user.org.contact_email, firstname: user.org.contact_name) diff --git a/app/views/branded/guidance_groups/admin_new.html.erb b/app/views/branded/guidance_groups/admin_new.html.erb index a5aa0ac..72550f7 100644 --- a/app/views/branded/guidance_groups/admin_new.html.erb +++ b/app/views/branded/guidance_groups/admin_new.html.erb @@ -13,17 +13,17 @@ <%= f.label _('Name'), for: :name, class: "control-label" %> <%= f.text_field :name, as: :string, class: "form-control", 'aria-required': true, 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %> - -
- <%= f.check_box :published, 'data-toggle': 'tooltip', title: _("Check this box when you are ready for guidance associated with this group to appear on user's plans.") %> - <%= f.label _('Published'), for: :published, class: "control-label" %> -
- -
- <%= f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.") %> - <%= f.label _('Optional Subset'), for: :optional_subset, class: "control-label" %><%= _(' (e.g. School/ Department) ') %> -
- +
+
+ <%= f.check_box :published, 'data-toggle': 'tooltip', title: _("Check this box when you are ready for guidance associated with this group to appear on user's plans.") %> + <%= f.label _('Published'), class: "control-label" %> +
+ +
+ <%= f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.") %> + <%= f.label _('Optional Subset'), class: "control-label" %><%= _(' (e.g. School/ Department) ') %> +
+
<%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %> diff --git a/app/views/branded/guidances/new_edit.html.erb b/app/views/branded/guidances/new_edit.html.erb index cf41f7d..45d7855 100644 --- a/app/views/branded/guidances/new_edit.html.erb +++ b/app/views/branded/guidances/new_edit.html.erb @@ -14,8 +14,8 @@ <%= text_area_tag("guidance-text", guidance.text, class: "form-control", 'aria-required': true, rows: 10) %>
<%= render partial: 'org_admin/shared/theme_selector', - locals: { f: f, all_themes: themes, as_radio: true, required: true, - popover_message: _('Select one theme that is relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %> + locals: { f: f, all_themes: themes, as_radio: false, required: true, + popover_message: _('Select one or more themes that are relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %>
<%= f.label _('Guidance group'), for: :guidance_group_id, class: 'control-label' %> <%= f.collection_select(:guidance_group_id, guidance_groups, diff --git a/app/views/branded/layouts/application.html.erb b/app/views/branded/layouts/application.html.erb index c150644..c99e53d 100644 --- a/app/views/branded/layouts/application.html.erb +++ b/app/views/branded/layouts/application.html.erb @@ -102,6 +102,7 @@ VALIDATION_MESSAGE_PASSWORDS_MATCH: _('The passwords must match.'), VALIDATION_MESSAGE_RADIO: _('Please choose one of the options.'), VALIDATION_MESSAGE_CHECKBOX: _('Please check the box to continue.'), + VALIDATION_MESSAGE_MULTI_CHECKBOX: _('Please select at least one of the options to continue.'), VALIDATION_MESSAGE_SELECT: _('Please select a value from the list.'), VALIDATION_MESSAGE_TEXT: _('This field is required.'), diff --git a/app/views/branded/org_admin/plans/index.html.erb b/app/views/branded/org_admin/plans/index.html.erb index 1c87179..aa33830 100644 --- a/app/views/branded/org_admin/plans/index.html.erb +++ b/app/views/branded/org_admin/plans/index.html.erb @@ -1,4 +1,4 @@ -<% title _('%{org_name} Plans') % { org_name: current_user.org.name } %> +<% title "#{current_user.org.name} Plans" %>

<%= _('%{org_name} Plans') % { org_name: current_user.org.name } %>

@@ -13,10 +13,10 @@
- - - - + + + + <% @feedback_plans.each do |notice| %> diff --git a/app/views/branded/plans/_edit_details.html.erb b/app/views/branded/plans/_edit_details.html.erb index 5673d7b..1e29743 100644 --- a/app/views/branded/plans/_edit_details.html.erb +++ b/app/views/branded/plans/_edit_details.html.erb @@ -5,12 +5,12 @@
<%= f.label(:title, _('Project title'), class: 'control-label') %>
-
+
<%= f.text_field(:title, class: "form-control", "aria-required": true, 'data-toggle': 'tooltip', title: _('If applying for funding, state the name exactly as in the grant proposal.')) %>
<%= f.hidden_field :visibility %> - <%= f.label(:is_test, raw("#{check_box_tag(:is_test,1, @plan.is_test?)} #{_('mock project for testing, practice, or educational purposes')}"), class: 'control-label') %> + <%= f.label(:is_test, raw("#{check_box_tag(:is_test,1, @plan.is_test? , "aria-label": "is_test")} #{_('mock project for testing, practice, or educational purposes')}"), class: 'control-label') %>
@@ -18,7 +18,7 @@
<%= f.label(:funder_name, _('Funder'), class: 'control-label') %>
-
+
<%= f.text_field( :funder_name, class: "form-control", @@ -29,7 +29,7 @@
<%= f.label(:grant_number, _('Grant number'), class: 'control-label') %>
-
+
<%= f.text_field(:grant_number, class: "form-control", "aria-required": false, 'data-toggle': 'tooltip', title: _('Grant reference number if applicable [POST-AWARD DMPs ONLY]')) %>
@@ -38,7 +38,7 @@
<%= f.label(:description, _('Project abstract'), class: 'control-label') %>
-
"> +
"> <%= f.text_area( :description, rows: 6, class: 'form-control tinymce', @@ -49,114 +49,117 @@
<%= f.label(:identifier, _('ID'), class: 'control-label') %>
-
+
<%= f.text_field(:identifier, class: "form-control", "aria-required": false, 'data-toggle': "tooltip", title: _('A pertinent ID as determined by the funder and/or organisation.')) %>
- -

<%= _('Principal investigator') %>

-
-
- <%= f.label(:principal_investigator, _('Name'), class: 'control-label') %> +
+ <%= _("Principal Investigator") %> +
+
+ <%= f.label(:principal_investigator, _('Name'), class: 'control-label') %> +
+
+ <%= f.text_field( + :principal_investigator, + class: "form-control", + "aria-required": false) %> +
-
- <%= f.text_field( - :principal_investigator, - class: "form-control", - "aria-required": false) %> +
+
+ <%= f.label(:principal_investigator_identifier, _('ORCID iD'), class: 'control-label') %> +
+
+ <%= f.text_field( + :principal_investigator_identifier, + class: "form-control", + "aria-required": false) %> +
-
-
-
- <%= f.label(:principal_investigator_identifier, _('ORCID iD'), class: 'control-label') %> +
+
+ <%= f.label(:principal_investigator_email, _('Email'), class: 'control-label') %> +
+
+ <%= f.email_field( + :principal_investigator_email, + class: "form-control", + "aria-required": false, + "data-validation": "email") %> +
-
- <%= f.text_field( - :principal_investigator_identifier, - class: "form-control", - "aria-required": false) %> +
+
+ <%= f.label(:principal_investigator_phone, _('Phone'), class: 'control-label') %> +
+
+ <%= f.phone_field( + :principal_investigator_phone, + class: "form-control", + "aria-required": false) %> +
-
-
-
- <%= f.label(:principal_investigator_email, _('Email'), class: 'control-label') %> +
+
+ <%= _('Data contact person') %> +
+ <% checked = ((@plan.data_contact.present? || @plan.data_contact_phone.present? || @plan.data_contact_email.present?) ? 1 : 0) %> + <%= label_tag(:show_data_contact, raw("#{check_box_tag(:show_data_contact, checked, checked == 0)} #{_('Same as Principal Investigator')}"), class: 'control-label') %>
-
- <%= f.email_field( - :principal_investigator_email, - class: "form-control", - "aria-required": false, - "data-validation": "email") %> +
+
+ <%= f.label(:data_contact, _('Name'), class: 'control-label') %> +
+
+ <%= f.text_field( + :data_contact, + class: "form-control", + "aria-required": false) %> +
-
-
-
- <%= f.label(:principal_investigator_phone, _('Phone'), class: 'control-label') %> +
+
+ <%= f.label(:data_contact_email, _('Email'), class: 'control-label') %> +
+
+ <%= f.email_field( + :data_contact_email, + class: "form-control", + "aria-required": false, + "data-validation": "email") %> +
-
- <%= f.phone_field( - :principal_investigator_phone, - class: "form-control", - "aria-required": false) %> +
+
+ <%= f.label(:data_contact_phone, _('Phone'), class: 'control-label') %> +
+
+ <%= f.phone_field( + :data_contact_phone, + class: "form-control", + "aria-required": false) %> +
-
- -

<%= _('Data contact person') %>

-
- <% checked = ((@plan.data_contact.present? || @plan.data_contact_phone.present? || @plan.data_contact_email.present?) ? 1 : 0) %> - <%= label_tag(:show_data_contact, raw("#{check_box_tag(:show_data_contact, checked, checked == 0)} #{_('Same as Principal Investigator')}"), class: 'control-label') %> -
-
-
- <%= f.label(:data_contact, _('Name'), class: 'control-label') %> -
-
- <%= f.text_field( - :data_contact, - class: "form-control", - "aria-required": false) %> -
-
-
-
- <%= f.label(:data_contact_email, _('Email'), class: 'control-label') %> -
-
- <%= f.email_field( - :data_contact_email, - class: "form-control", - "aria-required": false, - "data-validation": "email") %> -
-
-
-
- <%= f.label(:data_contact_phone, _('Phone'), class: 'control-label') %> -
-
- <%= f.phone_field( - :data_contact_phone, - class: "form-control", - "aria-required": false) %> -
-
+
<%= f.button(_('Submit'), class: "btn btn-default", type: "submit") %>

<%= _('Plan Guidance Configuration') %>

<%= _('To help you write your plan, %{application_name} can show you guidance from a variety of organisations.') % - {application_name: Rails.configuration.branding[:application][:name]} %> -

-

<%= _('Select up to 6 organisations to see their guidance.') %>

-
    - <%= render partial: "guidance_choices", - locals: {choices: @important_ggs, form: f, - current_selections: @selected_guidance_groups} %> -
- + {application_name: Rails.configuration.branding[:application][:name]} %> +

+
+

<%= _('Select up to 6 organisations to see their guidance.') %>

+
    + <%= render partial: "guidance_choices", + locals: {choices: @important_ggs, form: f, + current_selections: @selected_guidance_groups} %> +
+

<%= _('Find guidance from additional organisations below') %>

- <%= link_to 'See the full list', '#', 'data-toggle' => 'modal', 'data-target' => '#modal-full-guidances', class: 'modal-guidances-window' %> + <%= link_to _('See the full list'), '#', 'data-toggle' => 'modal', 'data-target' => '#modal-full-guidances', class: 'modal-guidances-window' %>
<%= f.button(_('Submit'), class: "btn btn-default", type: "submit") %> diff --git a/app/views/branded/shared/_create_account_form.html.erb b/app/views/branded/shared/_create_account_form.html.erb index f4fda63..506d9ff 100644 --- a/app/views/branded/shared/_create_account_form.html.erb +++ b/app/views/branded/shared/_create_account_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for resource, as: 'user', url: registration_path("user"), html: {autocomplete: "off", id: "create_account_form"} do |f| %> +<%= form_for resource, namespace: 'new', url: registration_path("user"), html: {autocomplete: "off", id: "create_account_form"} do |f| %>
<%= f.label(:firstname, _('First Name'), class: "control-label") %> @@ -23,14 +23,18 @@ <%= f.label(:password, _('Password'), class: "control-label") %> <%= f.password_field(:password, class: "form-control", "aria-required": true) %>
-
- +
+
+ +
-
- <%= f.label(:accept_terms, - raw("#{ f.check_box(:accept_terms, "aria-required": true, "data-validation-error": _('You must agree to the term and conditions.')) } #{_('I accept the')} #{_('terms and conditions')}")) %> +
+
+ <%= f.label(:accept_terms, + raw("#{ f.check_box(:accept_terms, "aria-required": true, "data-validation-error": _('You must agree to the term and conditions.')) } #{_('I accept the')} #{_('terms and conditions')}")) %> +
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index e7788b9..ea8f0e9 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -20,7 +20,7 @@ <%= f.password_field(:password_confirmation, class: 'form-control', "aria-required": true) %>
-
diff --git a/app/views/devise/registrations/_password_confirmation.html.erb b/app/views/devise/registrations/_password_confirmation.html.erb index fb83407..d0a9479 100644 --- a/app/views/devise/registrations/_password_confirmation.html.erb +++ b/app/views/devise/registrations/_password_confirmation.html.erb @@ -22,7 +22,7 @@
-
+
+
+ <%= f.label :published, raw("#{f.check_box :published, 'data-toggle': 'tooltip', title: _('Check this box when you are ready for guidance associated with this group to appear on user\'s plans.')} #{_('Published')}") %> +
-
- <%= f.label :published, raw("#{f.check_box :published, 'data-toggle': 'tooltip', title: _('Check this box when you are ready for guidance associated with this group to appear on user\'s plans.')} #{_('Published')}") %> -
- -
- <%= f.label :optional_subset, raw("#{f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _('If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the \'create plan\' wizard.')} #{_('Optional Subset (e.g. School/Department)')}") %> -
- +
+ <%= f.label :optional_subset, raw("#{f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _('If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the \'create plan\' wizard.')} #{_('Optional Subset (e.g. School/Department)')}") %> +
+
<%= f.submit _('Save'), class: 'btn btn-primary' %> \ No newline at end of file diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index e76c43c..c20ab18 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -13,17 +13,17 @@ <%= f.label _('Name'), for: :name, class: "control-label" %> <%= f.text_field :name, as: :string, class: "form-control", 'aria-required': true, 'data-toggle': 'tooltip', title: _('Add an appropriate name for your guidance group. This name will tell the end user where the guidance has come from. We suggest you use the organisation or department name e.g. "OU" or "Maths & Stats"') %>
- -
- <%= f.check_box :published, 'data-toggle': 'tooltip', title: _("Check this box when you are ready for guidance associated with this group to appear on user's plans.") %> - <%= f.label _('Published'), for: :published, class: "control-label" %> -
- -
- <%= f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.") %> - <%= f.label _('Optional Subset'), for: :optional_subset, class: "control-label" %><%= _(' (e.g. School/ Department) ') %> -
- +
+
+ <%= f.check_box :published, 'data-toggle': 'tooltip', title: _("Check this box when you are ready for guidance associated with this group to appear on user's plans.") %> + <%= f.label _('Published'), class: "control-label" %> +
+ +
+ <%= f.check_box :optional_subset, 'data-toggle': 'tooltip', title: _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.") %> + <%= f.label _('Optional Subset'), class: "control-label" %><%= _(' (e.g. School/ Department) ') %> +
+
<%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %> diff --git a/app/views/guidances/new_edit.html.erb b/app/views/guidances/new_edit.html.erb index 66e3e2c..28e3cf8 100644 --- a/app/views/guidances/new_edit.html.erb +++ b/app/views/guidances/new_edit.html.erb @@ -14,8 +14,8 @@ <%= text_area_tag("guidance-text", guidance.text, class: "form-control", 'aria-required': true, rows: 10) %>
<%= render partial: 'org_admin/shared/theme_selector', - locals: { f: f, all_themes: themes, as_radio: true, required: true, - popover_message: _('Select one theme that is relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %> + locals: { f: f, all_themes: themes, as_radio: false, required: true, + popover_message: _('Select one or more themes that are relevant to this guidance. This will display your generic organisation-level guidance, or any Schools/Departments for which you create guidance groups, across all templates that have questions with the corresponding theme tags.') } %>
<%= f.label _('Guidance group'), for: :guidance_group_id, class: 'control-label' %> <%= f.collection_select(:guidance_group_id, guidance_groups, diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index ecd75c0..2652985 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,4 +1,4 @@ -<% +<% # Override the default Rails route helper for the contact_us page IF an alternate contact_us url was defined # in the branding config file contact_us = Rails.application.config.branding[:organisation][:contact_us_url] || contact_us_path @@ -10,11 +10,10 @@
<%= _('Plan') %><%= _('Requestor') %><%= _('Type') %><%= _('Actions') %><%= _('Plan') %><%= _('Requestor') %><%= _('Type') %><%= _('Actions') %>
- - + + diff --git a/app/views/org_admin/plans/index.html.erb b/app/views/org_admin/plans/index.html.erb index 3e8d2f4..0c89215 100644 --- a/app/views/org_admin/plans/index.html.erb +++ b/app/views/org_admin/plans/index.html.erb @@ -13,10 +13,10 @@
<%= _('Sections')%><%= _('Questions')%><%= _('Sections')%><%= _('Questions')%>
- - - - + + + + <% @feedback_plans.each do |notice| %> diff --git a/app/views/org_admin/question_options/_option_fields.html.erb b/app/views/org_admin/question_options/_option_fields.html.erb index 63cd834..1bb60f2 100644 --- a/app/views/org_admin/question_options/_option_fields.html.erb +++ b/app/views/org_admin/question_options/_option_fields.html.erb @@ -21,7 +21,7 @@ <% options_q.number = i %>
- <%= op.number_field :number, in: 1..20, class: 'form-control' %> + <%= op.number_field :number, min: 1, class: 'form-control' %>
<%= op.text_field :text, as: :string, class: 'form-control' %> diff --git a/app/views/org_admin/shared/_theme_selector.html.erb b/app/views/org_admin/shared/_theme_selector.html.erb index 37cae13..13dd640 100644 --- a/app/views/org_admin/shared/_theme_selector.html.erb +++ b/app/views/org_admin/shared/_theme_selector.html.erb @@ -3,41 +3,41 @@ <% required ||= false %>
- <% if required %> - * - <% end %> - <%= f.label _('Themes'), for: :theme_ids, class: 'control-label' %> - <%= render partial: 'shared/popover', - locals: { message: popover_message, placement: 'right' }%> -
- <% if all_themes.length > 0 %> <% cntr = 0 nbr_of_cols = (all_themes.length.to_f / MAX_NUMBER_THEMES_PER_COLUMN.to_f).ceil col_size = (12 / (nbr_of_cols > 4 ? 3 : nbr_of_cols)).round %> -
- <% all_themes.each do |theme| %> - <% if cntr >= MAX_NUMBER_THEMES_PER_COLUMN %> +
+ + <%= _('Themes') %> + <%= render partial: 'shared/popover', + locals: { message: popover_message, placement: 'right' }%> + + +
+ <% all_themes.each do |theme| %> + <% if cntr >= MAX_NUMBER_THEMES_PER_COLUMN %> +
+
+ <% cntr = 0 %> + <% end %> +
+ <% namespace = f.object.class.name.downcase %> + <% id = f.object.id.present? ? f.object.id : 'new' %> + + value="<%= theme.id %>"<%= f.object.themes.include?(theme) ? ' checked="checked"' : '' %>> + <%= theme.title %>
-
- <% cntr = 0 %> + <% cntr += 1 %> <% end %> -
- <% namespace = f.object.class.name.downcase %> - <% id = f.object.id.present? ? f.object.id : 'new' %> - - value="<%= theme.id %>"<%= f.object.themes.include?(theme) ? ' checked="checked"' : '' %>> - <%= theme.title %> -
- <% cntr += 1 %> - <% end %> -
+
+
<% else %>

<%= _('No themes have been defined. Please contact your administrator for assistance.') %>

<% end %> diff --git a/app/views/orgs/_feedback_form.html.erb b/app/views/orgs/_feedback_form.html.erb index 30df386..c16752e 100644 --- a/app/views/orgs/_feedback_form.html.erb +++ b/app/views/orgs/_feedback_form.html.erb @@ -8,19 +8,14 @@
-

<%= _('Request Expert Feedback - Automated Email:') %>

+

+ <%= _('Request Expert Feedback - Message Displayed on Share Plan Tab:') %> +

-
- <%= f.label :feedback_email_subject, _('Subject'), class: "control-label" %> - - <%= f.text_field :feedback_email_subject, class: "form-control", placeholder: feedback_confirmation_default_subject.gsub('%{application_name}', Rails.configuration.branding[:application][:name]) %> -
-
-
- <% tip = feedback_confirmation_default_message.gsub('%{organisation_email}', org.contact_email.present? ? org.contact_email : '%{organisation_email}') %> -
+
<%= f.label :feedback_email_msg, _('Message'), class: "control-label" %> - <%= f.text_area :feedback_email_msg, class: "form-control" %> + <%= f.text_area :feedback_email_msg, class: "form-control", + "aria-required" => true %>
diff --git a/app/views/orgs/_profile_form.html.erb b/app/views/orgs/_profile_form.html.erb index 34fa494..78db740 100644 --- a/app/views/orgs/_profile_form.html.erb +++ b/app/views/orgs/_profile_form.html.erb @@ -90,19 +90,19 @@
<% end %>
-
- <%= f.label _('Organisation Types'), for: :funder, class: 'control-label' %> -
- <%= f.label :funder, raw("#{check_box_tag :funder, 2, org.funder?, class: 'org_types'} #{_('Funder')}") %> -
-
- <%= f.label :institution, raw("#{check_box_tag :institution, 1, org.institution?, class: 'org_types'} #{_('Institution')}") %> -
-
- <%= f.label :organisation, raw("#{check_box_tag :organisation, 4, org.organisation?, class: 'org_types'} #{_('Organisation')}") %> -
- <%= f.hidden_field :org_type, 'data-validation': 'text', 'data-validation-error': _('You must select at least one organisation type') %> -
+
+ <%= _('Organisation Types') %> +
+ <%= f.label :funder, raw("#{check_box_tag :funder, 2, org.funder?, class: 'org_types'} #{_('Funder')}") %> +
+
+ <%= f.label :institution, raw("#{check_box_tag :institution, 1, org.institution?, class: 'org_types'} #{_('Institution')}") %> +
+
+ <%= f.label :organisation, raw("#{check_box_tag :organisation, 4, org.organisation?, class: 'org_types'} #{_('Organisation')}") %> +
+ <%= f.hidden_field :org_type, 'data-validation': 'text', 'data-validation-error': _('You must select at least one organisation type') %> +
<% else %>
diff --git a/app/views/paginable/guidance_groups/_index.html.erb b/app/views/paginable/guidance_groups/_index.html.erb index 9f8e918..1691a04 100644 --- a/app/views/paginable/guidance_groups/_index.html.erb +++ b/app/views/paginable/guidance_groups/_index.html.erb @@ -2,11 +2,11 @@
<%= _('Plan') %><%= _('Requestor') %><%= _('Type') %><%= _('Actions') %><%= _('Plan') %><%= _('Requestor') %><%= _('Type') %><%= _('Actions') %>
- - - - - + + + + + diff --git a/app/views/paginable/guidances/_index.html.erb b/app/views/paginable/guidances/_index.html.erb index 98761b9..7e418b9 100644 --- a/app/views/paginable/guidances/_index.html.erb +++ b/app/views/paginable/guidances/_index.html.erb @@ -2,12 +2,12 @@
<%= _('Name') %><%= _('Status') %> <%= paginable_sort_link('published') %><%= _('Optional subset') %> <%= paginable_sort_link('optional_subset') %><%= _('Last updated') %> <%= paginable_sort_link('updated_at') %><%= _('Actions') %><%= _('Name') %><%= _('Status') %> <%= paginable_sort_link('published') %><%= _('Optional subset') %> <%= paginable_sort_link('optional_subset') %><%= _('Last updated') %> <%= paginable_sort_link('updated_at') %><%= _('Actions') %>
- - - - - - + + + + + + diff --git a/app/views/paginable/notifications/_index.html.erb b/app/views/paginable/notifications/_index.html.erb index 324e720..9a7d707 100644 --- a/app/views/paginable/notifications/_index.html.erb +++ b/app/views/paginable/notifications/_index.html.erb @@ -1,10 +1,10 @@
<%= _('Text') %> <%= paginable_sort_link('guidances.text') %><%= _('Themes') %><%= _('Guidance group') %> <%= paginable_sort_link('guidance_groups.name') %><%= _('Status') %> <%= paginable_sort_link('guidances.published') %><%= _('Last updated') %> <%= paginable_sort_link('guidances.updated_at') %><%= _('Actions') %><%= _('Text') %> <%= paginable_sort_link('guidances.text') %><%= _('Themes') %><%= _('Guidance group') %> <%= paginable_sort_link('guidance_groups.name') %><%= _('Status') %> <%= paginable_sort_link('guidances.published') %><%= _('Last updated') %> <%= paginable_sort_link('guidances.updated_at') %><%= _('Actions') %>
- - - - + + + + diff --git a/app/views/paginable/orgs/_index.html.erb b/app/views/paginable/orgs/_index.html.erb index fbe022a..15d3d5c 100644 --- a/app/views/paginable/orgs/_index.html.erb +++ b/app/views/paginable/orgs/_index.html.erb @@ -2,12 +2,12 @@
<%= _('Title') %> <%= paginable_sort_link('title') %><%= _('Level') %> <%= paginable_sort_link('level') %><%= _('Start') %> <%= paginable_sort_link('starts_at') %><%= _('Expiration') %> <%= paginable_sort_link('expires_at') %><%= _('Title') %> <%= paginable_sort_link('title') %><%= _('Level') %> <%= paginable_sort_link('level') %><%= _('Start') %> <%= paginable_sort_link('starts_at') %><%= _('Expiration') %> <%= paginable_sort_link('expires_at') %>
- - - - - - + + + + + + diff --git a/app/views/paginable/plans/_org_admin.html.erb b/app/views/paginable/plans/_org_admin.html.erb index fefee45..0d1192c 100644 --- a/app/views/paginable/plans/_org_admin.html.erb +++ b/app/views/paginable/plans/_org_admin.html.erb @@ -2,12 +2,12 @@
<%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Administrator Email') %> <%= paginable_sort_link('orgs.contact_email') %><%= _('Organisation Type(s)') %> <%= paginable_sort_link('orgs.org_type') %><%= _('Templates') %><%= _('Users') %><%= _('Actions') %><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Administrator Email') %> <%= paginable_sort_link('orgs.contact_email') %><%= _('Organisation Type(s)') %> <%= paginable_sort_link('orgs.org_type') %><%= _('Templates') %><%= _('Users') %><%= _('Actions') %>
- - - - - - + + + + + + diff --git a/app/views/paginable/plans/_organisationally_or_publicly_visible.html.erb b/app/views/paginable/plans/_organisationally_or_publicly_visible.html.erb index b8fb98f..e5b3d7c 100644 --- a/app/views/paginable/plans/_organisationally_or_publicly_visible.html.erb +++ b/app/views/paginable/plans/_organisationally_or_publicly_visible.html.erb @@ -5,11 +5,11 @@
<%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %><%= _('Owner') %><%= _('Updated') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Visibility') %><%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %><%= _('Owner') %><%= _('Updated') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Visibility') %>
- - - - - + + + + + diff --git a/app/views/paginable/plans/_privately_visible.html.erb b/app/views/paginable/plans/_privately_visible.html.erb index 945e21f..bfff598 100644 --- a/app/views/paginable/plans/_privately_visible.html.erb +++ b/app/views/paginable/plans/_privately_visible.html.erb @@ -2,15 +2,15 @@
<%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Owner') %><%= _('Updated') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Download') %><%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Owner') %><%= _('Updated') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Download') %>
- - - - - - - - - + + + + + + + + diff --git a/app/views/paginable/plans/_publicly_visible.html.erb b/app/views/paginable/plans/_publicly_visible.html.erb index 1f817de..475f2a2 100644 --- a/app/views/paginable/plans/_publicly_visible.html.erb +++ b/app/views/paginable/plans/_publicly_visible.html.erb @@ -2,11 +2,11 @@
<%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Edited') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Role') %><%= _('Owner') %><%= _('Test') %><%= _('Visibility') %><%= _('Shared') %> + <%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Edited') %> <%= paginable_sort_link('plans.updated_at') %><%= _('Role') %><%= _('Owner') %><%= _('Test') %><%= _('Visibility') %><%= _('Shared') %> <%= _('Actions') %>
- - - - - + + + + + diff --git a/app/views/paginable/templates/_customisable.html.erb b/app/views/paginable/templates/_customisable.html.erb index 20cb3b1..98a029a 100644 --- a/app/views/paginable/templates/_customisable.html.erb +++ b/app/views/paginable/templates/_customisable.html.erb @@ -3,10 +3,10 @@
<%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %><%= _('Owner') %><%= _('Download') %><%= _('Project Title') %> <%= paginable_sort_link('plans.title') %><%= _('Template') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %><%= _('Owner') %><%= _('Download') %>
- - - - + + + + diff --git a/app/views/paginable/templates/_history.html.erb b/app/views/paginable/templates/_history.html.erb index 3a081ce..8375b8f 100644 --- a/app/views/paginable/templates/_history.html.erb +++ b/app/views/paginable/templates/_history.html.erb @@ -2,11 +2,11 @@
<%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Funder') %> <%= paginable_sort_link('orgs.name') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Funder') %> <%= paginable_sort_link('orgs.name') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %>  
- - - - - + + + + + diff --git a/app/views/paginable/templates/_index.html.erb b/app/views/paginable/templates/_index.html.erb index 12a98f2..cc43ab9 100644 --- a/app/views/paginable/templates/_index.html.erb +++ b/app/views/paginable/templates/_index.html.erb @@ -3,10 +3,10 @@
<%= _('Title') %> <%= paginable_sort_link('templates.title') %><%= _('Version') %> <%= paginable_sort_link('templates.version') %><%= _('Published') %> <%= paginable_sort_link('templates.published') %><%= _('Last updated') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Actions') %><%= _('Title') %> <%= paginable_sort_link('templates.title') %><%= _('Version') %> <%= paginable_sort_link('templates.version') %><%= _('Published') %> <%= paginable_sort_link('templates.published') %><%= _('Last updated') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Actions') %>
- - - - + + + + diff --git a/app/views/paginable/templates/_organisational.html.erb b/app/views/paginable/templates/_organisational.html.erb index 997a620..b801e25 100644 --- a/app/views/paginable/templates/_organisational.html.erb +++ b/app/views/paginable/templates/_organisational.html.erb @@ -3,14 +3,14 @@
<%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %>
- + <% if action == 'organisational' %> - + <% else %> - + <% end %> - - + + <% if action != 'index' %> <% end %> diff --git a/app/views/paginable/templates/_publicly_visible.html.erb b/app/views/paginable/templates/_publicly_visible.html.erb index f75a497..4b40a67 100644 --- a/app/views/paginable/templates/_publicly_visible.html.erb +++ b/app/views/paginable/templates/_publicly_visible.html.erb @@ -2,13 +2,13 @@
<%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Description') %> <%= paginable_sort_link('templates.description') %><%= _('Description') %> <%= paginable_sort_link('templates.description') %><%= (action == 'customizable' ? _('Funder') : _('Organisation')) %> <%= paginable_sort_link('orgs.name') %><%= (action == 'customizable' ? _('Funder') : _('Organisation')) %> <%= paginable_sort_link('orgs.name') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Status') %><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %> 
- - - - - - - + + + + + + + diff --git a/app/views/paginable/themes/_index.html.erb b/app/views/paginable/themes/_index.html.erb index 54c4610..cb26ecb 100644 --- a/app/views/paginable/themes/_index.html.erb +++ b/app/views/paginable/themes/_index.html.erb @@ -1,8 +1,8 @@
<%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation Name') %> <%= paginable_sort_link('orgs.name') %><%= d_('dmpopidor', 'Organisation Type') %> <%= paginable_sort_link('orgs.org_type') %><%= d_('dmpopidor', 'Description') %><%= _('Last Updated') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Download') %><%= _('Actions') %><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %><%= _('Organisation Name') %> <%= paginable_sort_link('orgs.name') %><%= d_('dmpopidor', 'Organisation Type') %> <%= paginable_sort_link('orgs.org_type') %><%= d_('dmpopidor', 'Description') %><%= _('Last Updated') %> <%= paginable_sort_link('templates.updated_at') %><%= _('Download') %><%= _('Actions') %>
- - + + diff --git a/app/views/paginable/users/_index.html.erb b/app/views/paginable/users/_index.html.erb index 05f7c10..7f4e56a 100644 --- a/app/views/paginable/users/_index.html.erb +++ b/app/views/paginable/users/_index.html.erb @@ -5,15 +5,15 @@
<%= _('Name') %> <%= paginable_sort_link('title') %><%= _('Guidance') %> <%= paginable_sort_link('description') %><%= _('Name') %> <%= paginable_sort_link('title') %><%= _('Guidance') %> <%= paginable_sort_link('description') %>
- - - - - - - - - + + + + + + + + + diff --git a/app/views/plans/_download_form.html.erb b/app/views/plans/_download_form.html.erb index 3dd0a91..296e2e0 100644 --- a/app/views/plans/_download_form.html.erb +++ b/app/views/plans/_download_form.html.erb @@ -9,23 +9,24 @@ <% else %> <%= hidden_field_tag(:phase_id, @phase_options[0][1]) %> <% end %> - -

<%= _("Optional plan components") %>

-
- <%= label_tag 'export[project_details]', raw("#{check_box_tag 'export[project_details]', true, false} #{_('project details coversheet')}") %> -
-
- <%= label_tag 'export[question_headings]', raw("#{check_box_tag 'export[question_headings]', true, true} #{_('question text and section headings')}") %> -
-
- <%= label_tag 'export[unanswered_questions]', raw("#{check_box_tag 'export[unanswered_questions]', true, true} #{_('unanswered questions')}") %> -
- <% if @plan.template.customization_of.present? %> +
+ <%= _("Optional plan components") %>
- <%= label_tag 'export[custom_sections]', raw("#{check_box_tag 'export[custom_sections]', true, false} #{_('supplementary section(s) not requested by funding organisation')}") %> + <%= label_tag 'export[project_details]', raw("#{check_box_tag 'export[project_details]', true, false} #{_('project details coversheet')}") %>
- <% end %> - +
+ <%= label_tag 'export[question_headings]', raw("#{check_box_tag 'export[question_headings]', true, true} #{_('question text and section headings')}") %> +
+
+ <%= label_tag 'export[unanswered_questions]', raw("#{check_box_tag 'export[unanswered_questions]', true, true} #{_('unanswered questions')}") %> +
+ <% if @plan.template.customization_of.present? %> +
+ <%= label_tag 'export[custom_sections]', raw("#{check_box_tag 'export[custom_sections]', true, false} #{_('supplementary section(s) not requested by funding organisation')}") %> +
+ <% end %> +
+

<%= _('Format') %>

diff --git a/app/views/plans/_edit_details.html.erb b/app/views/plans/_edit_details.html.erb index fe5dec3..98c30dd 100644 --- a/app/views/plans/_edit_details.html.erb +++ b/app/views/plans/_edit_details.html.erb @@ -148,15 +148,16 @@

<%= _('Plan Guidance Configuration') %>

<%= _('To help you write your plan, %{application_name} can show you guidance from a variety of organisations.') % - {application_name: Rails.configuration.branding[:application][:name]} %> -

-

<%= _('Select up to 6 organisations to see their guidance.') %>

-
    - <%= render partial: "guidance_choices", - locals: {choices: @important_ggs, form: f, - current_selections: @selected_guidance_groups} %> -
- + {application_name: Rails.configuration.branding[:application][:name]} %> +

+
+

<%= _('Select up to 6 organisations to see their guidance.') %>

+
    + <%= render partial: "guidance_choices", + locals: {choices: @important_ggs, form: f, + current_selections: @selected_guidance_groups} %> +
+

<%= _('Find guidance from additional organisations below') %>

<%= link_to _('See the full list'), '#', 'data-toggle' => 'modal', 'data-target' => '#modal-full-guidances', class: 'modal-guidances-window' %> diff --git a/app/views/plans/_share_form.html.erb b/app/views/plans/_share_form.html.erb index 7b0e448..59cbfa0 100644 --- a/app/views/plans/_share_form.html.erb +++ b/app/views/plans/_share_form.html.erb @@ -32,10 +32,10 @@
<%= _('Name') %> <%= paginable_sort_link('firstname') %><%= _('Email') %> <%= paginable_sort_link('email') %><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Created date') %> <%= paginable_sort_link('created_at') %><%= _('Last activity') %> <%= paginable_sort_link('last_sign_in_at') %><%= _('Plans') %><%= _('Current Privileges') %><%= _('Active') %><%= _('Privileges') %><%= _('Name') %> <%= paginable_sort_link('firstname') %><%= _('Email') %> <%= paginable_sort_link('email') %><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %><%= _('Created date') %> <%= paginable_sort_link('created_at') %><%= _('Last activity') %> <%= paginable_sort_link('last_sign_in_at') %><%= _('Plans') %><%= _('Current Privileges') %><%= _('Active') %><%= _('Privileges') %>
- - + + <% if administerable %> - + <% end %> @@ -45,7 +45,7 @@
<%= _('Email address')%><%= _('Permissions')%><%= _('Email address')%><%= _('Permissions')%><%= _('Actions') %><%= _('Actions') %>
<%= role.user.name %> <% if role.creator? %> - <%= _('Owner') %> + <%= _('Owner') %> <% else %> <% if administerable && role.user != current_user %> <%= form_for role, url: { controller: :roles, action: :update, id: role.id }, remote: true, html: { method: :put } do |f| %> @@ -83,30 +83,36 @@ <% end %> -
- -
- <%= f.label :access_level, raw("#{f.radio_button :access_level, 3, "aria-required": true} #{_('Co-owner: can edit project details, change visibility, and add collaborators')}") %> -
-
- <%= f.label :access_level, raw("#{f.radio_button :access_level, 2} #{_('Editor: can comment and make changes')}") %> -
-
- <%= f.label :access_level, raw("#{f.radio_button :access_level, 1} #{_('Read only: can view and comment, but not make changes')}") %> -
+
+ <%= _('Permissions') %> +
+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 3, "aria-required": true} #{_('Co-owner: can edit project details, change visibility, and add collaborators')}") %> +
+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 2} #{_('Editor: can comment and make changes')}") %> +
+
+ <%= f.label :access_level, raw("#{f.radio_button :access_level, 1} #{_('Read only: can view and comment, but not make changes')}") %> +
- <%= f.button(_('Submit'), class: "btn btn-primary", type: "submit") %> -
-
-<% end %> + <%= f.button(_('Submit'), class: "btn btn-primary", type: "submit") %> +
+
+ <% end %> + -<% if plan.owner_and_coowners.include?(current_user) && current_user.org.present? && current_user.org.feedback_enabled? %> -

<%= _('Request expert feedback') %>

-

<%= _('Click below to give data management staff at your organisation access to read and comment on your plan.') %>

-

<%= _('You can continue to edit and download the plan in the interim.') %>

+
+ <% if plan.owner_and_coowners.include?(current_user) && current_user.org.present? && current_user.org.feedback_enabled? %> +

<%= _('Request expert feedback') %>

+

<%= _('Click below to give data management staff at your organisation access to read and comment on your plan.') %>

+
+ <%= current_user.org.feedback_email_msg.to_s.html_safe %> +
+

<%= _('You can continue to edit and download the plan in the interim.') %>

<%= link_to _('Request feedback'), request_feedback_plan_path, class: "btn btn-default#{' disabled' if @plan.feedback_requested?}" %> <%= _("Feedback has been requested.") if @plan.feedback_requested? %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/shared/_copy_link_modal.html.erb b/app/views/shared/_copy_link_modal.html.erb index c9c8d07..54ad3a9 100644 --- a/app/views/shared/_copy_link_modal.html.erb +++ b/app/views/shared/_copy_link_modal.html.erb @@ -3,14 +3,14 @@
diff --git a/app/views/shared/_create_account_form.html.erb b/app/views/shared/_create_account_form.html.erb index 6880aa8..6bdf261 100644 --- a/app/views/shared/_create_account_form.html.erb +++ b/app/views/shared/_create_account_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for resource, as: 'user', namespace: 'new_user', url: registration_path("user"), html: {autocomplete: "off", id: "create_account_form"} do |f| %> +<%= form_for resource, namespace: 'new', url: registration_path("user"), html: {autocomplete: "off", id: "create_account_form"} do |f| %>
<%= f.label(:firstname, _('First Name'), class: "control-label") %> @@ -13,9 +13,9 @@ <%= f.email_field(:email, class: "form-control", "aria-required": true) %>
- <%= render partial: "shared/my_org", - locals: {f: f, default_org: @default_org, - orgs: Org.where("parent_id IS NULL").order("sort_name ASC, name ASC"), + <%= render partial: "shared/my_org", + locals: {f: f, default_org: @default_org, + orgs: Org.where("parent_id IS NULL").order("sort_name ASC, name ASC"), allow_other_orgs: true, required: true} %>
@@ -23,15 +23,18 @@ <%= f.label(:password, _('Password'), class: "control-label") %> <%= f.password_field(:password, class: "form-control", "aria-required": true) %> -
- +
+
+ +
-
- <%= f.label(:accept_terms, - raw("#{ f.check_box(:accept_terms, "aria-required": true, "data-validation-error": _('You must agree to the term and conditions.')) } #{_('I accept the')} #{_('terms and conditions')}")) %> +
+
+ <%= f.label(:accept_terms, + raw("#{ f.check_box(:accept_terms, "aria-required": true, "data-validation-error": _('You must agree to the term and conditions.')) } #{_('I accept the')} #{_('terms and conditions')}")) %> +
- <%= f.button(_('Create account'), class: "btn btn-default", type: "submit") %> <% end %> diff --git a/app/views/user_mailer/_email_signature.html.erb b/app/views/user_mailer/_email_signature.html.erb index b5dd4f4..2679dbe 100644 --- a/app/views/user_mailer/_email_signature.html.erb +++ b/app/views/user_mailer/_email_signature.html.erb @@ -1,7 +1,8 @@ -<% +<% tool_name = Rails.configuration.branding[:application][:name] helpdesk_email = Rails.configuration.branding[:organisation][:helpdesk_email] email_subject = email_subject || _('Query or feedback related to %{tool_name}') %{ :tool_name => tool_name } + allow_change_prefs = allow_change_prefs.nil? ? true : allow_change_prefs # Override the default Rails route helper for the contact_us page IF an alternate contact_us url was defined # in the branding config file @@ -13,5 +14,5 @@ <%= _('The %{tool_name} team') %{:tool_name => tool_name} %>

- <%= _('You may change your notification preferences on your profile page.') %> <%= _('Please do not reply to this email.') %> <%= raw(_('If you have any questions or need help, please contact us at %{helpdesk_email} or visit %{contact_us}') %{ :helpdesk_email => mail_to(helpdesk_email, helpdesk_email, subject: email_subject), :contact_us => link_to(contact_us, contact_us) }) %> -

\ No newline at end of file + <% if allow_change_prefs %><%= _('You may change your notification preferences on your profile page. ') %><% end %><%= _('Please do not reply to this email.') %> <%= raw(_('If you have any questions or need help, please contact us at %{helpdesk_email} or visit %{contact_us}') %{ :helpdesk_email => mail_to(helpdesk_email, helpdesk_email, subject: email_subject), :contact_us => link_to(contact_us, contact_us) }) %> +

diff --git a/app/views/user_mailer/feedback_complete.html.erb b/app/views/user_mailer/feedback_complete.html.erb index 2d7a663..4fb6e6b 100644 --- a/app/views/user_mailer/feedback_complete.html.erb +++ b/app/views/user_mailer/feedback_complete.html.erb @@ -1,11 +1,18 @@ -<% +<% requestor = @requestor.name(false) - recipient_name = @user.name(false) + recipient_name = @user.name(false) plan_name = @plan.title tool_name = Rails.configuration.branding[:application][:name] %>

<%= _('Hello %{recipient_name}') % { recipient_name: recipient_name } %>

-

<%= _('%{commenter} has finished providing feedback on the plan "%{plan_title}". To view the comments, please visit the My Dashboard page in %{tool_name} and open your plan.') % { commenter: requestor, plan_title: plan_name, tool_name: tool_name } %>

-<%= render partial: 'email_signature' %> \ No newline at end of file +

+ <%= _("%{commenter} has finished providing feedback on the plan \"%{link_html}\". Comments can be found in the 'Write plan' tab on the right side of the page (Guidance/Comments).").html_safe % { + commenter: requestor, + link_html: link_to(plan_name, edit_plan_url(@plan, phase_id: @phase.id)), + tool_name: tool_name + }%> +

+ +<%= render partial: 'email_signature' %> diff --git a/app/views/user_mailer/feedback_notification.html.erb b/app/views/user_mailer/feedback_notification.html.erb index afe8420..010d281 100644 --- a/app/views/user_mailer/feedback_notification.html.erb +++ b/app/views/user_mailer/feedback_notification.html.erb @@ -1,12 +1,27 @@ <% FastGettext.with_locale FastGettext.default_locale do %> - <% - recipient_name = @recipient.name(false) + <% + recipient_name = @recipient.name(false) requestor_name = @user.name(false) plan_name = @plan.title tool_name = Rails.configuration.branding[:application][:name] %>

<%= _('Hello %{user_name},') % {user_name: recipient_name} %>

-

<%= _('%{requestor} has requested feedback on a plan "%{plan_name}." To add comments, please visit the \'Plans\' page under the Admin menu in %{application_name} and open the plan.') % {requestor: requestor_name, plan_name: plan_name, application_name: tool_name} %>

- <%= render partial: 'email_signature' %> -<% end %> \ No newline at end of file + +

+ <%= raw _(%Q{%{requestor} has requested feedback on a plan %{link_html}. To add comments, please visit the 'Plans' page under the Admin menu in %{application_name} and open the plan.}) % { + requestor: requestor_name, + plan_name: plan_name, + application_name: tool_name, + allow_change_prefs: false, + link_html: link_to(plan_name, plan_url(@plan)) + } %> +

+ +

+ Alternatively, you can click the link below:
+ <%= link_to plan_url(@plan), plan_url(@plan) %> +

+ + <%= render partial: 'email_signature', locals: { allow_change_prefs: false } %> +<% end %> diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index fbec00f..841ec63 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -1,6 +1,6 @@ <% tool_name = Rails.configuration.branding[:application][:name] - sender_name = @current_user.name(false) + sender_name = @inviter.name(false) user_email = @user.name(false) link = url_for(action: 'show', controller: 'plans', id: @role.plan.id) %> @@ -9,13 +9,13 @@ <%= _('Hello %{user_email}') %{ :user_email => user_email } %>

- <%= d_('dmpopidor', '%{sender_name} has invited you to contribute to their Data Management Plan in %{tool_name}') %{ + <%= d_('dmpopidor', '%{sender_name} has invited you to contribute to their Data Management Plan in %{tool_name}') % { :sender_name => sender_name, :tool_name => tool_name - }%> + } %>

- <%= raw(_('%{click_here} to accept the invitation, (or copy %{link} into your browser). If you don\'t want to accept the invitation, please ignore this email.') %{ :click_here => link_to(_('Click here'), link), :link => link }) %> + <%= raw(_('%{click_here} to accept the invitation, (or copy %{link} into your browser). If you don\'t want to accept the invitation, please ignore this email.') % { click_here: link_to(_('Click here'), link), link: link }) %>

<%= render partial: 'email_signature' %> <% end %> diff --git a/app/views/users/_notification_preferences.html.erb b/app/views/users/_notification_preferences.html.erb index c0cea5f..148b486 100644 --- a/app/views/users/_notification_preferences.html.erb +++ b/app/views/users/_notification_preferences.html.erb @@ -9,28 +9,28 @@

All Users

-
-
-
<% if @user.org.present? && @user.org.feedback_enabled %>
-
-
@@ -39,7 +39,7 @@

DMP owners and co-owners

-
diff --git a/app/views/users/admin_grant_permissions.html.erb b/app/views/users/admin_grant_permissions.html.erb index f0db049..4114fa9 100644 --- a/app/views/users/admin_grant_permissions.html.erb +++ b/app/views/users/admin_grant_permissions.html.erb @@ -14,27 +14,27 @@ - + <% @perms.each do |perm| %> <% case perm.name when 'grant_permissions' %> - <% when 'modify_templates' %> - <% when 'modify_guidance' %> - <% when 'use_api' %> - <% when 'change_org_details' %> - <% end %> diff --git a/bin/bundle b/bin/bundle index 9c6dfa0..66e9889 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index f236603..0138d79 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,9 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 8704afd..d87d5f5 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,9 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup index 37305c7..acdb2c1 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,29 @@ -#!/usr/bin/env ruby -require 'pathname' - -# path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) - -Dir.chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file: - - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" - - # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" - # end - - puts "\n== Preparing database ==" - system "bin/rake db:setup" - - puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" - - puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" -end +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/config/locale/dmpopidor.pot b/config/locale/dmpopidor.pot index b763241..8219bfa 100644 --- a/config/locale/dmpopidor.pot +++ b/config/locale/dmpopidor.pot @@ -163,4 +163,7 @@ msgstr "" msgid "You" +msgstr "" + +msgid "Copy link" msgstr "" \ No newline at end of file diff --git a/config/locale/en_GB/dmpopidor.po b/config/locale/en_GB/dmpopidor.po index 84c155d..0713d3f 100644 --- a/config/locale/en_GB/dmpopidor.po +++ b/config/locale/en_GB/dmpopidor.po @@ -161,4 +161,7 @@ msgstr "Learn more" msgid "You" -msgstr "You" \ No newline at end of file +msgstr "You" + +msgid "Copy link" +msgstr "Copy link" \ No newline at end of file diff --git a/config/locale/fr_FR/dmpopidor.po b/config/locale/fr_FR/dmpopidor.po index bd112ba..fae9f2e 100644 --- a/config/locale/fr_FR/dmpopidor.po +++ b/config/locale/fr_FR/dmpopidor.po @@ -161,3 +161,6 @@ msgid "You" msgstr "Vous" + +msgid "Copy link" +msgstr "Copier le lien" diff --git a/lib/assets/javascripts/utils/ariatiseForm.js b/lib/assets/javascripts/utils/ariatiseForm.js index fb5680c..b1f4b5a 100644 --- a/lib/assets/javascripts/utils/ariatiseForm.js +++ b/lib/assets/javascripts/utils/ariatiseForm.js @@ -50,7 +50,11 @@ // Otherwise if the element is required validate based on its type } else if ($(el).attr('aria-required') === 'true') { if ($(el).is('input')) { - return $(el).attr('type'); // available types at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form__types + const type = $(el).attr('type'); // available types at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form__types + if (type === 'checkbox' && $(el).closest('fieldset').length > 0) { + return 'multi-checkbox'; + } + return type; } else if ($(el).is('select')) { return 'select'; } else if ($(el).is('.tinymce')) { @@ -75,18 +79,17 @@ }; const addAsterisk = (el) => { const asterisk = '* '; + const type = getValidationTypeForElement(el); if (isObject(el)) { - switch (getValidationTypeForElement(el)) { - case 'checkbox': { - el.after(asterisk); - break; - } - default: { - const label = el.closest('.form-group').find('label'); - if (isObject(label)) { - $(label[0]).before(asterisk); - } - break; + if (el.closest('fieldset').length > 0 && el.closest('fieldset').find('legend').length > 0) { + const legend = el.closest('fieldset').find('legend'); + legend.html(`${asterisk} ${legend.html()}`); + } else if (type === 'checkbox' || type === 'radio') { + el.after(asterisk); + } else { + const label = el.closest('.form-group').find('label'); + if (isObject(label)) { + $(label[0]).before(asterisk); } } } @@ -105,24 +108,28 @@ case 'tinymce': return Tinymce.findEditorById($(el).attr('id')).getContent(); case 'checkbox': + case 'multi-checkbox': return ($(el).is(':checked') ? 'checked' : ''); default: return $(el).val(); } }; -const isValid = (type, value) => { +const isValid = (el) => { // TODO add more validation for each new type coming along by: // 1. defining a function at dmproadmap.utils.validate // 2. adding the case in the switch below + const type = getValidationTypeForElement(el); + const value = getValue(type, el); // See if a specific data-validation was specified switch (type) { case 'text': - return validator.isValidText(value); case 'textarea': - return validator.isValidText(value); case 'tinymce': + case 'select': + case 'radio': + case 'js-combobox': return validator.isValidText(value); case 'number': return validator.isValidNumber(value); @@ -130,13 +137,10 @@ return validator.isValidEmail(value); case 'password': return validator.isValidPassword(value); - case 'radio': - return validator.isValidText(value); - case 'select': case 'checkbox': - return validator.isValidText(value); - case 'js-combobox': - return validator.isValidText(value); + return validator.isValidCheckbox(el); + case 'multi-checkbox': + return validator.isValidMultiCheckbox(el); default: return false; } @@ -145,7 +149,6 @@ const getDefaultValidationMessage = (type) => { switch (type) { case 'text': - return getConstant('VALIDATION_MESSAGE_TEXT'); case 'textarea': return getConstant('VALIDATION_MESSAGE_TEXT'); case 'number': @@ -158,6 +161,8 @@ return getConstant('VALIDATION_MESSAGE_RADIO'); case 'checkbox': return getConstant('VALIDATION_MESSAGE_CHECKBOX'); + case 'multi-checkbox': + return getConstant('VALIDATION_MESSAGE_MULTI_CHECKBOX'); case 'js-combobox': return getConstant('VALIDATION_MESSAGE_SELECT'); default: @@ -197,11 +202,15 @@ const target = $(el); const id = target.attr('id'); const typ = getValidationTypeForElement(target); + const help = blockHelp(`help-${id}`, getValidationMessage(el)); + target.attr('validation-help-block', `help-${id}`); - if (typ === 'radio' || typ === 'checkbox') { - target.closest('.form-group').before(blockHelp(`help-${id}`, getValidationMessage(el))); + if (target.closest('fieldset').length > 0 && target.closest('fieldset').find('legend').length > 0) { + target.closest('fieldset').find('legend').after(help); + } else if (typ === 'radio' || typ === 'checkbox') { + target.closest('.form-group').after(help); } else { - target.after(blockHelp(`help-${id}`, getValidationMessage(el))); + target.after(help); } if (target.attr('aria-required') === 'true' && !options.excludeAsterisks) { addAsterisk(target); @@ -213,12 +222,10 @@ let anyInvalid = false; let firstInvalid; validatable.each((i, el) => { - const type = getValidationTypeForElement(el); const required = ($(el).attr('aria-required') && $(el).attr('aria-required') === 'true'); - // If the field is required OR its not empty if (required || $(el).val().trim() !== '') { - if (isValid(type, getValue(type, el))) { + if (isValid($(el))) { valid(el); } else { anyInvalid = true; diff --git a/lib/assets/javascripts/utils/isValidInputType.js b/lib/assets/javascripts/utils/isValidInputType.js index 0a54d99..d116019 100644 --- a/lib/assets/javascripts/utils/isValidInputType.js +++ b/lib/assets/javascripts/utils/isValidInputType.js @@ -1,4 +1,4 @@ -import { isString, isNumber } from './isType'; +import { isObject, isString, isNumber } from './isType'; import getConstant from '../constants'; /* Validates whether or not the value passed matches to a valid email @@ -63,3 +63,17 @@ } return false; }; + +export const isValidCheckbox = (el) => { + if (isObject(el)) { + return el.is(':checked'); + } + return false; +}; + +export const isValidMultiCheckbox = (el) => { + if (isObject(el) && isObject(el.closest('fieldset'))) { + return el.closest('fieldset').find('input:checked').length > 0; + } + return false; +}; diff --git a/lib/assets/javascripts/utils/validation.js b/lib/assets/javascripts/utils/validation.js index 3d80ed8..18f7fdb 100644 --- a/lib/assets/javascripts/utils/validation.js +++ b/lib/assets/javascripts/utils/validation.js @@ -46,6 +46,11 @@ el.after(asterisk); break; } + case 'radio': { + const legend = el.closest('fieldset').find('legend'); + legend.html(`${asterisk}${legend.text()}`); + break; + } default: { const label = el.closest('.form-group').find('label'); if (isObject(label)) { diff --git a/lib/assets/javascripts/views/devise/registrations/edit.js b/lib/assets/javascripts/views/devise/registrations/edit.js index d80528e..577fe8f 100644 --- a/lib/assets/javascripts/views/devise/registrations/edit.js +++ b/lib/assets/javascripts/views/devise/registrations/edit.js @@ -15,7 +15,7 @@ const sensitiveInfoCheck = (event) => { const originalEmail = $('#original_email').val(); const originalOrg = $('#original_org').val(); - const email = $('#personal_details_registration_form #user_email').val(); + const email = $('#personal_details_registration_form [name="user[email]"]').val(); const org = $('#personal_details_registration_form #user_org_id').val(); const pwd = $('#password-confirmation input[name="user[current_password]"]').val(); const orgConfirm = $('#confirm_org_change').is(':checked'); @@ -23,7 +23,6 @@ $('#email-change').addClass('hide'); $('#org-change').addClass('hide'); - // If the Email has changed show the Password confirmation if (isString(originalEmail) && isString(email)) { if (originalEmail.toLowerCase() !== email.toLowerCase() && !isValidPassword(pwd)) { @@ -63,7 +62,8 @@ // Devise seems to require both the password and current_password so sync them // when the user enters their password in the modal $('#password-confirmation input[name="user[current_password]"]').change((e) => { - $('#password-confirmation #user_password').val($(e.target).val()); + $('#password-confirmation input[name="user[password]"]') + .val($(e.target).val()); }); // Submit the form when the user clicks the confirmation button on the modal diff --git a/lib/assets/javascripts/views/guidances/new_edit.js b/lib/assets/javascripts/views/guidances/new_edit.js index e9fdbe8..75348d6 100644 --- a/lib/assets/javascripts/views/guidances/new_edit.js +++ b/lib/assets/javascripts/views/guidances/new_edit.js @@ -2,6 +2,6 @@ import { Tinymce } from '../../utils/tinymce'; $(() => { - ariatiseForm({ selector: '#new_edit_guidance' }); Tinymce.init({ selector: '#guidance-text' }); + ariatiseForm({ selector: '#new_edit_guidance' }); }); diff --git a/lib/assets/javascripts/views/org_admin/phases/new_edit.js b/lib/assets/javascripts/views/org_admin/phases/new_edit.js index 47d12e9..e04c4cd 100644 --- a/lib/assets/javascripts/views/org_admin/phases/new_edit.js +++ b/lib/assets/javascripts/views/org_admin/phases/new_edit.js @@ -22,10 +22,7 @@ // For some reason the toolbar options are retained after the call to Tinymce.init() on // the views/notifications/edit.js file. Tried 'Object.assign' instead of '$.extend' but it // made no difference - Tinymce.init({ - selector: `#${context} .question`, - forced_root_block: '', - toolbar: 'bold italic | bullist numlist | link | table' }); + Tinymce.init({ selector: `#${context} .question` }); ariatiseForm({ selector: `#${context} .question_form` }); initQuestionOption(context); // Swap in the question_formats when the user selects an option based question type @@ -50,7 +47,7 @@ // For some reason the toolbar options are retained after the call to Tinymce.init() on // the views/notifications/edit.js file. Tried 'Object.assign' instead of '$.extend' but it // made no difference - Tinymce.init({ selector: `${selector} .section`, toolbar: 'bold italic | bullist numlist | link | table' }); + Tinymce.init({ selector: `${selector} .section` }); ariatiseForm({ selector: `${selector} .edit_section` }); const questionForm = $(selector).find('.question_form'); if (questionForm.length > 0) { diff --git a/lib/assets/javascripts/views/org_admin/question_options/index.js b/lib/assets/javascripts/views/org_admin/question_options/index.js index 5a69799..19ec44d 100644 --- a/lib/assets/javascripts/views/org_admin/question_options/index.js +++ b/lib/assets/javascripts/views/org_admin/question_options/index.js @@ -11,7 +11,8 @@ const source = e.target; const last = $(source).closest('[data-attribute="question_options"]').find('[data-attribute="question_option"]').last(); const cloned = last.clone(true); - const array = $(cloned).find('[id$="_number"]').prop('id').match(/_[\d]{1,2}_+/); + const array = $(cloned).find('[id$="_number"]').prop('id').match(/_[\d]*?_+/); + if (array) { const index = Number(array[0].replace(/_/g, '')); // Reset values for the new cloned inputs diff --git a/lib/assets/javascripts/views/orgs/admin_edit.js b/lib/assets/javascripts/views/orgs/admin_edit.js index d411a80..4bee578 100644 --- a/lib/assets/javascripts/views/orgs/admin_edit.js +++ b/lib/assets/javascripts/views/orgs/admin_edit.js @@ -22,6 +22,7 @@ Tinymce.init({ selector: '#org_feedback_email_msg' }); toggleFeedback(); enableValidations($('#edit_org_profile_form .form-group:not(.link-input)')); + enableValidations($('#edit_org_feedback_form .form-group')); // Only enable validations on the links section if it has values initially $('.link').each((idx, el) => { const linkVal = $(el).find('input[name="link_link"]').val(); diff --git a/lib/assets/javascripts/views/shared/create_account_form.js b/lib/assets/javascripts/views/shared/create_account_form.js index 0a84c35..a423660 100644 --- a/lib/assets/javascripts/views/shared/create_account_form.js +++ b/lib/assets/javascripts/views/shared/create_account_form.js @@ -1,23 +1,10 @@ import ariatiseForm from '../../utils/ariatiseForm'; import { togglisePasswords } from '../../utils/passwordHelper'; -import { isValidText } from '../../utils/isValidInputType'; import initMyOrgCombobox from '../shared/my_org'; $(() => { - ariatiseForm({ selector: '#create_account_form' }); - togglisePasswords({ selector: '#create_account_form' }); - - $('#create_account_form').on('submit', (e) => { - // Additional validation to force the user to choose an org or type something for other - const orgId = $('[name="user[org_id]"]'); - const otherOrg = $('[name="user[other_organisation]"]'); - if (isValidText(orgId.val()) || isValidText(otherOrg.val())) { - $('#help-org').hide(); - } else { - e.preventDefault(); - $('#help-org').show(); - } - }); - - initMyOrgCombobox({ selector: '#create-account-form' }); + const options = { selector: '#create-account-form' }; + initMyOrgCombobox(options); + ariatiseForm(options); + togglisePasswords(options); }); diff --git a/lib/assets/javascripts/views/super_admin/notifications/edit.js b/lib/assets/javascripts/views/super_admin/notifications/edit.js index f5900ad..b6987de 100644 --- a/lib/assets/javascripts/views/super_admin/notifications/edit.js +++ b/lib/assets/javascripts/views/super_admin/notifications/edit.js @@ -2,10 +2,6 @@ import { Tinymce } from '../../../utils/tinymce'; $(() => { - Tinymce.init({ - selector: '.notification-text', - forced_root_block: '', - toolbar: 'bold italic underline | link', - }); + Tinymce.init({ selector: '.notification-text', forced_root_block: '' }); ariatiseForm({ selector: 'form.notification' }); }); diff --git a/lib/assets/stylesheets/overrides.scss b/lib/assets/stylesheets/overrides.scss index 114ae84..814495f 100644 --- a/lib/assets/stylesheets/overrides.scss +++ b/lib/assets/stylesheets/overrides.scss @@ -318,12 +318,12 @@ } /* footer */ -#footer-navbar { +footer { + position: absolute; bottom: 0; margin-top: 20px; margin-bottom: -20px; width: 100%; - position: absolute; } @@ -436,7 +436,7 @@ left: 0; width: 100%; background: $white; - z-index: 99; + z-index: 1100; } .combobox-suggestion { color: $grey; @@ -548,6 +548,33 @@ } /* Fieldset styling */ + +/* generic styling */ +fieldset { + border: none; + + input[type="radio"], + input[type="checkbox"] { + margin: 0px; + vertical-align: middle; + } + + .checkbox, + .radio { + margin-top: 0px; + margin-bottom: 3px; + } +} + +legend { + border: none; + font-size: 14px; + font-weight: bold; + margin-bottom: 5px; + text-transform: capitalize; +} + +/* Specific to project details page */ fieldset.project-details { border: 0.5px groove #ddd; padding: 0 5px; @@ -556,7 +583,6 @@ -webkit-box-shadow: 0px 0px 0px 0px #000; box-shadow: 0px 0px 0px 0px #000; } - legend.project-details { font-weight: bold; font-size: 100%; @@ -606,3 +632,17 @@ color: $white; padding: 10px; } + +/* Text meant only for screen readers. */ +.screen-reader-text { + border: 0; + clip: rect(1px, 1px, 1px, 1px); + clip-path: inset(50%); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute !important; + width: 1px; + word-wrap: normal !important; +} diff --git a/lib/tasks/upgrade.rake b/lib/tasks/upgrade.rake index 9b625c2..14ecfbe 100644 --- a/lib/tasks/upgrade.rake +++ b/lib/tasks/upgrade.rake @@ -6,6 +6,7 @@ Rake::Task['upgrade:check_org_contact_emails'].execute Rake::Task['upgrade:check_for_guidance_multiple_themes'].execute Rake::Task['upgrade:remove_admin_preferences'].execute + Rake::Task['upgrade:add_other_org'].execute end desc "Upgrade to 1.0" @@ -433,4 +434,42 @@ end end end + + desc "Add the 'other' org if it is not present." + task add_other_org: :environment do + puts "Checking for existence of an 'Other' org. Unaffiliated users should be affiliated with this org" + + # Get the helpdesk email from the branding YAML + branding = YAML.load(File.open('./config/branding.yml')) + if branding.present? && branding['defaults'].present? && branding['defaults']['organisation'].present? && branding['defaults']['organisation']['helpdesk_email'].present? + email = branding['defaults']['organisation']['helpdesk_email'] + name = branding['defaults']['organisation']['name'].present? ? "#{branding['defaults']['organisation']['name']} helpdesk" : 'Helpdesk' + else + email = 'other.organisation@example.org' + name = 'Helpdesk' + end + + other_org = Org.find_by(is_other: true) + if other_org.present? + puts "Found the 'Other' org (is_other == true)" + else + puts "Could not find the 'Other' org (is_other == true), adding 'Other' org" + other_org = Org.create!({ + name: 'Other Organisation', + abbreviation: 'OTHER', + org_type: Org.org_type_values_for(:organisation).min, + contact_email: email, + contact_name: name, + links: {"org": []}, + is_other: true, + }) + end + + unaffiliated = User.where(org_id: nil) + unless unaffiliated.empty? + puts "The following users are not associated with an org. Assigning them to the 'Other' org." + puts unaffiliated.collect(&:email).join(', ') + unaffiliated.update_all(org_id: other_org.id) + end + end end diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index d3949b2..04a07ed 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -2,12 +2,12 @@ def initialize @org = Org.first @recipient = User.new(email: "recipient@example.org", firstname: "Test", surname: "Recipient", - password: "password123", password_confirmation: "password123", org: @org, + password: "password123", password_confirmation: "password123", org: @org, accept_terms: true, confirmed_at: Time.zone.now) @requestor = User.new(email: "requestor@example.org", firstname: "Test", surname: "Requestor", - password: "password123", password_confirmation: "password123", org: @org, + password: "password123", password_confirmation: "password123", org: @org, accept_terms: true, confirmed_at: Time.zone.now) - @template = Template.new(title: 'Test template', description: 'My test template', org: @org, + @template = Template.new(title: 'Test template', description: 'My test template', org: @org, archived: false, family_id: "9999999") @plan = Plan.new(template: @template, title: 'Test Plan', grant_number: 'Grant-123', principal_investigator: 'Researcher', principal_investigator_identifier: 'researcher-1234', @@ -19,7 +19,7 @@ UserMailer.welcome_notification(@requestor) end def sharing_notification - UserMailer.sharing_notification(@role, @recipient) + UserMailer.sharing_notification(@role, @recipient, inviter: @requestor) end def permissions_change_notification UserMailer.permissions_change_notification(@role, @recipient)
<%= _('Name') %><%= _('Name') %> + <%= namesHash[perm.name.to_sym] %> + <%= namesHash[perm.name.to_sym] %> + <%= namesHash[perm.name.to_sym] %> + <%= namesHash[perm.name.to_sym] %> + <%= namesHash[perm.name.to_sym] %>