Patch #1356 ยป format_truncate_single_line.patch
app/helpers/projects_helper.rb Mon Jun 02 12:24:27 2008 +0200 โ app/helpers/projects_helper.rb Mon Jun 02 18:11:36 2008 +0200 | ||
---|---|---|
27 | 27 |
|
28 | 28 |
def format_activity_description(text) |
29 | 29 |
h(truncate(text, 250)) |
30 |
end |
|
31 | ||
32 |
## Return the first line, or the first max_length caracters of string |
|
33 |
def format_truncate_single_line(string, max_length) |
|
34 |
h(truncate(string,[(string.index("\n") ? string.index("\n") + 3 : max_length), |
|
35 |
max_length].min)) |
|
30 | 36 |
end |
31 | 37 |
|
32 | 38 |
def project_settings_tabs |
app/views/common/feed.atom.rxml Mon Jun 02 12:24:27 2008 +0200 โ app/views/common/feed.atom.rxml Mon Jun 02 18:11:36 2008 +0200 | ||
---|---|---|
1 | 1 |
xml.instruct! |
2 | 2 |
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
3 |
xml.title @title
|
|
3 |
xml.title format_truncate_single_line(@title, 100)
|
|
4 | 4 |
xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false})) |
5 | 5 |
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) |
6 | 6 |
xml.id url_for(:controller => 'welcome', :only_path => false) |
... | ... | |
10 | 10 |
@items.each do |item| |
11 | 11 |
xml.entry do |
12 | 12 |
url = url_for(item.event_url(:only_path => false)) |
13 |
xml.title truncate(item.event_title, 100)
|
|
13 |
xml.title format_truncate_single_line(item.event_title, 100)
|
|
14 | 14 |
xml.link "rel" => "alternate", "href" => url |
15 | 15 |
xml.id url |
16 | 16 |
xml.updated item.event_datetime.xmlschema |
app/views/projects/activity.rhtml Mon Jun 02 12:24:27 2008 +0200 โ app/views/projects/activity.rhtml Mon Jun 02 18:11:36 2008 +0200 | ||
---|---|---|
7 | 7 |
<dl> |
8 | 8 |
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> |
9 | 9 |
<dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span> |
10 |
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> <%= link_to h(truncate(e.event_title, 100)), e.event_url %></dt>
|
|
10 |
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> <%= link_to h(format_truncate_single_line(e.event_title, 100)), e.event_url %></dt>
|
|
11 | 11 |
<dd><% unless e.event_description.blank? -%> |
12 | 12 |
<span class="description"><%= format_activity_description(e.event_description) %></span><br /> |
13 | 13 |
<% end %> |