annotate plugins/redmine_bibliography/app/helpers/authors_helper.rb @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents b4b72f1eb644
children
rev   line source
luis@328 1 module AuthorsHelper
luis@540 2 unloadable
luis@540 3
luis@540 4 def render_author_publications(author)
luis@540 5 s = ""
luis@540 6 pubs = []
luis@540 7
luis@540 8 author.publications.each do |pub|
luis@540 9 pubs << link_to(pub.title, pub)
luis@540 10 end
luis@540 11
luis@540 12 if pubs.size < 3
luis@540 13 s << '<nobr>' << pubs.join(', ') << '</nobr>'
luis@540 14 else
luis@540 15 s << pubs.join(', ')
luis@540 16 end
luis@540 17 s
luis@540 18 end
luis@540 19
luis@612 20
luis@612 21 # Generates a link to an author
luis@612 22 # todo: test options
luis@612 23 def link_to_author(author, options={}, html_options = nil)
luis@612 24 url = {:controller => 'authors', :action => 'show', :id => author}.merge(options)
luis@612 25 link_to(h(author.name), url, html_options)
luis@612 26 end
luis@612 27
luis@328 28 end