@@ -263,6 +263,16 module ApplicationHelper | |||||
263 | def truncate_single_line(string, *args) |
|
263 | def truncate_single_line(string, *args) | |
264 | truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') |
|
264 | truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') | |
265 | end |
|
265 | end | |
|
266 | ||||
|
267 | # Truncates at line break after 250 characters or options[:length] | |||
|
268 | def truncate_lines(string, options={}) | |||
|
269 | length = options[:length] || 250 | |||
|
270 | if string.to_s =~ /\A(.{#{length}}.*?)$/m | |||
|
271 | "#{$1}..." | |||
|
272 | else | |||
|
273 | string | |||
|
274 | end | |||
|
275 | end | |||
266 |
|
276 | |||
267 | def html_hours(text) |
|
277 | def html_hours(text) | |
268 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') |
|
278 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') |
@@ -1,3 +1,6 | |||||
1 |
< |
|
1 | <h4><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %></h4> | |
2 | <% unless document.description.blank? %><%=h(truncate(document.description, :length => 250)) %><br /><% end %> |
|
2 | <p><em><%= format_time(document.updated_on) %></em></p> | |
3 | <em><%= format_time(document.updated_on) %></em></p> No newline at end of file |
|
3 | ||
|
4 | <div class="wiki"> | |||
|
5 | <%= textilizable(truncate_lines(document.description)) %> | |||
|
6 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now