changeset 693:5163e3ec00b8 feature_36

Feature #293 - The publications index page now has links to both users/authors show pages.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 16 Sep 2011 17:52:00 +0100
parents dd366a17ab34
children f098cfb33721
files vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb
diffstat 2 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Fri Sep 16 17:28:08 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Fri Sep 16 17:52:00 2011 +0100
@@ -72,6 +72,28 @@
     str = object_name.split("\[").last().gsub("\]","")
     str.to_sym
   end
+
+  def render_authorships_list(publication)   
+    s = '<p>'
+    
+    publication.authorships.each do |authorship|
+    
+    if authorship.author.nil?
+      # legacy reasons…
+      s << h(authorship.name_on_paper)
+    else
+      if authorship.author.user.nil?      
+        s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author)
+      else
+        s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user)
+      end
+    end
+      s << "<br /><em>#{authorship.institution}</em></p>"
+    end    
+
+    s   
+  end
+  
     
   def render_projects_list(publication, show_delete_icon)    
     s= ""
--- a/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb	Fri Sep 16 17:28:08 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb	Fri Sep 16 17:52:00 2011 +0100
@@ -24,14 +24,7 @@
         <tr class="<%= cycle('odd', 'even') %>">
           <td class="firstcol title" align="top"><%= link_to publication.title, :controller => "publications", :action => "show", :id => publication, :project_id => @project %></td>
           <td class="authors" align="top">
-	          <% publication.authorships.each do |authorship| %>
-	            <%# if authorship.author.user.nil? || !authorship.author.user.active? %>
-	            <%= h authorship.name_on_paper %>
-	            <%# else %>
-              <%#= link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user) %>
-	            <%# end %>        
-	            <em><%= authorship.institution %></em><br/>
-	          <% end %>
+            <%= render_authorships_list(publication) %>
           <td class="year"><%= publication.bibtex_entry.year %></td>
           <td class="projects">
               <%= render_projects_list(publication, false) %>