@@ -90,6 +90,11 module ApplicationHelper | |||||
90 | include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) |
|
90 | include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) | |
91 | end |
|
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 | def html_hours(text) |
|
98 | def html_hours(text) | |
94 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') |
|
99 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') | |
95 | end |
|
100 | end | |
@@ -301,7 +306,7 module ApplicationHelper | |||||
301 | if project && (changeset = project.changesets.find_by_revision(oid)) |
|
306 | if project && (changeset = project.changesets.find_by_revision(oid)) | |
302 | link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, |
|
307 | link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, | |
303 | :class => 'changeset', |
|
308 | :class => 'changeset', | |
304 | :title => truncate(changeset.comments, 100)) |
|
309 | :title => truncate_single_line(changeset.comments, 100)) | |
305 | end |
|
310 | end | |
306 | elsif sep == '#' |
|
311 | elsif sep == '#' | |
307 | oid = oid.to_i |
|
312 | oid = oid.to_i | |
@@ -340,7 +345,9 module ApplicationHelper | |||||
340 | end |
|
345 | end | |
341 | when 'commit' |
|
346 | when 'commit' | |
342 | if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) |
|
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}, |
|
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 | end |
|
351 | end | |
345 | when 'source', 'export' |
|
352 | when 'source', 'export' | |
346 | if project && project.repository |
|
353 | if project && project.repository |
@@ -21,6 +21,10 module ProjectsHelper | |||||
21 | link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options |
|
21 | link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
|
24 | def format_activity_title(text) | |||
|
25 | h(truncate_single_line(text, 100)) | |||
|
26 | end | |||
|
27 | ||||
24 | def format_activity_day(date) |
|
28 | def format_activity_day(date) | |
25 | date == Date.today ? l(:label_today).titleize : format_date(date) |
|
29 | date == Date.today ? l(:label_today).titleize : format_date(date) | |
26 | end |
|
30 | end |
@@ -1,6 +1,6 | |||||
1 | xml.instruct! |
|
1 | xml.instruct! | |
2 | xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
|
2 | xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do | |
3 | xml.title @title |
|
3 | xml.title truncate_single_line(@title, 100) | |
4 | xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false})) |
|
4 | xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false})) | |
5 | xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) |
|
5 | xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) | |
6 | xml.id url_for(:controller => 'welcome', :only_path => false) |
|
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 | @items.each do |item| |
|
10 | @items.each do |item| | |
11 | xml.entry do |
|
11 | xml.entry do | |
12 | url = url_for(item.event_url(:only_path => false)) |
|
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 | xml.link "rel" => "alternate", "href" => url |
|
14 | xml.link "rel" => "alternate", "href" => url | |
15 | xml.id url |
|
15 | xml.id url | |
16 | xml.updated item.event_datetime.xmlschema |
|
16 | xml.updated item.event_datetime.xmlschema |
@@ -7,7 +7,8 | |||||
7 | <dl> |
|
7 | <dl> | |
8 | <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> |
|
8 | <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> | |
9 | <dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span> |
|
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 %> |
|
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 | <dd><span class="description"><%= format_activity_description(e.event_description) %></span> |
|
12 | <dd><span class="description"><%= format_activity_description(e.event_description) %></span> | |
12 | <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd> |
|
13 | <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd> | |
13 | <% end -%> |
|
14 | <% end -%> |
General Comments 0
You need to be logged in to leave comments.
Login now