Added link_to_issue helper.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@431 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-04-07 18:30:01 +00:00
parent 14314b77ee
commit cf4651b6bb
10 changed files with 14 additions and 11 deletions

View File

@ -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
}

View File

@ -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({

View File

@ -1,4 +1,4 @@
<%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %></strong>: <%=h issue.subject %><br />
<%= link_to_issue issue %></strong>: <%=h issue.subject %><br />
<br />
<strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br />
<strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br />

View File

@ -35,7 +35,7 @@ while day <= @date_to
elsif day == i.due_date
image_tag('arrow_to.png')
end %>
<small><%= link_to "#{i.tracker.name} ##{i.id}", :controller => 'issues', :action => 'show', :id => i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />
<small><%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />
<% end %>
</td>
<%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %>

View File

@ -23,7 +23,7 @@
<% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
<li><p>
<% 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 %><br />
<%= e.created_on.strftime("%H:%M") %> <%= link_to_issue e %>: <%=h e.subject %><br />
<i><%= e.author.name %></i>
<% 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 %><br />

View File

@ -67,7 +67,7 @@ while day <= @date_to
elsif day == i.due_date
image_tag('arrow_to.png')
end %>
<small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i } %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>
<small><%= link_to_issue i %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>
<span class="tip">
<%= render :partial => "issues/tooltip", :locals => { :issue => i }%>
</span>

View File

@ -25,6 +25,6 @@
<ul>
<% ver_id = issue.fixed_version_id
end %>
<li><%= link_to "#{issue.tracker.name} #{issue.id}", :controller => 'issues', :action => 'show', :id => issue %>: <%=h issue.subject %></li>
<li><%= link_to_issue issue %>: <%=h issue.subject %></li>
<% end %>
</div>

View File

@ -86,7 +86,7 @@ top = headers_height + 8
@events.each do |i| %>
<div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
<% if i.is_a? Issue %>
<%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>:
<%= link_to_issue i %>:
<%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %>
<% else %>
<strong><%= "#{l(:label_version)}: #{i.name}" %></strong>

View File

@ -48,9 +48,8 @@
<% else %>
<% issues.each do |issue| %>
<li>
<%= link = link_to("#{issue.tracker.name} ##{issue.id}", :controller => 'issues', :action => 'show', :id => issue)
issue.status.is_closed? ? content_tag("del", link) : link %>
: <%=h issue.subject %>
<%= link = link_to_issue(issue)
issue.status.is_closed? ? content_tag("del", link) : link %>: <%=h issue.subject %>
<%= content_tag "em", "(#{l(:label_closed_issues)})" if issue.status.is_closed? %>
</li>
<% end %>

View File

@ -24,7 +24,7 @@
<% @results.each do |e| %>
<li><p>
<% if e.is_a? Issue %>
<%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %>: <%= highlight_tokens(h(e.subject), @tokens) %><br />
<%= link_to_issue e %>: <%= highlight_tokens(h(e.subject), @tokens) %><br />
<%= highlight_tokens(e.description, @tokens) %><br />
<i><%= e.author.name %>, <%= format_time(e.created_on) %></i>
<% elsif e.is_a? News %>