tracker filter added on change log

git-svn-id: http://redmine.rubyforge.org/svn/trunk@18 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2006-07-30 12:55:29 +00:00
parent 18ee1fef41
commit 6b08e1b315
2 changed files with 36 additions and 14 deletions

View File

@ -276,18 +276,27 @@ class ProjectsController < ApplicationController
@versions = @project.versions
end
# Show changelog of @project
# Show changelog for @project
def changelog
@trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
if request.get?
@selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
else
@selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
end
@selected_tracker_ids ||= []
@fixed_issues = @project.issues.find(:all,
:include => [ :fixed_version, :status, :tracker ],
:conditions => [ "issue_statuses.is_closed=? and trackers.is_in_chlog=? and issues.fixed_version_id is not null", true, true]
)
:include => [ :fixed_version, :status, :tracker ],
:conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
:order => "versions.effective_date DESC, issues.id DESC"
) unless @selected_tracker_ids.empty?
@fixed_issues ||= []
end
private
# Find project of id params[:id]
# if not found, redirect to project list
# used as a before_filter
# Used as a before_filter
def find_project
@project = Project.find(params[:id])
rescue

View File

@ -1,12 +1,25 @@
<h2><%=l(:label_change_log)%></h2>
<% fixed_issues = @fixed_issues.group_by {|i| i.fixed_version } %>
<% fixed_issues.each do |version, issues| %>
<p><strong><%= version.name %></strong> - <%= format_date(version.effective_date) %><br />
<%=h version.description %></p>
<ul>
<% issues.each do |i| %>
<li><%= link_to i.long_id, :controller => 'issues', :action => 'show', :id => i %> [<%= i.tracker.name %>]: <%= i.subject %></li>
<% end %>
</ul>
<%= start_form_tag %>
<% @trackers.each do |tracker| %>
<%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>
<%= tracker.name %>
<% end %>
&nbsp;&nbsp;<%= submit_tag l(:button_apply), :class => 'button-small' %>
<%= end_form_tag %>
<p>&nbsp;</p>
<% ver_id = nil
@fixed_issues.each do |issue| %>
<% unless ver_id == issue.fixed_version_id %>
<% if ver_id %></ul><% end %>
<p><strong><%= issue.fixed_version.name %></strong> - <%= format_date(issue.fixed_version.effective_date) %><br />
<%=h issue.fixed_version.description %></p>
<ul>
<% ver_id = issue.fixed_version_id
end %>
<li><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %> [<%= issue.tracker.name %>]: <%= issue.subject %></li>
<% end %>