From cf4651b6bb384eb6ebc6fea383ca483fdf1fb55a 2007-04-07 18:30:01 From: Jean-Philippe Lang Date: 2007-04-07 18:30:01 Subject: [PATCH] Added link_to_issue helper. git-svn-id: http://redmine.rubyforge.org/svn/trunk@431 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4d3c3d9..6bbf7ef 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -467,7 +467,7 @@ class ProjectsController < ApplicationController @events_by_day = {} unless params[:show_issues] == "0" - @project.issues.find(:all, :include => [:author, :status], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| + @project.issues.find(:all, :include => [:author], :conditions => ["#{Issue.table_name}.created_on>=? and #{Issue.table_name}.created_on<=?", @date_from, @date_to] ).each { |i| @events_by_day[i.created_on.to_date] ||= [] @events_by_day[i.created_on.to_date] << i } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b3f9810..14934a3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -50,6 +50,10 @@ module ApplicationHelper link_to user.display_name, :controller => 'account', :action => 'show', :id => user end + def link_to_issue(issue) + link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue + end + def image_to_function(name, function, html_options = {}) html_options.symbolize_keys! tag(:input, html_options.merge({ diff --git a/app/views/issues/_tooltip.rhtml b/app/views/issues/_tooltip.rhtml index d186322..de0330f 100644 --- a/app/views/issues/_tooltip.rhtml +++ b/app/views/issues/_tooltip.rhtml @@ -1,4 +1,4 @@ -<%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %>: <%=h issue.subject %>
+<%= link_to_issue issue %>: <%=h issue.subject %>

<%= l(:field_start_date) %>: <%= format_date(issue.start_date) %>
<%= l(:field_due_date) %>: <%= format_date(issue.due_date) %>
diff --git a/app/views/my/blocks/_calendar.rhtml b/app/views/my/blocks/_calendar.rhtml index fe0b1f8..fa83b4d 100644 --- a/app/views/my/blocks/_calendar.rhtml +++ b/app/views/my/blocks/_calendar.rhtml @@ -35,7 +35,7 @@ while day <= @date_to elsif day == i.due_date image_tag('arrow_to.png') end %> - <%= link_to "#{i.tracker.name} ##{i.id}", :controller => 'issues', :action => 'show', :id => i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %>
+ <%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %>
<% end %> <%= '' if day.cwday >= 7 and day!=@date_to %> diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index 315ed98..d5862b2 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -23,7 +23,7 @@ <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
  • <% if e.is_a? Issue %> - <%= e.created_on.strftime("%H:%M") %> <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %> (<%= e.status.name %>): <%=h e.subject %>
    + <%= e.created_on.strftime("%H:%M") %> <%= link_to_issue e %>: <%=h e.subject %>
    <%= e.author.name %> <% elsif e.is_a? News %> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_news)%>: <%= link_to h(e.title), :controller => 'news', :action => 'show', :id => e %>
    diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index 5f5659a..b6ed913 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -67,7 +67,7 @@ while day <= @date_to elsif day == i.due_date image_tag('arrow_to.png') end %> - <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i } %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> + <%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> <%= render :partial => "issues/tooltip", :locals => { :issue => i }%> diff --git a/app/views/projects/changelog.rhtml b/app/views/projects/changelog.rhtml index 9cebd40..51724f1 100644 --- a/app/views/projects/changelog.rhtml +++ b/app/views/projects/changelog.rhtml @@ -25,6 +25,6 @@