# HG changeset patch # User luisf # Date 1316189218 -3600 # Node ID f8d7e85ccd4ee3f6c78670dd958a275ac4a8152f # Parent 1f488f375d64f51f2bb1c71cf4d7e265bd181b77 Feature #293: lists the projects associated with a publication. diff -r 1f488f375d64 -r f8d7e85ccd4e vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Sep 16 15:49:29 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Sep 16 17:06:58 2011 +0100 @@ -72,29 +72,28 @@ str = object_name.split("\[").last().gsub("\]","") str.to_sym end - - def render_projects_list(publication) - logger.error { "PROJECT NAME #{@project.name unless @project.nil?}" } - s = "" - - publication.projects.each do |proj| + def render_projects_list(publication, show_delete_icon) + s= "" + + publication.projects.visible.each do |proj| s << link_to_project(proj, {}, :class => 'publication_project') - - 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') + + if show_delete_icon + 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 end - s << "
" - - end - + s << "
" + end + s end diff -r 1f488f375d64 -r f8d7e85ccd4e vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb Fri Sep 16 15:49:29 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb Fri Sep 16 17:06:58 2011 +0100 @@ -1,1 +1,1 @@ -<%= render_projects_list(@publication) %> +<%= render_projects_list(@publication, true) %> diff -r 1f488f375d64 -r f8d7e85ccd4e vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb Fri Sep 16 15:49:29 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb Fri Sep 16 17:06:58 2011 +0100 @@ -5,9 +5,9 @@ <% if @project %> -

<%= l(:label_all_publications_for_project, :project => @project.name) %>

+

<%= l(:label_all_publications_for_project, :project => @project.name) %>

<% else %> -

<%= l(:label_all_publications) %>

+

<%= l(:label_all_publications) %>

<% end %>
@@ -15,24 +15,27 @@ <%= l(:title) %> <%= l(:authors) %> - <%= l(:year) %> + <%= l(:year) %> + <%= l(:associated_projects) %> - <% @publications.each do |publication| %> - - <%= link_to publication.title, :controller => "publications", :action => "show", :id => publication, :project_id => @project %> - - <% publication.authorships.each do |authorship| %> + <% @publications.each do |publication| %> + + <%= link_to publication.title, :controller => "publications", :action => "show", :id => publication, :project_id => @project %> + + <% publication.authorships.each do |authorship| %> <%# if authorship.author.user.nil? || !authorship.author.user.active? %> - <%= h authorship.name_on_paper %> + <%= h authorship.name_on_paper %> <%# else %> - <%#= link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user) %> - <%# end %> - - <%= authorship.institution %>
- <% end %> - <%= publication.bibtex_entry.year %> - + <%#= link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user) %> + <%# end %> + <%= authorship.institution %>
+ <% end %> + <%= publication.bibtex_entry.year %> + + <%= render_projects_list(publication, false) %> + + <% end %>
diff -r 1f488f375d64 -r f8d7e85ccd4e vendor/plugins/redmine_bibliography/config/locales/en.yml --- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 16 15:49:29 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 16 17:06:58 2011 +0100 @@ -7,6 +7,7 @@ author: "Author" name: "Name" year: "Year" + associated_projects: "Associated Projects" publications_box: "My Publications" label_my_publications_box: "My Publications" view_all_publications: "View All Project's Publications"