Revision 724:b96d3005ee79 vendor/plugins/redmine_bibliography/app/helpers

View differences:

vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb
1
# -*- coding: undecided -*-
1 2
module AuthorshipsHelper
3

  
4
  # Generates a link to either author or user, depending on which is
5
  # available
6
  def link_to_authorship(authorship)
7
    s = ''
8
    if authorship.author.nil?
9
      # legacy reasons…
10
      s << h(authorship.name_on_paper)
11
    else
12
      if authorship.author.user.nil?      
13
        s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author)
14
      else
15
        s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user)
16
      end
17
    end
18
    s
19
  end
20

  
2 21
end
vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb
2 2
require 'bibtex'
3 3

  
4 4
module PublicationsHelper
5
  include AuthorshipsHelper
5 6

  
6 7
  def link_to_publication(publication, options={}, html_options = nil)
7 8
    url = {:controller => 'publications', :action => 'show', :id => publication}.merge(options)
......
77 78
    s = '<p>'
78 79
    
79 80
    publication.authorships.each do |authorship|
80
    
81
    if authorship.author.nil?
82
      # legacy reasons…
83
      s << h(authorship.name_on_paper)
84
    else
85
      if authorship.author.user.nil?      
86
        s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author)
87
      else
88
        s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user)
89
      end
90
    end
81
      s << link_to_authorship(authorship)
91 82
      s << "<br /><em>#{authorship.institution}</em></p>"
92 83
    end    
93 84

  

Also available in: Unified diff