Mercurial > hg > soundsoftware-site
diff plugins/redmine_bibliography/app/helpers/authorships_helper.rb @ 1484:51364c0cd58f redmine-2.4-integration
Merge from live branch. Still need to merge manually in files overridden by plugins.
author | Chris Cannam |
---|---|
date | Wed, 15 Jan 2014 09:59:14 +0000 |
parents | 4ef7df804bab |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/redmine_bibliography/app/helpers/authorships_helper.rb Wed Jan 15 09:59:14 2014 +0000 @@ -0,0 +1,23 @@ +# -*- 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.html_safe + end + +end + +