]> source.dussan.org Git - redmine.git/commitdiff
Truncate comments on changeset list.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 22 Sep 2008 19:50:10 +0000 (19:50 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 22 Sep 2008 19:50:10 +0000 (19:50 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1900 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/repositories_helper.rb
app/views/repositories/_revisions.rhtml

index 1a82bb8ce1a8c1aa42e7514517b578ee0d20506c..d41977d29e31777df1bf55e456384bc99913eacb 100644 (file)
@@ -22,6 +22,12 @@ module RepositoriesHelper
     txt.to_s[0,8]
   end
   
+  def truncate_at_line_break(text, length = 255)
+    if text
+      text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...')
+    end
+  end
+  
   def render_properties(properties)
     unless properties.nil? || properties.empty?
       content = ''
index a938fecb8945239b6913817929eaabcf56d42862..d8ca8007af94b3fc471fe94b942acd1a75fdfcfa 100644 (file)
@@ -18,7 +18,7 @@
 <td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
 <td class="committed_on"><%= format_time(changeset.committed_on) %></td>
 <td class="author"><%=h changeset.committer.to_s.split('<').first %></td>
-<td class="comments"><%= textilizable(changeset.comments) %></td>
+<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
 </tr>
 <% line_num += 1 %>
 <% end %>