luis@1126: # -*- coding: utf-8 -*- luis@328: module AuthorshipsHelper chris@702: chris@702: # Generates a link to either author or user, depending on which is chris@702: # available chris@702: def link_to_authorship(authorship) chris@702: s = '' chris@702: if authorship.author.nil? chris@702: # legacy reasons… chris@702: s << h(authorship.name_on_paper) chris@702: else luis@1126: if authorship.author.user.nil? chris@702: s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author) chris@702: else chris@702: s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user) chris@702: end chris@702: end luis@1325: s.html_safe chris@702: end chris@702: luis@328: end luis@1317: luis@1317: