view vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb @ 971:b80f97c892bc cannam

Merge from branch "get_statistics"
author Chris Cannam
date Fri, 19 Oct 2012 14:47:14 +0100
parents 3eb64cb3c7ac
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