To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / plugins / redmine_bibliography / app / helpers / authors_helper.rb @ 1579:aba122ac2d40
History | View | Annotate | Download (591 Bytes)
| 1 |
module AuthorsHelper |
|---|---|
| 2 |
unloadable |
| 3 |
|
| 4 |
def render_author_publications(author) |
| 5 |
s = ""
|
| 6 |
pubs = [] |
| 7 |
|
| 8 |
author.publications.each do |pub|
|
| 9 |
pubs << link_to(pub.title, pub) |
| 10 |
end
|
| 11 |
|
| 12 |
if pubs.size < 3 |
| 13 |
s << '<nobr>' << pubs.join(', ') << '</nobr>' |
| 14 |
else
|
| 15 |
s << pubs.join(', ')
|
| 16 |
end
|
| 17 |
s |
| 18 |
end
|
| 19 |
|
| 20 |
|
| 21 |
# Generates a link to an author
|
| 22 |
# todo: test options
|
| 23 |
def link_to_author(author, options={}, html_options = nil) |
| 24 |
url = {:controller => 'authors', :action => 'show', :id => author}.merge(options)
|
| 25 |
link_to(h(author.name), url, html_options) |
| 26 |
end
|
| 27 |
|
| 28 |
end
|