1. Unofficial Redmine Clones
  2. Untitled project
  3. redmine

Commits

jplang  committed e22e71c

tracker filter added on change log

  • Participants
  • Parent commits 72bbdd4
  • Branches default

Comments (0)

Files changed (2)

File redmine/app/controllers/projects_controller.rb

View file
     @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

File redmine/app/views/projects/changelog.rhtml

View file
 <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 %>
+