summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-22 19:50:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-22 19:50:10 +0000
commit9131cdf6b91bb4585b341b54f6ddd6e7eb03d2e1 (patch)
treef3e72abeab2d2f29f4115625dce646b38f314b7b /app/helpers
parentfbf2646426f4531101c9cdde9bfcc075d185fc34 (diff)
downloadredmine-9131cdf6b91bb4585b341b54f6ddd6e7eb03d2e1.tar.gz
redmine-9131cdf6b91bb4585b341b54f6ddd6e7eb03d2e1.zip
Truncate comments on changeset list.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1900 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/repositories_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 1a82bb8ce..d41977d29 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -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 = ''