# HG changeset patch # User luisf # Date 1316449757 -3600 # Node ID 0a34c4cb73d52f81e2a51efe66b82f3f4e74a3de # Parent b6f9f005c0b65df7952c9ad8a024fb4f3477163e# Parent 0435cf085f2895cd61772e0305cb4fec37e5da9f Merge from 703:0435cf085f28 diff -r b6f9f005c0b6 -r 0a34c4cb73d5 vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb --- 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 diff -r b6f9f005c0b6 -r 0a34c4cb73d5 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- 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 = '

' 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 << "
#{authorship.institution}

" end diff -r b6f9f005c0b6 -r 0a34c4cb73d5 vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb --- 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 -%> [drag to reorder] <%- end -%> - <%= h authorship.name_on_paper %> <%= h authorship.institution %>
+ <%= link_to_authorship authorship %> <%= h authorship.institution %>
<%- end -%> <%- end -%> diff -r b6f9f005c0b6 -r 0a34c4cb73d5 vendor/plugins/redmine_bibliography/config/locales/en.yml --- 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"