# HG changeset patch # User luisf # Date 1314280628 -3600 # Node ID f9470a59e5dab7964f822376f291654bd1705588 # Parent b080f902af3e9c605ca229869c44437acbd1e654 Feature #241 - Added permissions to the Show Publication view. diff -r b080f902af3e -r f9470a59e5da vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- 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') + "
" + 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 << "
" + end s diff -r b080f902af3e -r f9470a59e5da vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb --- 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 @@

-<%= h @publication.title %> + <%= h @publication.title %>

<%= l(:authors) %>

-<%= 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 -%> -
+
<% 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 %>

<%=l(:label_publication_project_index)%>

+

<%= render :partial => 'list_projects' %>

+ + <%- if User.current.allowed_to?(:edit_publication, @project) -%> <%= render :partial => 'add_project_form' %> + <%- end -%> <% end %>