view vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb @ 1094:9b7f99b7cb14 bibplugin_bibtex

cleaned some code, fixes a couple of issues.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 28 Nov 2012 19:32:31 +0000
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