Mercurial > hg > soundsoftware-site
comparison plugins/redmine_bibliography/lib/bibliography/my_helper_patch.rb @ 1520:a1bdbf8a87d5 redmine-2.5-integration
Merge from branch "redmine-2.4-integration"
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 10:02:18 +0100 |
parents | e0167f4e1d8a |
children |
comparison
equal
deleted
inserted
replaced
1517:dffacf8a6908 | 1520:a1bdbf8a87d5 |
---|---|
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 |