diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb deleted file mode 100644 index 9ca5bcc..0000000 --- a/app/policies/project_policy.rb +++ /dev/null @@ -1,43 +0,0 @@ -class ProjectPolicy < ApplicationPolicy - attr_reader :user - attr_reader :project - - def initialize(user, project) - raise Pundit::NotAuthorizedError, "must be logged in" unless user - @user = user - @project = project - end - - def show? - @project.readable_by(@user.id) - end - - def edit? - @project.editable_by(@user.id) - end - - def share? - @project.editable_by(@user.id) - end - - def export? - @project.readable_by(@user.id) - end - - def update? - @project.editable_by(@user.id) - end - - def destroy? - @project.editable_by(@user.id) - end - - def possible_templates? - true - end - - def possible_guidance? - true - end - -end \ No newline at end of file diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index 31e1702..afadc96 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -52,6 +52,6 @@ <%= tinymce :content_css => asset_path('application.css') %> -
- <%= _('This page gives you an overview of your plan. It tells what your plan is based on and gives an overview of the questions that you will be asked.')%> -
-| <%= _('Plan name') %> | -<%= @project.title %> | -
| <%= _('ID') %> | -- <% if !@project.identifier.nil? && @project.identifier != "" then %> - <%= @project.identifier %> - <%else%> - - - <%end%> - | -
| <%= _('Grant number') %> | -- <% if !@project.grant_number.nil? && @project.grant_number!= "" then %> - <%= @project.grant_number %> - <%else%> - - - <%end%> - | -
| <%= _('Principal Investigator/Researcher') %> | -<% if !@project.principal_investigator.nil? && @project.principal_investigator != "" then %> - <%= @project.principal_investigator %> - <%else%> - - - <%end%> - | -
| <%= _('Principal Investigator/Researcher ID') %> | -- <%= @project.principal_investigator_identifier %> - | -
| <%= _('Plan data contact') %> | -<% if !@project.data_contact.nil? && @project.data_contact != "" then%> - <%= @project.data_contact %> - <%else%> - - - <%end%> - | -
| <%= _('Description') %> | -<% if !@project.description.nil? && @project.description != "" then%> - <%= @project.description %> - <%else%> - - - <%end%> - | -
| <%= _('Visibility') %> | -<%= (@project.is_test? ? _('Test/Practice (your plan is not visible to other users) See our Terms of Use.') : (@project.organisationally_visible? ? _('Organisational (visibile to others within your organisation)') : (@project.publicly_visible? ? _('Public (Your DMP will appear on the Public DMPs page of this site)') : (@project.privately_visible? ? _('Private (owners, co-owners, and administrators only) See our Terms of Use.') : "Defaulting to: #{_('Not specified (will be visible to others within your organisation by default)')}")))) %> | -
- <%= raw _("Please fill in the basic project details below and click 'Update' to save")%> -
-| <%= _('Plan name') %> | -- <%= f.text_field :title, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('If applying for funding, state the name exactly as in the grant proposal.') %> - | -
| <%= _('ID') %> | -- <%= f.text_field :identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('A pertinent ID as determined by the funder and/or institution.') %> - | -
| <%= _('Grant number') %> | -- <%= f.text_field :grant_number, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('Grant reference number if applicable [POST-AWARD DMPs ONLY]') %> - | -
| <%= _('Principal Investigator/Researcher') %> | -- <%= f.text_field :principal_investigator, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('Name of Principal Investigator(s) or main researcher(s) on the project.') %> - | -
| <%= _('Principal Investigator/Researcher ID') %> | -- <%= f.text_field :principal_investigator_identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('E.g ORCID http://orcid.org/.') %> - | -
| <%= _('Plan data contact') %> | -- <%= f.text_field :data_contact, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('Name (if different to above), telephone and email contact details') %> - | -
| <%= _('Description') %> | -
- <%= f.text_area :description, { :rows => 7, :class => 'text_area has-tooltip', 'data-toggle' => "tooltip", 'data-html' => "true", 'title'=> _("Questions to consider:
Guidance:Briefly summarise the type of study (or studies) to help others understand the purposes for which the data are being collected or created. |
-
| <%= _('Visibility') %> | -
-
- /><%= _('Public (Your DMP will appear on the Public DMPs page of this site)') %>
-
-
- /><%= _('Organisational (visibile to others within your organisation)') %>
-
-
- /><%= _('Test/Practice (your plan is not visible to other users) See our Terms of Use.') %>
-
-
- /><%= _('Private (owners, co-owners, and administrators only) See our Terms of Use.') %>
-
- |
-
| <%= constant("organisation_types.funder") %> | -<%= @project.dmptemplate.organisation.name %> | -
| <%= constant("organisation_types.institution") %> | -<%= @project.organisation.name %> | -
<%= raw plan.version.phase.description %>
- <% if !plan.sections.nil? %> -| <%= _('Sections')%> | -<%= _('Questions')%> | -
|---|---|
|
- <%= section.title %> - |
-
- <% if section.questions.any? %>
- <% questions = section.questions.sort_by(&:number) %>
-
|
-
<%= raw plan.version.phase.description %> -
- - <% if !plan.sections.nil? %> -| <%= _('Sections')%> | -<%= _('Questions')%> | -
|---|---|
|
- <%= section.title %> - |
-
- <% if section.questions.any? %>
- <% questions = section.questions.sort_by(&:number) %>
-
|
-
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 @project.plans.any? %> - <% if @project.plans.count == 1 then %> - <% @project.plans.each do |plan| %> - <%= render :partial => "/shared/export_links", locals: {plan: plan} %> - <% end %> - <%else%> - <% @project.plans.each do |plan| %> -You can give other people access to your plan here. There are three permission levels.
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]) }%> - -| <%= _('Email address')%> | -<%= _('Permissions')%> | -- |
|---|---|---|
| <%= group.user.name %> | -- <% if group.project_creator then %> - <%= _('Owner')%> - <% else %> - <%= form_for group, :url => {:controller => :roles, :action => :update, :id => group.id }, :html=>{:method=>:put} do |f| %> - <%= f.select :access_level, {_('Co-owner') => 3, _('Edit') => 2, _('Read only') => 1}, {}, {:id => "#{group.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 group.project_creator || group.user == current_user then %> - <%= link_to _('Remove user access'), group, method: :delete, data: { confirm: _('Are you sure?') }, :class => "a-orange" %> - <% end %> - | -
<%= _('Permissions')%>:
- <%= f.select :access_level, [[_('Co-owner'), 3], [ _('Edit') , 2], [ _('Read only'), 1]], {}, {:class => 'has-tooltip', 'data-toggle' => "tooltip", 'title' => _('Editors can contribute to plans. Co-owners have additional rights to edit plan details and control access.') } %> - <% end %> - <%= f.actions do %> - <%= f.action :submit, :label => _('Add collaborator'), :button_html => { :class => "btn btn-primary" } %> - <% end %> - <% end %> -