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 | ||
|---|---|---|
|
|
||
|
def format_activity_description(text)
|
||
|
h(truncate(text, 250))
|
||
|
end
|
||
|
## Return the first line, or the first max_length caracters of string
|
||
|
def format_truncate_single_line(string, max_length)
|
||
|
h(truncate(string,[(string.index("\n") ? string.index("\n") + 3 : max_length),
|
||
|
max_length].min))
|
||
|
end
|
||
|
|
||
|
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 | ||
|---|---|---|
|
xml.instruct!
|
||
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||
|
xml.title @title
|
||
|
xml.title format_truncate_single_line(@title, 100)
|
||
|
xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false}))
|
||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
||
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||
| ... | ... | |
|
@items.each do |item|
|
||
|
xml.entry do
|
||
|
url = url_for(item.event_url(:only_path => false))
|
||
|
xml.title truncate(item.event_title, 100)
|
||
|
xml.title format_truncate_single_line(item.event_title, 100)
|
||
|
xml.link "rel" => "alternate", "href" => url
|
||
|
xml.id url
|
||
|
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 | ||
|---|---|---|
|
<dl>
|
||
|
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
||
|
<dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
|
||
|
<%= 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>
|
||
|
<%= 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>
|
||
|
<dd><% unless e.event_description.blank? -%>
|
||
|
<span class="description"><%= format_activity_description(e.event_description) %></span><br />
|
||
|
<% end %>
|
||