diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6fca5ea7c..cfc7717d5 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -58,9 +58,29 @@ module ApplicationHelper
end
end
+ # Displays a link to +issue+ with its subject.
+ # Examples:
+ #
+ # link_to_issue(issue) # => Defect #6: This is the subject
+ # link_to_issue(issue, :truncate => 6) # => Defect #6: This i...
+ # link_to_issue(issue, :subject => false) # => Defect #6
+ #
def link_to_issue(issue, options={})
- options[:class] ||= issue.css_classes
- link_to "#{issue.tracker.name} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, options
+ title = nil
+ subject = nil
+ if options[:subject] == false
+ title = truncate(issue.subject, :length => 60)
+ else
+ subject = issue.subject
+ if options[:truncate]
+ subject = truncate(subject, :length => options[:truncate])
+ end
+ end
+ s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue},
+ :class => issue.css_classes,
+ :title => title
+ s << ": #{h subject}" if subject
+ s
end
# Generates a link to an attachment.
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index eb163e7c0..0f28cc064 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -24,7 +24,7 @@ module IssuesHelper
@cached_label_assigned_to ||= l(:field_assigned_to)
@cached_label_priority ||= l(:field_priority)
- link_to_issue(issue) + ": #{h(issue.subject)}
" +
+ link_to_issue(issue) + "
" +
"#{@cached_label_start_date}: #{format_date(issue.start_date)}
" +
"#{@cached_label_due_date}: #{format_date(issue.due_date)}
" +
"#{@cached_label_assigned_to}: #{issue.assigned_to}
" +
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 01dcbb473..e8fff8cbd 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -22,7 +22,7 @@ module TimelogHelper
links = []
links << link_to(l(:label_project_all), {:project_id => nil, :issue_id => nil})
links << link_to(h(@project), {:project_id => @project, :issue_id => nil}) if @project
- links << link_to_issue(@issue) if @issue
+ links << link_to_issue(@issue, :subject => false) if @issue
breadcrumb links
end
diff --git a/app/views/common/_calendar.rhtml b/app/views/common/_calendar.rhtml
index d8a7f4088..af525c870 100644
--- a/app/views/common/_calendar.rhtml
+++ b/app/views/common/_calendar.rhtml
@@ -20,7 +20,7 @@ while day <= calendar.enddt %>
image_tag('arrow_to.png')
end %>
<%= h("#{i.project} -") unless @project && @project == i.project %>
- <%= link_to_issue i %>: <%= h(truncate(i.subject, :length => 30)) %>
+ <%= link_to_issue i, :truncate => 30 %>
<%= render_issue_tooltip i %>
<% else %>
diff --git a/app/views/issues/_relations.rhtml b/app/views/issues/_relations.rhtml
index 6f02d1937..135bfa681 100644
--- a/app/views/issues/_relations.rhtml
+++ b/app/views/issues/_relations.rhtml
@@ -11,8 +11,9 @@
<% @issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation| %>