mirror of
				https://github.com/redmine/redmine.git
				synced 2025-10-31 10:25:55 +01:00 
			
		
		
		
	added the ability to set the sort order for trackers
git-svn-id: http://redmine.rubyforge.org/svn/trunk@209 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
		| @@ -47,7 +47,7 @@ class CustomFieldsController < ApplicationController | |||||||
|       flash[:notice] = l(:notice_successful_create) |       flash[:notice] = l(:notice_successful_create) | ||||||
|       redirect_to :action => 'list', :tab => @custom_field.type |       redirect_to :action => 'list', :tab => @custom_field.type | ||||||
|     end |     end | ||||||
|     @trackers = Tracker.find(:all) |     @trackers = Tracker.find(:all, :order => 'position') | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def edit |   def edit | ||||||
| @@ -59,7 +59,7 @@ class CustomFieldsController < ApplicationController | |||||||
|       flash[:notice] = l(:notice_successful_update) |       flash[:notice] = l(:notice_successful_update) | ||||||
|       redirect_to :action => 'list', :tab => @custom_field.type |       redirect_to :action => 'list', :tab => @custom_field.type | ||||||
|     end |     end | ||||||
|     @trackers = Tracker.find(:all) |     @trackers = Tracker.find(:all, :order => 'position') | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def destroy |   def destroy | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ class ProjectsController < ApplicationController | |||||||
|     @members = @project.members.find(:all, :include => [:user, :role]) |     @members = @project.members.find(:all, :include => [:user, :role]) | ||||||
|     @subprojects = @project.children if @project.children.size > 0 |     @subprojects = @project.children if @project.children.size > 0 | ||||||
|     @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC") |     @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC") | ||||||
|     @trackers = Tracker.find(:all) |     @trackers = Tracker.find(:all, :order => 'position') | ||||||
|     @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false]) |     @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false]) | ||||||
|     @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) |     @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id]) | ||||||
|   end |   end | ||||||
| @@ -245,7 +245,7 @@ class ProjectsController < ApplicationController | |||||||
|   						:limit  =>  @issue_pages.items_per_page, |   						:limit  =>  @issue_pages.items_per_page, | ||||||
|   						:offset =>  @issue_pages.current.offset						 |   						:offset =>  @issue_pages.current.offset						 | ||||||
|     end     |     end     | ||||||
|     @trackers = Tracker.find :all |     @trackers = Tracker.find :all, :order => 'position' | ||||||
|     render :layout => false if request.xhr? |     render :layout => false if request.xhr? | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -404,7 +404,7 @@ class ProjectsController < ApplicationController | |||||||
|    |    | ||||||
|   # Show changelog for @project |   # Show changelog for @project | ||||||
|   def changelog |   def changelog | ||||||
|     @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true]) |     @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') | ||||||
|     if request.get? |     if request.get? | ||||||
|       @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } |       @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } | ||||||
|     else |     else | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ class ReportsController < ApplicationController | |||||||
|     case params[:detail] |     case params[:detail] | ||||||
|     when "tracker" |     when "tracker" | ||||||
|       @field = "tracker_id" |       @field = "tracker_id" | ||||||
|       @rows = Tracker.find :all |       @rows = Tracker.find :all, :order => 'position' | ||||||
|       @data = issues_by_tracker |       @data = issues_by_tracker | ||||||
|       @report_title = l(:field_tracker) |       @report_title = l(:field_tracker) | ||||||
|       render :template => "reports/issue_report_details" |       render :template => "reports/issue_report_details" | ||||||
| @@ -49,7 +49,7 @@ class ReportsController < ApplicationController | |||||||
|       render :template => "reports/issue_report_details"   |       render :template => "reports/issue_report_details"   | ||||||
|     else |     else | ||||||
|       @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] |       @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] | ||||||
|       @trackers = Tracker.find(:all) |       @trackers = Tracker.find(:all, :order => 'position') | ||||||
|       @priorities = Enumeration::get_values('IPRI') |       @priorities = Enumeration::get_values('IPRI') | ||||||
|       @categories = @project.issue_categories |       @categories = @project.issue_categories | ||||||
|       @authors = @project.members.collect { |m| m.user } |       @authors = @project.members.collect { |m| m.user } | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ class RolesController < ApplicationController | |||||||
|       end |       end | ||||||
|     end |     end | ||||||
|     @roles = Role.find(:all, :order => 'position') |     @roles = Role.find(:all, :order => 'position') | ||||||
|     @trackers = Tracker.find :all |     @trackers = Tracker.find(:all, :order => 'position') | ||||||
|     @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position') |     @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position') | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ class TrackersController < ApplicationController | |||||||
|   verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list } |   verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list } | ||||||
|  |  | ||||||
|   def list |   def list | ||||||
|     @tracker_pages, @trackers = paginate :trackers, :per_page => 10 |     @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position' | ||||||
|     render :action => "list", :layout => false if request.xhr? |     render :action => "list", :layout => false if request.xhr? | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -47,7 +47,22 @@ class TrackersController < ApplicationController | |||||||
|       redirect_to :action => 'list' |       redirect_to :action => 'list' | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   def move | ||||||
|  |     @tracker = Tracker.find(params[:id]) | ||||||
|  |     case params[:position] | ||||||
|  |     when 'highest' | ||||||
|  |       @tracker.move_to_top | ||||||
|  |     when 'higher' | ||||||
|  |       @tracker.move_higher | ||||||
|  |     when 'lower' | ||||||
|  |       @tracker.move_lower | ||||||
|  |     when 'lowest' | ||||||
|  |       @tracker.move_to_bottom | ||||||
|  |     end if params[:position] | ||||||
|  |     redirect_to :action => 'list' | ||||||
|  |   end | ||||||
|  |    | ||||||
|   def destroy |   def destroy | ||||||
|     @tracker = Tracker.find(params[:id]) |     @tracker = Tracker.find(params[:id]) | ||||||
|     unless @tracker.issues.empty? |     unless @tracker.issues.empty? | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ class Query < ActiveRecord::Base | |||||||
|   def available_filters |   def available_filters | ||||||
|     return @available_filters if @available_filters |     return @available_filters if @available_filters | ||||||
|     @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },        |     @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },        | ||||||
|                            "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } },                                                                                                                 |                            "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },                                                                                                                 | ||||||
|                            "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } }, |                            "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } }, | ||||||
|                            "subject" => { :type => :text, :order => 8 },   |                            "subject" => { :type => :text, :order => 8 },   | ||||||
|                            "created_on" => { :type => :date_past, :order => 9 },                         |                            "created_on" => { :type => :date_past, :order => 9 },                         | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ class Tracker < ActiveRecord::Base | |||||||
|   has_many :issues |   has_many :issues | ||||||
|   has_many :workflows, :dependent => :delete_all |   has_many :workflows, :dependent => :delete_all | ||||||
|   has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id' |   has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id' | ||||||
|  |   acts_as_list | ||||||
|  |  | ||||||
|   validates_presence_of :name |   validates_presence_of :name | ||||||
|   validates_uniqueness_of :name |   validates_uniqueness_of :name | ||||||
|   | |||||||
| @@ -7,12 +7,19 @@ | |||||||
| <table class="list"> | <table class="list"> | ||||||
|   <thead><tr> |   <thead><tr> | ||||||
|   <th><%=l(:label_tracker)%></th> |   <th><%=l(:label_tracker)%></th> | ||||||
|  |   <th><%=l(:button_sort)%></th> | ||||||
|   <th></th> |   <th></th> | ||||||
|   </tr></thead> |   </tr></thead> | ||||||
|   <tbody> |   <tbody> | ||||||
| <% for tracker in @trackers %> | <% for tracker in @trackers %> | ||||||
|   <tr class="<%= cycle("odd", "even") %>"> |   <tr class="<%= cycle("odd", "even") %>"> | ||||||
|   <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td> |   <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td> | ||||||
|  |   <td align="center"> | ||||||
|  |     <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => tracker, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> | ||||||
|  |     <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => tracker, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - | ||||||
|  |     <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => tracker, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> | ||||||
|  |     <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => tracker, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> | ||||||
|  |   </td> | ||||||
|   <td align="center"> |   <td align="center"> | ||||||
|     <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %> |     <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %> | ||||||
|   </td> |   </td> | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								db/migrate/021_add_tracker_position.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								db/migrate/021_add_tracker_position.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | class AddTrackerPosition < ActiveRecord::Migration | ||||||
|  |   def self.up | ||||||
|  |     add_column :trackers, :position, :integer, :default => 1, :null => false | ||||||
|  |     Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)} | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   def self.down | ||||||
|  |     remove_column :trackers, :position | ||||||
|  |   end | ||||||
|  | end | ||||||
| @@ -11,7 +11,7 @@ http://redmine.rubyforge.org/ | |||||||
| * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used) | * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used) | ||||||
| * mail notifications added when a document, a file or an attachment is added | * mail notifications added when a document, a file or an attachment is added | ||||||
| * tooltips added on Gantt chart and calender to view the details of the issues | * tooltips added on Gantt chart and calender to view the details of the issues | ||||||
| * ability to set the sort order for roles, issue statuses | * ability to set the sort order for roles, trackers, issue statuses | ||||||
| * added missing fields to csv export: priority, start date, due date, done ratio | * added missing fields to csv export: priority, start date, due date, done ratio | ||||||
| * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-) | * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-) | ||||||
| * added back "fixed version" field on issue screen and in filters | * added back "fixed version" field on issue screen and in filters | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user