diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 9f5d37f..41abae4 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -155,7 +155,9 @@ authorize @plan # If there was no phase specified use the template's 1st phase @phase = (params[:phase].nil? ? @plan.template.phases.first : Phase.find(params[:phase])) - + @show_phase_tab = params[:phase] + @readonly = !@plan.editable_by?(current_user.id) + # Get all Guidance Groups applicable for the plan and group them by org @all_guidance_groups = @plan.get_guidance_group_options @all_ggs_grouped_by_org = @all_guidance_groups.sort.group_by(&:org) diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb index c95732b..8c151f3 100644 --- a/app/views/phases/_answer_form.html.erb +++ b/app/views/phases/_answer_form.html.erb @@ -5,7 +5,7 @@ **Copyright: Digital Curation Centre and California Digital Library --> -
+
<% answers = question.plan_answers(plan.id) if answers.present? @@ -29,61 +29,57 @@
-
+
-
- <% comments = answer.notes.all %> - <%= hidden_field_tag :question_id, question.id, class: "question_id" %> - <% active_tab = nil %> -
    - <% annotations = question.annotations.where(type: Annotation.types[:guidance]) %> - <% if annotations.present? || question_guidances.present? %> - <% active_tab = 'guidance_tab' %> -
  • - <%= link_to _('Guidance'), "#", class: "right_column_tab_link" %> -
  • - <% else %> - <% active_tab = 'note_tab' %> - <% end %> -
  • "> - <% if comments.count > 0 %> - <%= link_to "#{_('Notes')} (#{comments.count})" , "#", id: "notes_number_#{question.id}", class: "right_column_tab_link" %> - <% else %> - <%= link_to _('Share note'), "#", id: "notes_number_#{question.id}", class: "right_column_tab_link" %> - <% end %> +
    + <% comments = answer.notes.all %> + <%= hidden_field_tag :question_id, question.id, class: "question_id" %> + <% active_tab = nil %> + + +
      + <% annotations = question.annotations.where(type: Annotation.types[:guidance]) %> + <% if annotations.present? || question_guidances.present? %> + <% active_tab = 'guidance_tab' %> + -
    -
    + <% else %> + <% active_tab = 'note_tab' %> + <% end %> +
  • " role="tab" aria-controls="comment-question-area-<%= question.id %>"> + <% if comments.count > 0 %> + <%= _('Notes') %> + <% else %> + <%= _(' Share note') %> + <% end %> +
  • +
+ +
+
-
<% num_annotations = 0 %> + <% i = 0 %> <% if annotations.present? %> <% annotations.each do |annotation| %> -
- - - +

+ <%= annotation.org.abbreviation %> <%= _('Guidance') %> + +

<%= raw annotation.text %>
<% num_annotations += 1%> -
+ <% i += 1 %> <% end %> <% end %> @@ -91,33 +87,36 @@ <% guidance_accordion_id = num_annotations %> <% question_guidances.each_pair do |theme, group| %> <% group.each do |gobj| %> -
- +

+ <%= gobj[:org] %> guidance on <%= theme %> + +

+
<%= raw gobj[:text] %>
<% guidance_accordion_id += 1 %> -
+ <% i += 1 %> <% end %> <% end %>
-
+ +
+ +
+ -
<%= render partial: "note", locals: {question: question, answer: answer, plan: plan, suffix: "" }%> -
-
+ +
+
+
+
<% if last_question_id == question.id then %>
<% else %> -
+
<% end %> diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb index 5e33227..ed69430 100644 --- a/app/views/phases/edit.html.erb +++ b/app/views/phases/edit.html.erb @@ -11,52 +11,60 @@ <%= render :partial => "/plans/plan_title", locals: {plan: @plan} %> -
+
<%= render :partial => "/plans/progress", locals: { plan: @plan } %>
- -<%= render :partial => "/plans/plan_nav_tabs", locals: {plan: @plan, active: @phase.title} %> +
+
+ + - -
+ +
+
+ <% i = 0 %> <% @phase.sections.order(:number).each do |section| %> <% sectionid = section.id %> - +

+ <%= render :partial => "/sections/progress", locals: { section: section, plan: @plan } %> + +

- - - -
-
- <%= raw section.description %> -
+

<%= raw section.description %>

-
- +
@@ -79,40 +87,47 @@
<% end %>
-
-
-
- - - + + <% i += 1 %> +
+ <% end %>
-
-
+
+
+
+
+ + +
<%= render :partial => "plans/export", locals: {plan: @plan, plan_data: @plan_data, phase: @phase } %> +
\ No newline at end of file diff --git a/app/views/plans/_available_templates.html.erb b/app/views/plans/_available_templates.html.erb index 5d9f710..d826258 100644 --- a/app/views/plans/_available_templates.html.erb +++ b/app/views/plans/_available_templates.html.erb @@ -1,6 +1,6 @@ <%= _('Which DMP template would you like to use?') %> -
+
diff --git a/app/views/plans/_details.html.erb b/app/views/plans/_details.html.erb deleted file mode 100644 index 68f11cb..0000000 --- a/app/views/plans/_details.html.erb +++ /dev/null @@ -1,67 +0,0 @@ -

<%= _('Project Details') %>

- -<%= form_for resource, as: 'user', url: user_session_path, - html: {class: "login-form roadmap-form content-two-column"} do |f| %> - -
-
- -
- - - -
-
- - -
-
- - -
-
- -
- - <%= tinymce(selector: "#plan_description", content_css: asset_path('application.css')) %> -
-
- - -
-

<%= _('Data Contact Person') %>

-
- - - -
-
- - - -
-
- - - - -
- -
- <%= render partial: 'shared/accessible_submit_button', - locals: {id: 'details-button', - val: _('Save'), - disabled_initially: true, - classes: 'small-input-button', - tooltip: _('Project title is required.')} %> -
-
-
-<% end %> \ No newline at end of file diff --git a/app/views/plans/_edit_details.html.erb b/app/views/plans/_edit_details.html.erb new file mode 100644 index 0000000..a8db978 --- /dev/null +++ b/app/views/plans/_edit_details.html.erb @@ -0,0 +1,80 @@ +<% javascript('views/plans/edit.js') %> + +<%= form_for plan, html: {method: :put, class: "roadmap-form"} do |f| %> +
+
+
+ <%= f.label "#{_('Project Title')} #{_('(required)')}", for: :title %> + <%= f.text_field :title, class: "input-large has-tooltip", 'data-toggle': "tooltip", + 'title': _('If applying for funding, state the name exactly as in the grant proposal.') %> +
+ +
+ <%= f.label :grant_number %> + <%= f.text_field :grant_number, class: 'input-small has-tooltip', 'data-toggle': "tooltip", + 'title': _('Grant reference number if applicable [POST-AWARD DMPs ONLY]') %> +
+ +
+ <%= f.label :principal_investigator %> + <%= f.text_field :principal_investigator, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", + 'title': _('Name of Principal Investigator(s) or main researcher(s) on the project.') %> +
+ +
+ <%= f.label _('Project Abstract'), for: :description %> + <%= f.text_area :description, { rows: 7, class: 'input-large has-tooltip', + 'data-toggle': "tooltip", 'data-html': "true", + 'title': _("

Questions to consider:

  • - What is the nature of your research project?
  • - What research questions are you addressing?
  • - For what purpose are the data being collected or created?

Guidance:

Briefly summarise the type of study (or studies) to help others understand the purposes for which the data are being collected or created.

")} %> +
+ +
+ +
+ <%= f.label _('Plan ID'), for: :identifier %> + <%= f.text_field :identifier, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", + 'title': _('A pertinent ID as determined by the funder and/or institution.') %> +
+ +
+
+ +
+
+ <%= f.label _('Name'), for: :data_contact %> + <%= f.text_field :data_contact, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", + 'title': _('Name (if different to above), telephone and email contact details') %> +
+ +
+
+
+ + +
+
+
+ +
+
+ +
+ +
(<%= _('Limited to finished plans') %>)
+
+
/><%= raw display_visibility('privately_visible') %>
+
/><%= raw display_visibility('organisationally_visible') %>
+
/><%= raw display_visibility('publicly_visible') %>
+
+
+ +
+
<%= _('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 3 organisations to see their guidance.') %>

+ +<%= @important_ggs.inspect %> +
+
+<% end %> \ No newline at end of file diff --git a/app/views/plans/_phase.html.erb b/app/views/plans/_phase.html.erb deleted file mode 100644 index c83c46a..0000000 --- a/app/views/plans/_phase.html.erb +++ /dev/null @@ -1,113 +0,0 @@ -
-
- <% sections = @phase.sections %> - <% sections.each do |section| %> - - - <% if session[:question_id_comments].to_i != 0 then %> - <% question_from_comment = Question.find(session[:question_id_comments])%> - <% if section.id == question_from_comment.section_id then %> - <%= hidden_field_tag :comment_section_id, question_from_comment.section_id, :class => "comment_section_id" %> - <%end%> - <% end%> - - - -
- - <% num_section_questions = @plan.status["sections"][section.id]["num_questions"] %> - <% num_section_answers = @plan.status["sections"][section.id]["num_answers"] %> - <% question_word = "questions" %> - <% if num_section_questions == 1 then %> - <% question_word = "question" %> - <% end %> - <% section_status = "#{num_section_questions} #{question_word}, #{num_section_answers} answered" %> - - - - - -
-
- <%= raw section.description %> -
-
- - -
-

<%= t ('helpers.loading')%>

-
- - - - -
- <% section.questions.order("number").each do |question| %> - <% if question.id == session[:question_id_comments].to_i then id_css = "current_question" end %> -
- <% partialname = "answer_form" - if @readonly - partialname += "_ro" - end - %> - - <%= #render partial: partialname, - # locals: { - # plan: @plan, - # question: question, - # last_question_id: section.questions.order("number DESC").first.id - # } - %> -
- <% end %> -
- -
-
-
- - - - <% end %> -
- <%= tinymce %> -
- \ No newline at end of file diff --git a/app/views/plans/_plan_details.html.erb b/app/views/plans/_plan_details.html.erb deleted file mode 100644 index a8db978..0000000 --- a/app/views/plans/_plan_details.html.erb +++ /dev/null @@ -1,80 +0,0 @@ -<% javascript('views/plans/edit.js') %> - -<%= form_for plan, html: {method: :put, class: "roadmap-form"} do |f| %> -
-
-
- <%= f.label "#{_('Project Title')} #{_('(required)')}", for: :title %> - <%= f.text_field :title, class: "input-large has-tooltip", 'data-toggle': "tooltip", - 'title': _('If applying for funding, state the name exactly as in the grant proposal.') %> -
- -
- <%= f.label :grant_number %> - <%= f.text_field :grant_number, class: 'input-small has-tooltip', 'data-toggle': "tooltip", - 'title': _('Grant reference number if applicable [POST-AWARD DMPs ONLY]') %> -
- -
- <%= f.label :principal_investigator %> - <%= f.text_field :principal_investigator, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", - 'title': _('Name of Principal Investigator(s) or main researcher(s) on the project.') %> -
- -
- <%= f.label _('Project Abstract'), for: :description %> - <%= f.text_area :description, { rows: 7, class: 'input-large has-tooltip', - 'data-toggle': "tooltip", 'data-html': "true", - 'title': _("

Questions to consider:

  • - What is the nature of your research project?
  • - What research questions are you addressing?
  • - For what purpose are the data being collected or created?

Guidance:

Briefly summarise the type of study (or studies) to help others understand the purposes for which the data are being collected or created.

")} %> -
- -
- -
- <%= f.label _('Plan ID'), for: :identifier %> - <%= f.text_field :identifier, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", - 'title': _('A pertinent ID as determined by the funder and/or institution.') %> -
- -
-
- -
-
- <%= f.label _('Name'), for: :data_contact %> - <%= f.text_field :data_contact, class: 'input-medium has-tooltip', 'data-toggle': "tooltip", - 'title': _('Name (if different to above), telephone and email contact details') %> -
- -
-
-
- - -
-
-
- -
-
- -
- -
(<%= _('Limited to finished plans') %>)
-
-
/><%= raw display_visibility('privately_visible') %>
-
/><%= raw display_visibility('organisationally_visible') %>
-
/><%= raw display_visibility('publicly_visible') %>
-
-
- -
-
<%= _('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 3 organisations to see their guidance.') %>

- -<%= @important_ggs.inspect %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/plans/edit.html.erb b/app/views/plans/edit.html.erb deleted file mode 100644 index 38de2ac..0000000 --- a/app/views/plans/edit.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -

<%= @plan.title %>

- -<% if @plan.visibility == 'is_test' %> -
- - <%= _('This is a') %> <%= _('test plan') %>. -
-<% end %> - -
-
- - - - -
-
- <%= render partial: 'plan_details', locals: {plan: @plan} %> -
- - <% i = 0 %> - <% @plan.template.phases.each do |phase| %> -
- <%= render partial: 'phase', locals: {plan: @plan, phase: phase} %> -
- <% end %> - -
- <%= render partial: 'share', locals: {plan: @plan} %> -
-
- - <%= render partial: "download", locals: {plan: @plan, phase: @phase} %> -
-
-
\ No newline at end of file diff --git a/app/views/plans/index.html.erb b/app/views/plans/index.html.erb index 472143c..4b2870d 100644 --- a/app/views/plans/index.html.erb +++ b/app/views/plans/index.html.erb @@ -46,7 +46,7 @@ <%= link_to "#{plan.title.length > 60 ? "#{plan.title[0..59]} ..." : plan.title}", - edit_plan_path(plan) %> + plan_path(plan) %> <%= plan.template.title %> <%= l(plan.latest_update.to_date, formats: :short) %> @@ -59,10 +59,10 @@ <%= _('Actions') %> -
diff --git a/app/views/plans/new.html.erb b/app/views/plans/new.html.erb index ffdf8f0..d10fff2 100644 --- a/app/views/plans/new.html.erb +++ b/app/views/plans/new.html.erb @@ -14,15 +14,14 @@
<%= _('What research project are you planning?') %> -
+
- -
- <%= _('If applying for funding, state the title exactly as in the proposal.') %> -
+
@@ -30,7 +29,7 @@
<%= _('Primary research organisation') %> -
+
@@ -59,7 +58,7 @@
<%= _('Funding organisation') %> -
+
diff --git a/app/views/plans/share.html.erb b/app/views/plans/share.html.erb index c74e8c4..338e387 100644 --- a/app/views/plans/share.html.erb +++ b/app/views/plans/share.html.erb @@ -8,97 +8,96 @@
-
+
+

<%= _('Collaborators')%>

- <%= raw _('

You can give other people access to your plan here. There are three permission levels.

  • Users with "read only" access can only read the plan.
  • Editors can contribute to the plan.
  • Co-owners can also contribute to the plan, but additionally can edit the plan details and control access to the plan.

Add each collaborator in turn by entering their email address below, choosing a permission level and clicking "Add collaborator".

Those you invite will receive an email notification that they have access to this plan, inviting them to register with %{application_name} if they don\'t already have an account. A notification is also issued when a user\'s permission level is changed.

') % { application_name: Rails.configuration.branding[:application][:name] } %> +

<%= _('You can give other people access to your plan here. There are three permission levels.') %> +

    +
  • <%= _('Users with "read only" access can only read the plan.') %>
  • +
  • <%= _('Editors can contribute to the plan.') %>
  • +
  • <%= _('Co-owners can also contribute to the plan, but additionally can edit the plan details and control access to the plan.') %>
  • +
+

+

<%= _('Add each collaborator in turn by entering their email address below, choosing a permission level and clicking "Add collaborator".') %>

+

<%= _('Those you invite will receive an email notification that they have access to this plan, inviting them to register with %{application_name} if they don\'t already have an account. A notification is also issued when a user\'s permission level is changed.') % { application_name: Rails.configuration.branding[:application][:name] } %>

-
-

<%= _('Collaborators')%>

-
- <% if @plan.roles.any? then %> - - - - - - - - - - <% plan_roles = @plan.roles.all %> - <% plan_roles.each do |role| %> - - - - - - <% end %> - -
<%= _('Email address')%><%= _('Permissions')%>
<%= role.user.name %> - <% if role.creator? %> - <%= 'Owner' %> - <% elsif !role.creator? && role.user == current_user %> - <%= display_role(role) %> - <% elsif !role.creator? && role.user != current_user %> - <%= form_for role, url: {controller: :roles, action: :update, id: role.id }, html: {method: :put} do |f| %> -
- <%= f.select :access_level, {"#{_('Co-owner')}": 3, "#{_('Editor')}": 2, "#{_('Read only')}": 1}, {}, {id: "#{role.id}-can-edit", class: "toggle-existing-user-access has-tooltip", 'data-toggle': "tooltip", 'title': _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> -
- <% end %> - <% end %> -
- <% unless role.creator? || role.user == current_user then %> - <%= link_to _('Remove user access'), role, method: :delete, data: { confirm: _('Are you sure?') }, :class => "a-orange" %> - <% end %> -
+ <% if @plan.roles.any? then %> + + + + + + + + + + <% plan_roles = @plan.roles.all %> + <% plan_roles.each do |role| %> + + + + + + <% end %> + +
<%= _('Email address')%><%= _('Permissions')%>
<%= role.user.name %> + <% if role.creator? %> + <%= 'Owner' %> + <% elsif !role.creator? && role.user == current_user %> + <%= display_role(role) %> + <% elsif !role.creator? && role.user != current_user %> + <%= form_for role, url: {controller: :roles, action: :update, id: role.id }, html: {method: :put} do |f| %> +
+ <%= f.select :access_level, {"#{_('Co-owner')}": 3, "#{_('Editor')}": 2, "#{_('Read only')}": 1}, {}, {id: "#{role.id}-can-edit", class: "toggle-existing-user-access has-tooltip", 'data-toggle': "tooltip", 'title': _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> +
+ <% end %> + <% end %> +
+ <% unless role.creator? || role.user == current_user then %> + <%= link_to _('Remove user access'), role, method: :delete, data: { confirm: _('Are you sure?') }, :class => "a-orange" %> + <% end %> +
+ <% end %> + +

<%= _('Add collaborator') %>

+ <% new_role = Role.new %> + <% new_role.plan = @plan %> + <%= form_for new_role, url: {controller: :roles, action: :create }, + html: {method: :post, class: 'roadmap-form'} do |f| %>

+
+ <%= f.hidden_field :plan_id %> + + <%= f.fields_for :user do |user| %> + <%= user.label :email, _('Email') %> + <%= user.email_field :email, for: :user, name: "user", class: "left-indent" %> <% end %> -

-
- -
- <% new_role = Role.new %> - <% new_role.plan = @plan %> - <%= form_for new_role, url: {controller: :roles, action: :create }, - html: {method: :post, class: 'roadmap-form'} do |f| %> -
- <%= _('Add collaborator') %> - - <%= f.hidden_field :plan_id %> - - <%= f.fields_for :user do |user| %> - <%= user.label :email, _('Email') %> - <%= user.email_field :email, for: :user, name: "user", class: "left-indent" %> - <% end %> - - <%= f.label :access_level, _('Permissions') %> - <%= f.select :access_level, [[_('Co-owner'), 3], [ _('Editor') , 2], [ _('Read only'), 1]], {}, {class: 'has-tooltip left-indent', 'data-toggle': "tooltip", 'title': _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> - -
- <% end %> -
-
+ <%= f.label :access_level, _('Permissions') %> + <%= f.select :access_level, [[_('Co-owner'), 3], [ _('Editor') , 2], [ _('Read only'), 1]], {}, {class: 'has-tooltip left-indent', 'data-toggle': "tooltip", 'title': _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> + +
+ <% end %>
diff --git a/app/views/plans/show.html.erb b/app/views/plans/show.html.erb index 2ddcc79..0926e61 100644 --- a/app/views/plans/show.html.erb +++ b/app/views/plans/show.html.erb @@ -11,43 +11,26 @@ <% @plan.template.phases.each do |phase| %> <% end %>
-
- <%= render partial: 'show_details', locals: {plan: @plan} %> -
- - <% i = 0 %> - <% @plan.template.phases.each do |phase| %> -
- <%= render partial: 'show_phase', locals: {plan: @plan, phase: phase} %> -
- <% end %> - -
- <%= render partial: 'share', locals: {plan: @plan} %> -
-
- - <%= render partial: "download", locals: {plan: @plan, phase: @phase} %> +
+ <% if @plan.editable_by?(current_user) %> + <%= render partial: 'edit_details', locals: {plan: @plan} %> + <% else %> + <%= render partial: 'show_details', locals: {plan: @plan} %> + <% end %>
\ No newline at end of file diff --git a/app/views/plans/show_export.html.erb b/app/views/plans/show_export.html.erb index 3096205..3270041 100644 --- a/app/views/plans/show_export.html.erb +++ b/app/views/plans/show_export.html.erb @@ -3,56 +3,48 @@ <%= render :partial => "plan_title", locals: {plan: @plan} %> -
-
+
- <%= raw _("

From here you can download your plan in various formats. This may be useful if you need to submit your plan as part of a grant application.
Select what format you wish to use and click to 'Export'.

")%> +

<%= _("From here you can download your plan in various formats. This may be useful if you need to submit your plan as part of a grant application.") %>

+

<%= _(" Select what format you wish to use and click to 'Export'.") %>

<% if @plan.template.phases.count == 1 %> <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: @plan.template.phases.first} %> <%else%> - <% @plan.template.phases.each do |phase| %> -
-
- -
-
- <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: phase} %> -
-
+
+ <% @plan.template.phases.each do |phase| %> +

<%= phase.title %>

+
+ <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: phase} %>
-
- <%end%> + <%end%> +
<%end%>
diff --git a/lib/assets/javascripts/dmproadmap/utils.js b/lib/assets/javascripts/dmproadmap/utils.js index 4cbe5ea..33ab2df 100644 --- a/lib/assets/javascripts/dmproadmap/utils.js +++ b/lib/assets/javascripts/dmproadmap/utils.js @@ -18,4 +18,13 @@ $(this).css('visibility', 'hidden'); }); }); + + // Display tooltips when the item has focus or hover + $("[data-toggle='tooltip']").on('focus', function(e){ + var y = $(this).width() + 35; + $(this).parent().append('
' + $(this).attr('data-content') + '