include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
end
+ # Truncates and returns the string as a single line
+ def truncate_single_line(string, *args)
+ truncate(string, *args).gsub(%r{[\r\n]+}m, ' ')
+ end
+
def html_hours(text)
text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
end
if project && (changeset = project.changesets.find_by_revision(oid))
link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
:class => 'changeset',
- :title => truncate(changeset.comments, 100))
+ :title => truncate_single_line(changeset.comments, 100))
end
elsif sep == '#'
oid = oid.to_i
end
when 'commit'
if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
- link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, :class => 'changeset', :title => truncate(changeset.comments, 100)
+ link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
+ :class => 'changeset',
+ :title => truncate_single_line(changeset.comments, 100)
end
when 'source', 'export'
if project && project.repository
link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
end
+ def format_activity_title(text)
+ h(truncate_single_line(text, 100))
+ end
+
def format_activity_day(date)
date == Date.today ? l(:label_today).titleize : format_date(date)
end
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
- xml.title @title
+ xml.title 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 truncate_single_line(item.event_title, 100)
xml.link "rel" => "alternate", "href" => url
xml.id url
xml.updated item.event_datetime.xmlschema
<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 format_activity_title(e.event_title), e.event_url %></dt>
<dd><span class="description"><%= format_activity_description(e.event_description) %></span>
<span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd>
<% end -%>