changeset 706:0a34c4cb73d5 feature_36

Merge from 703:0435cf085f28
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 19 Sep 2011 17:29:17 +0100
parents b6f9f005c0b6 (current diff) 0435cf085f28 (diff)
children 065041087084
files vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb
diffstat 4 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb	Mon Sep 19 17:28:32 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb	Mon Sep 19 17:29:17 2011 +0100
@@ -1,2 +1,21 @@
+# -*- coding: undecided -*-
 module AuthorshipsHelper
+
+  # Generates a link to either author or user, depending on which is
+  # available
+  def link_to_authorship(authorship)
+    s = ''
+    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
+  end
+
 end
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Sep 19 17:28:32 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Sep 19 17:29:17 2011 +0100
@@ -2,6 +2,7 @@
 require 'bibtex'
 
 module PublicationsHelper
+  include AuthorshipsHelper
 
   def link_to_publication(publication, options={}, html_options = nil)
     url = {:controller => 'publications', :action => 'show', :id => publication}.merge(options)
@@ -77,17 +78,7 @@
     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 << link_to_authorship(authorship)
       s << "<br /><em>#{authorship.institution}</em></p>"
     end    
 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Mon Sep 19 17:28:32 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Mon Sep 19 17:29:17 2011 +0100
@@ -14,7 +14,7 @@
       <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>    
         <span class="handle">[drag to reorder]</span>
       <%- end -%>
-      <%= h authorship.name_on_paper %> <em><%= h authorship.institution %></em> <br />
+      <%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br />
     <%- end -%>
   <%- end -%>
 </ul>
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Mon Sep 19 17:28:32 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Mon Sep 19 17:29:17 2011 +0100
@@ -26,9 +26,9 @@
   label_authors_show: "Authorships associated with this author"
   label_authors_index: "List of authors"
   
-  field_authorship_publication_title: "Publication Title"
-  field_authorship_name: "Name"
-  field_authorship_email: "Email Address"
+  field_authorship_publication_title: "Publication"
+  field_authorship_name: "Name on Paper"
+  field_authorship_email: "Email"
   field_authorship_institution: "Institution"
   
   field_external_url: "External URL"
@@ -86,7 +86,7 @@
   field_publication_id: "Publication_id"
   field_address: "Address"
   field_annote: "Annote"
-  field_booktitle: "Book Title"
+  field_booktitle: "Title of Book or Proceedings"
   field_chapter: "Chapter"
   field_crossref: "Cross Reference"
   field_edition: "Edition"