Refactoring ApplicationHelper#link_to_issue.

Now displays issue subject by default.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3040 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-11-14 12:53:50 +00:00
1 parent dfd0204052
commit cbeeaa4d4d
12 files changed
+35 -14

No files matched your search

+22 -2
View File
@@ -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.