view plugins/redmine_bibliography/app/helpers/authorships_helper.rb @ 1324:2e54ae6ab02f redmine-2.2-integration

Searches the projects (to which to add a publication to).
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 19 Jun 2013 18:17:33 +0100
parents 2805873c0147
children 4ef7df804bab
line wrap: on
line source
# -*- coding: utf-8 -*-
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