# HG changeset patch # User Chris Cannam # Date 1295275629 0 # Node ID 7c628fc7e91d5c98b53fcb9c2c8c88bcdd29dfe9 # Parent 5abca449316300a25e1f3d24d5bb19a2e2400029 Make project descriptions briefer on the projects list, and ensure that images &c are removed from them diff -r 5abca4493163 -r 7c628fc7e91d app/models/project.rb --- a/app/models/project.rb Mon Jan 17 13:37:10 2011 +0000 +++ b/app/models/project.rb Mon Jan 17 14:47:09 2011 +0000 @@ -438,7 +438,14 @@ # Returns a short description of the projects (first lines) def short_description(length = 255) - description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + ## Original Redmine code: this truncates to the CR that is more + ## than "length" characters from the start. + # description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + ## That's too much for us, and also we want to omit images and the + ## like. Truncate instead to the first CR that 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 end def css_classes