To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / plugins / redmine_bibliography / lib / bibliography / my_helper_patch.rb @ 1402:5cb7eeccede1

History | View | Annotate | Download (1.02 KB)

1
module Bibliography
2
  module MyHelperPatch
3

    
4
    def self.included(base) # :nodoc:
5
      base.send(:include, InstanceMethods)
6

    
7
      base.class_eval do
8
        unloadable
9
      end
10
    end
11

    
12
    module InstanceMethods
13

    
14
      def get_my_publications()
15
        if not User.current.author.nil?
16
          @my_publications = Publication.all(:include => :authors, :conditions => "authors.id = #{User.current.author.id}")
17
        else
18
          @my_publications = []
19
        end
20
      end 
21

    
22
      def render_publications_projects(publication)    
23
        s = ""
24
        projs = []
25
        
26
        publication.projects.each do |proj|
27
          projs << link_to(proj.name, proj)
28
        end
29
        
30
        s << projs.join(', ')
31
        
32
        s.html_safe
33
      end
34

    
35
      def render_publications_authors(publication)    
36
        s = ""
37
        auths = []
38
        
39
        publication.authorships.each do |auth|
40
          auths << h(auth.name_on_paper)
41
        end
42
        
43
        s << auths.join(', ')
44

    
45
        s.html_safe
46
      end
47

    
48

    
49
    end
50
  end
51
end
52