# HG changeset patch # User Chris Cannam # Date 1363084190 0 # Node ID 2101a7c906b3f5aa93acd053d34fa76c616d1e22 # Parent c212850aec6e5dff0be66cb1b229b3ad8da72165 Fix failure to truncate long descriptions without carriage returns in them correctly diff -r c212850aec6e -r 2101a7c906b3 app/models/project.rb --- a/app/models/project.rb Tue Mar 12 10:21:45 2013 +0000 +++ b/app/models/project.rb Tue Mar 12 10:29:50 2013 +0000 @@ -473,7 +473,7 @@ end # Returns a short description of the projects (first lines) - def short_description(length = 255) + def short_description(length = 200) ## The short description is used in lists, e.g. Latest projects, ## My projects etc. It should be no more than a line or two with @@ -488,7 +488,7 @@ ## follows _any_ non-blank text, and to the next word break beyond ## "length" characters if the result is still longer than that. ## - description.gsub(/![^\s]+!/, '').gsub(/^(\s*[^\n\r]*).*$/m, '\1').gsub(/^(.{#{length}}\b).*$/m, '\1 ...').strip if description + description.gsub(/![^\s]+!/, '').gsub(/^(\s*[^\n\r]*).*$/m, '\1').gsub(/^(.{#{length}}[^\.;:,-]*).*$/m, '\1 ...').strip if description end def css_classes