Mercurial > hg > soundsoftware-site
comparison vendor/plugins/redmine_bibliography/app/helpers/my_helper.rb @ 535:dd9d9c0ff0f9 feature_36
created the helpers to display correctly the My Publications Authors and Projects.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 26 Jul 2011 18:25:14 +0100 |
parents | |
children | 999a6b3c4cd1 |
comparison
equal
deleted
inserted
replaced
534:cdec3eeaef7e | 535:dd9d9c0ff0f9 |
---|---|
1 module MyHelper | |
2 | |
3 def get_my_publications() | |
4 if not User.current.author.nil? | |
5 @my_publications = Publication.all(:include => :authors, :conditions => "authors.id = #{User.current.author.id}") | |
6 else | |
7 @my_publications = [] | |
8 end | |
9 end | |
10 | |
11 def render_publications_projects(publication) | |
12 s = "" | |
13 projs = [] | |
14 | |
15 publication.projects.each do |proj| | |
16 projs << link_to(proj.name, proj) | |
17 end | |
18 | |
19 if projs.size < 3 | |
20 s << '<nobr>' << projs.join(', ') << '</nobr>' | |
21 else | |
22 s << projs.join(', ') | |
23 end | |
24 | |
25 s | |
26 end | |
27 | |
28 def render_publications_authors(publication) | |
29 s = "" | |
30 auths = [] | |
31 | |
32 publication.authorships.each do |auth| | |
33 auths << h(auth.name_on_paper) | |
34 end | |
35 | |
36 if auths.size < 3 | |
37 s << '<nobr>' << auths.join(', ') << '</nobr>' | |
38 else | |
39 s << auths.join(', ') | |
40 end | |
41 s | |
42 end | |
43 | |
44 | |
45 end |