##// END OF EJS Templates
Fixed: changesets titles should not be multiline in atom feeds (#1356)....
Jean-Philippe Lang -
r1477:4db45b8ceddf
parent child
Show More
@@ -90,6 +90,11 module ApplicationHelper
90 90 include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
91 91 end
92 92
93 # Truncates and returns the string as a single line
94 def truncate_single_line(string, *args)
95 truncate(string, *args).gsub(%r{[\r\n]+}m, ' ')
96 end
97
93 98 def html_hours(text)
94 99 text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
95 100 end
@@ -301,7 +306,7 module ApplicationHelper
301 306 if project && (changeset = project.changesets.find_by_revision(oid))
302 307 link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
303 308 :class => 'changeset',
304 :title => truncate(changeset.comments, 100))
309 :title => truncate_single_line(changeset.comments, 100))
305 310 end
306 311 elsif sep == '#'
307 312 oid = oid.to_i
@@ -340,7 +345,9 module ApplicationHelper
340 345 end
341 346 when 'commit'
342 347 if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
343 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)
348 link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
349 :class => 'changeset',
350 :title => truncate_single_line(changeset.comments, 100)
344 351 end
345 352 when 'source', 'export'
346 353 if project && project.repository
@@ -21,6 +21,10 module ProjectsHelper
21 21 link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
22 22 end
23 23
24 def format_activity_title(text)
25 h(truncate_single_line(text, 100))
26 end
27
24 28 def format_activity_day(date)
25 29 date == Date.today ? l(:label_today).titleize : format_date(date)
26 30 end
@@ -1,6 +1,6
1 1 xml.instruct!
2 2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3 xml.title @title
3 xml.title 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,7 +10,7 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
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 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
@@ -7,7 +7,8
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 %>
11 <%= link_to format_activity_title(e.event_title), e.event_url %></dt>
11 12 <dd><span class="description"><%= format_activity_description(e.event_description) %></span>
12 13 <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd>
13 14 <% end -%>
General Comments 0
You need to be logged in to leave comments. Login now