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/projects/_form.html.erb b/app/views/projects/_form.html.erb deleted file mode 100644 index 48e401f..0000000 --- a/app/views/projects/_form.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -
- <%= form_for @project, :html => { :class => 'form-horizontal' } do |f| %> -
- <%= f.label _('Title'), :class => 'left-label' %> -
- <%= 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.') %> -
-
-
- <%= f.label _('Grant number'), :class => 'left-label' %> -
- <%= f.text_field :grant_number, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => _('Grant reference number if applicable [POST-AWARD DMPs ONLY]') %> -
-
-
- <%= f.label _('Note'), :class => 'left-label' %> -
- <%= f.text_area :note, :class => 'text_area', :rows => 10 %> -
-
-
- <%= f.label _('helpers.is_test'), class: 'left-label' %> -
- <%= f.check_box :is_test, class: 'check_box has-tooltip', 'data-toggle': 'tooltip' title: _('helpers.project.is_test_help_text') %> -
-
-
- <%= f.submit _('Save'), :class => 'btn btn-primary' %> - <%= link_to _('Cancel'), - projects_path, :class => 'btn' %> -
- <% end %> -
diff --git a/app/views/projects/_project_details.html.erb b/app/views/projects/_project_details.html.erb deleted file mode 100644 index 564e67e..0000000 --- a/app/views/projects/_project_details.html.erb +++ /dev/null @@ -1,299 +0,0 @@ - -
-
"> -
-

- <%= _('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.')%> -

-
- - -
- <% if @project.administerable_by(current_user.id) then %> - <%= _('Edit plan details') %> - <% end %> -
- -
- - - - - - - - - - - - - - - - - - <% if !@project.principal_investigator_identifier.nil? && @project.principal_investigator_identifier != "" then %> - - - - - <%end%> - - - - - - - - - - - - -
<%= _('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)')}")))) %>
-
-
- <% if @project.administerable_by(current_user.id) then %> -
"> - -
-

- <%= raw _("Please fill in the basic project details below and click 'Update' to save")%> -

-
- -
- <%= semantic_form_for @project, :url => {:controller => :projects, :action => :update }, :html=>{:method=>:put} do |f| %> - <%= f.inputs do %> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%= _('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:

  • - 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.

")} %> -
<%= _('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.') %> -
-
-
- <% end %> - - <%= f.actions do %> -
- <%= f.submit _('Save'), :class => 'btn btn-primary' %> - <%= _('Cancel') %> -
- <%end%> - <%end%> -
- <% end %> -

<%= _('This plan is based on:')%>

- - - <%if @project.dmptemplate.organisation.organisation_type.name == constant("organisation_types.funder")%> - - - - - <%end%> - <%if !@project.organisation_id.nil? %> - - - - - <%end%> -
<%= constant("organisation_types.funder") %><%= @project.dmptemplate.organisation.name %>
<%= constant("organisation_types.institution") %><%= @project.organisation.name %>
->>>>>>> final_schema - - - <% if @project.plans.any? %> - <% if @project.plans.count == 1 then %> - <% @project.plans.each do |plan| %> - -
- <%= link_to _('Answer questions'), [:edit, @project, plan], :class => 'btn btn-primary' %> - <%= _('Export') %> -
- <%= render :partial => "plans/export", locals: {plan: plan} %> -
-

<%= raw plan.version.phase.description %>

- <% if !plan.sections.nil? %> - - - - - - - - - <% plan.sections.each do |section| %> - - - - - <%end%> - -
<%= _('Sections')%><%= _('Questions')%>
-

<%= section.title %>

-
- <% if section.questions.any? %> - <% questions = section.questions.sort_by(&:number) %> -
    - <% questions.each do |ques|%> -
  • - <%= raw ques.text %> -
  • - <%end%> -
- <%end%> -
- <%end%> - <%end%> - <%else%> -
- <%= raw @project.dmptemplate.description %> -
- <% @project.plans.each do |plan| %> -
-
- -
-
-
- <%= link_to _('Answer questions'), [:edit, @project, plan], :class => 'btn btn-primary' %> - <%= _('Export') %> -
- <%= render :partial => "plans/export", locals: {plan: plan} %> -
-

<%= raw plan.version.phase.description %> -

- - <% if !plan.sections.nil? %> - - - - - - - - - <% plan.sections.each do |section| %> - - - - - <%end%> - -
<%= _('Sections')%><%= _('Questions')%>
-

<%= section.title %>

-
- <% if section.questions.any? %> - <% questions = section.questions.sort_by(&:number) %> -
    - <% questions.each do |ques|%> -
  • - - <%= ques.text %> -
  • - <%end%> -
- <%end%> -
- <%end%> -
-
-
-
- <%end%> - <%end%> - <%end%> -
diff --git a/app/views/projects/_project_nav_tabs.html.erb b/app/views/projects/_project_nav_tabs.html.erb deleted file mode 100644 index e9f1b3d..0000000 --- a/app/views/projects/_project_nav_tabs.html.erb +++ /dev/null @@ -1,46 +0,0 @@ - - diff --git a/app/views/projects/_project_title.html.erb b/app/views/projects/_project_title.html.erb deleted file mode 100644 index 9a18861..0000000 --- a/app/views/projects/_project_title.html.erb +++ /dev/null @@ -1,8 +0,0 @@ - -
-
-

- <%= project.title %> -

-
-
\ No newline at end of file diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb deleted file mode 100644 index c5e940d..0000000 --- a/app/views/projects/edit.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<%- model_class = Project -%> - - -<%= render :partial => "/projects/project_title", locals: {project: @project} %> - - -<%= render :partial => "project_nav_tabs", locals: {project: @project, active: "edit_project"} %> - -<%= render :partial => 'form' %> diff --git a/app/views/projects/export.html.erb b/app/views/projects/export.html.erb deleted file mode 100644 index 722883c..0000000 --- a/app/views/projects/export.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<%- model_class = Project -%> - - -<%= render :partial => "/projects/project_title", locals: {project: @project} %> - - -<%= render :partial => "project_nav_tabs", locals: {project: @project, active: "export_page"} %> - - -
- - <%= 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'.

")%> - - - <% 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| %> -
-
- -
-
- <%= render :partial => "/shared/export_links", locals: {plan: plan} %> -
-
-
-
- <%end%> - <%end%> - <%end%> - -
\ No newline at end of file diff --git a/app/views/projects/share.html.erb b/app/views/projects/share.html.erb deleted file mode 100644 index 95fdf57..0000000 --- a/app/views/projects/share.html.erb +++ /dev/null @@ -1,71 +0,0 @@ -<%- model_class = Project -%> - - -<%= render :partial => "/projects/project_title", locals: {project: @project} %> - - -<%= render :partial => "project_nav_tabs", locals: {project: @project, active: "share_project"} %> -
- - - <%= raw _('

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]) }%> - -
-

<%= _('Collaborators')%>

-
- <% if @project.roles.any? then %> - - - - - - - - - - - <% project_people = @project.roles.all.select {|pu| pu.user_id != nil}%> - <% project_people.each do |group| %> - - - - - - <% end %> - -
<%= _('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 %> -
- <% end %> -
- -
-

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

- -
- <% new_role = Role.new %> - <% new_role.project = @project %> - <%= semantic_form_for new_role, :url => {:controller => :roles, :action => :create }, :html=>{:method=>:post} do |f| %> - <%= f.inputs do %> - <%= f.input :project_id, :as => :hidden %> - <%= f.email_field :email, :label => false, placeholder: _('Email') %> -

<%= _('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 %> -
-
-
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb deleted file mode 100644 index 8faab88..0000000 --- a/app/views/projects/show.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%= javascript_include_tag "projects" %> - -<%- model_class = Project -%> - - -<%= render :partial => "/projects/project_title", locals: {project: @project} %> - - -<%= render :partial => "project_nav_tabs", locals: {project: @project, active: "show_project"} %> - - -<%= render "project_details" %> \ No newline at end of file