diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6fca5ea7c1efe3da681ea43190682bb01b87e97f..cfc7717d531df8cbc0bcad1796a4cc22e5098102 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 eb163e7c01fbbb6668c08b02f27d040504ffebcb..0f28cc064cfeb8de74a327fbaff1c801c1cf20de 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)}<br /><br />" + + link_to_issue(issue) + "<br /><br />" + "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" + "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />" + "<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" + diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index 01dcbb4738f4dfaeba57e433c8e352bdc47161a5..e8fff8cbdb4aea95938080961e85364af33f1298 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 d8a7f408853ad33cc7e08a5139184fca88f369cd..af525c870c11deef27c399fe745df039dc7aae11 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 %> <span class="tip"><%= render_issue_tooltip i %></span> </div> <% else %> diff --git a/app/views/issues/_relations.rhtml b/app/views/issues/_relations.rhtml index 6f02d19375b21c10b5fc6e3480826f27ab18f2e0..135bfa68130d354b00580fb5db1f3681e2602178 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| %> <tr> <td><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %> - <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %> <%= link_to_issue relation.other_issue(@issue) %></td> -<td><%=h relation.other_issue(@issue).subject %></td> + <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %> + <%= link_to_issue relation.other_issue(@issue) %> +</td> <td><%= relation.other_issue(@issue).status.name %></td> <td><%= format_date(relation.other_issue(@issue).start_date) %></td> <td><%= format_date(relation.other_issue(@issue).due_date) %></td> diff --git a/app/views/issues/gantt.rhtml b/app/views/issues/gantt.rhtml index 6dc4e7a4b3b4e0a7fc6c8cc7988a04ea4b345ef0..ce317ea80e42e0108e1fdfdd9d39e9e206125b97 100644 --- a/app/views/issues/gantt.rhtml +++ b/app/views/issues/gantt.rhtml @@ -83,7 +83,7 @@ top = headers_height + 8 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small> <% if i.is_a? Issue %> <%= h("#{i.project} -") unless @project && @project == i.project %> - <%= link_to_issue i %>: <%=h i.subject %> + <%= link_to_issue i %> <% else %> <span class="icon icon-package"> <%= h("#{i.project} -") unless @project && @project == i.project %> diff --git a/app/views/my/blocks/_timelog.rhtml b/app/views/my/blocks/_timelog.rhtml index ca66f7ee46d57d2b1d27c3a13f149b9622d54d44..95679b20705dfeadcf42a3b1f7b6e015efd8dcfd 100644 --- a/app/views/my/blocks/_timelog.rhtml +++ b/app/views/my/blocks/_timelog.rhtml @@ -31,7 +31,7 @@ entries_by_day = entries.group_by(&:spent_on) <% entries_by_day[day].each do |entry| -%> <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;"> <td class="activity"><%=h entry.activity %></td> - <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :title => h("#{entry.issue.subject} (#{entry.issue.status})")) if entry.issue %></td> + <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td> <td class="comments"><%=h entry.comments %></td> <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td> <td align="center"> diff --git a/app/views/projects/changelog.rhtml b/app/views/projects/changelog.rhtml index e44d1d1eed2988f5c8cbed1ddc662ce5e0cb969f..355a3034a68942ad008530f850e367e965d19b2a 100644 --- a/app/views/projects/changelog.rhtml +++ b/app/views/projects/changelog.rhtml @@ -19,7 +19,7 @@ <% if !issues.empty? %> <ul> <% issues.each do |issue| %> - <li><%= link_to_issue(issue) %>: <%=h issue.subject %></li> + <li><%= link_to_issue(issue) %></li> <% end %> </ul> <% end %> diff --git a/app/views/projects/roadmap.rhtml b/app/views/projects/roadmap.rhtml index bcba13abd22c88fa7be1a48b83e2f61272e4116b..cbad932df6d09a44d9aa8cdf6ff96c20fb3e7253 100644 --- a/app/views/projects/roadmap.rhtml +++ b/app/views/projects/roadmap.rhtml @@ -20,7 +20,7 @@ <fieldset class="related-issues"><legend><%= l(:label_related_issues) %></legend> <ul> <%- issues.each do |issue| -%> - <li><%= link_to_issue(issue) %>: <%=h issue.subject %></li> + <li><%= link_to_issue(issue) %></li> <%- end -%> </ul> </fieldset> diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index b7bda4530bf11dee27ee6ddb4fb44262c6b1c3c8..b205be37cacc417e9e41195f06db46888db282bd 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -30,7 +30,7 @@ <h3><%= l(:label_related_issues) %></h3> <ul> <% @changeset.issues.visible.each do |issue| %> - <li><%= link_to_issue issue %>: <%=h issue.subject %></li> + <li><%= link_to_issue issue %></li> <% end %> </ul> <% end %> diff --git a/app/views/timelog/_list.rhtml b/app/views/timelog/_list.rhtml index 019eda2ec18527d903daaf0af81bda5158e6f0d5..f6a1268dcaaa9b68ce01cbb0ba20c52ff7694393 100644 --- a/app/views/timelog/_list.rhtml +++ b/app/views/timelog/_list.rhtml @@ -20,7 +20,7 @@ <td class="project"><%=h entry.project %></td> <td class="subject"> <% if entry.issue -%> -<%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, :length => 50)) -%> +<%= link_to_issue entry.issue, :truncate => 50 -%> <% end -%> </td> <td class="comments"><%=h entry.comments %></td> diff --git a/app/views/versions/show.rhtml b/app/views/versions/show.rhtml index c98d5424fc2f2836c6e603e394d14b5f8ebf6aa5..5cea1abcb745bd595d2465475f9fcddb43bb492c 100644 --- a/app/views/versions/show.rhtml +++ b/app/views/versions/show.rhtml @@ -39,7 +39,7 @@ <fieldset class="related-issues"><legend><%= l(:label_related_issues) %></legend> <ul> <% issues.each do |issue| -%> - <li><%= link_to_issue(issue) %>: <%=h issue.subject %></li> + <li><%= link_to_issue(issue) %></li> <% end -%> </ul> </fieldset>