changeset 541:c3abeb11bc2e feature_36

Addresses Issus #224 - separates the projects in a project list using commas.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 28 Jul 2011 15:04:24 +0100
parents 951fcb1711f2
children 23a9272bf766
files vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Wed Jul 27 19:12:20 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Thu Jul 28 15:04:24 2011 +0100
@@ -61,6 +61,23 @@
     str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}"
     str.to_sym
   end
+  
+  def render_projects_list(publication)
+    s = ""
+    projs = []
+    
+    publication.projects.each do |proj|
+      projs << link_to_project(proj)
+    end
+    
+    if projs.size < 3
+      s << '<nobr>' << projs.join(', ') << '</nobr>'
+    else
+      s << projs.join(', ')
+    end
+    s
+  end
+  
 
 end
 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb	Wed Jul 27 19:12:20 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_list_projects.html.erb	Thu Jul 28 15:04:24 2011 +0100
@@ -1,3 +1,1 @@
-<% @publication.projects.each do |proj| %>
-  <%= link_to_project proj %>
-<% end %>
\ No newline at end of file
+<%= render_projects_list(@publication) %>
\ No newline at end of file