Mercurial > hg > soundsoftware-site
changeset 629:f9470a59e5da feature_36
Feature #241 - Added permissions to the Show Publication view.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 25 Aug 2011 14:57:08 +0100 |
parents | b080f902af3e |
children | d91ee0e196e5 |
files | vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb |
diffstat | 2 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Wed Aug 24 17:24:15 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Thu Aug 25 14:57:08 2011 +0100 @@ -75,13 +75,20 @@ s = "" publication.projects.each do |proj| - if @project == proj - confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' - else - confirm_msg = false - end + s << link_to_project(proj, {}, :class => 'publication_project') - s << link_to_project(proj, {}, :class => 'publication_project') + link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj, :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del') + "<br />" + if User.current.allowed_to?(:edit_publication, @project) + if @project == proj + confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' + else + confirm_msg = false + end + + s << link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj, :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del') + end + + s << "<br />" + end s
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Wed Aug 24 17:24:15 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Thu Aug 25 14:57:08 2011 +0100 @@ -4,25 +4,29 @@ <div class="box"> <h3> -<%= h @publication.title %> + <%= h @publication.title %> </h3> <h4><%= l(:authors) %></h4> <ul id="authorships"> <% for authorship in @publication.authorships.find(:all, :order => :auth_order) %> <% content_tag_for :li, authorship do %> - <span class="handle">[drag to reorder]</span> + <%- if User.current.allowed_to?(:edit_publication, @project) -%> + <span class="handle">[drag to reorder]</span> + <%- end -%> <%= h authorship.name_on_paper %> <em><%= h authorship.institution %></em> <br /> - <% end %> - <% end %> + <%- end -%> + <%- end -%> </ul> -<%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %> +<%- if User.current.allowed_to?(:edit_publication, @project) -%> + <%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %> +<%- end -%> <%- if @publication.bibtex_entry != nil -%> <%= show_bibtex_fields(@publication.bibtex_entry) %> <%- end -%> -<br> +<br / > <% if User.current.allowed_to?(:add_publication, @project) %> <%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> | <%= link_to "Delete", {:controller => 'publications', :action => 'destroy', :id => @publication, :project_id => @project }, @@ -35,8 +39,12 @@ <% content_for :sidebar do %> <h3><%=l(:label_publication_project_index)%></h3> + <p id="list_projects"> <%= render :partial => 'list_projects' %> </p> + + <%- if User.current.allowed_to?(:edit_publication, @project) -%> <%= render :partial => 'add_project_form' %> + <%- end -%> <% end %>