Commit 4dd43001 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Adds text formatting to documents index (#202).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3602 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent b5d9a1df
......@@ -263,6 +263,16 @@ module ApplicationHelper
def truncate_single_line(string, *args)
truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ')
end
# Truncates at line break after 250 characters or options[:length]
def truncate_lines(string, options={})
length = options[:length] || 250
if string.to_s =~ /\A(.{#{length}}.*?)$/m
"#{$1}..."
else
string
end
end
def html_hours(text)
text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
......
<p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br />
<% unless document.description.blank? %><%=h(truncate(document.description, :length => 250)) %><br /><% end %>
<em><%= format_time(document.updated_on) %></em></p>
\ No newline at end of file
<h4><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %></h4>
<p><em><%= format_time(document.updated_on) %></em></p>
<div class="wiki">
<%= textilizable(truncate_lines(document.description)) %>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment