view vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb @ 702:3eb64cb3c7ac feature_36

Link authorships from publications detail page as well as publications list. Also minor text update
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Mon, 19 Sep 2011 17:00:35 +0100
parents aed18b463206
children
line wrap: on
line source
# -*- 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