From 6b08e1b3155ea56f12a00261effed78a9ef43917 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 30 Jul 2006 12:55:29 +0000 Subject: [PATCH] tracker filter added on change log git-svn-id: http://redmine.rubyforge.org/svn/trunk@18 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../app/controllers/projects_controller.rb | 19 +++++++++--- redmine/app/views/projects/changelog.rhtml | 31 +++++++++++++------ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 0f8f19422..2bfb841d6 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -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 diff --git a/redmine/app/views/projects/changelog.rhtml b/redmine/app/views/projects/changelog.rhtml index c3c7bb604..fc9d2beba 100644 --- a/redmine/app/views/projects/changelog.rhtml +++ b/redmine/app/views/projects/changelog.rhtml @@ -1,12 +1,25 @@

<%=l(:label_change_log)%>

-<% fixed_issues = @fixed_issues.group_by {|i| i.fixed_version } %> -<% fixed_issues.each do |version, issues| %> -

<%= version.name %> - <%= format_date(version.effective_date) %>
- <%=h version.description %>

- + +<%= 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 %> +  <%= submit_tag l(:button_apply), :class => 'button-small' %> +<%= end_form_tag %> + +

 

+ +<% ver_id = nil + @fixed_issues.each do |issue| %> + <% unless ver_id == issue.fixed_version_id %> + <% if ver_id %><% end %> +

<%= issue.fixed_version.name %> - <%= format_date(issue.fixed_version.effective_date) %>
+ <%=h issue.fixed_version.description %>

+