##// END OF EJS Templates
added the ability to set the sort order for trackers...
Jean-Philippe Lang -
r206:fa688d48e673
parent child
Show More
@@ -0,0 +1,10
1 class AddTrackerPosition < ActiveRecord::Migration
2 def self.up
3 add_column :trackers, :position, :integer, :default => 1, :null => false
4 Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
5 end
6
7 def self.down
8 remove_column :trackers, :position
9 end
10 end
@@ -47,7 +47,7 class CustomFieldsController < ApplicationController
47 flash[:notice] = l(:notice_successful_create)
47 flash[:notice] = l(:notice_successful_create)
48 redirect_to :action => 'list', :tab => @custom_field.type
48 redirect_to :action => 'list', :tab => @custom_field.type
49 end
49 end
50 @trackers = Tracker.find(:all)
50 @trackers = Tracker.find(:all, :order => 'position')
51 end
51 end
52
52
53 def edit
53 def edit
@@ -59,7 +59,7 class CustomFieldsController < ApplicationController
59 flash[:notice] = l(:notice_successful_update)
59 flash[:notice] = l(:notice_successful_update)
60 redirect_to :action => 'list', :tab => @custom_field.type
60 redirect_to :action => 'list', :tab => @custom_field.type
61 end
61 end
62 @trackers = Tracker.find(:all)
62 @trackers = Tracker.find(:all, :order => 'position')
63 end
63 end
64
64
65 def destroy
65 def destroy
@@ -81,7 +81,7 class ProjectsController < ApplicationController
81 @members = @project.members.find(:all, :include => [:user, :role])
81 @members = @project.members.find(:all, :include => [:user, :role])
82 @subprojects = @project.children if @project.children.size > 0
82 @subprojects = @project.children if @project.children.size > 0
83 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
83 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
84 @trackers = Tracker.find(:all)
84 @trackers = Tracker.find(:all, :order => 'position')
85 @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])
85 @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])
86 @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
86 @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
87 end
87 end
@@ -245,7 +245,7 class ProjectsController < ApplicationController
245 :limit => @issue_pages.items_per_page,
245 :limit => @issue_pages.items_per_page,
246 :offset => @issue_pages.current.offset
246 :offset => @issue_pages.current.offset
247 end
247 end
248 @trackers = Tracker.find :all
248 @trackers = Tracker.find :all, :order => 'position'
249 render :layout => false if request.xhr?
249 render :layout => false if request.xhr?
250 end
250 end
251
251
@@ -404,7 +404,7 class ProjectsController < ApplicationController
404
404
405 # Show changelog for @project
405 # Show changelog for @project
406 def changelog
406 def changelog
407 @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
407 @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
408 if request.get?
408 if request.get?
409 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
409 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
410 else
410 else
@@ -25,7 +25,7 class ReportsController < ApplicationController
25 case params[:detail]
25 case params[:detail]
26 when "tracker"
26 when "tracker"
27 @field = "tracker_id"
27 @field = "tracker_id"
28 @rows = Tracker.find :all
28 @rows = Tracker.find :all, :order => 'position'
29 @data = issues_by_tracker
29 @data = issues_by_tracker
30 @report_title = l(:field_tracker)
30 @report_title = l(:field_tracker)
31 render :template => "reports/issue_report_details"
31 render :template => "reports/issue_report_details"
@@ -49,7 +49,7 class ReportsController < ApplicationController
49 render :template => "reports/issue_report_details"
49 render :template => "reports/issue_report_details"
50 else
50 else
51 @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
51 @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
52 @trackers = Tracker.find(:all)
52 @trackers = Tracker.find(:all, :order => 'position')
53 @priorities = Enumeration::get_values('IPRI')
53 @priorities = Enumeration::get_values('IPRI')
54 @categories = @project.issue_categories
54 @categories = @project.issue_categories
55 @authors = @project.members.collect { |m| m.user }
55 @authors = @project.members.collect { |m| m.user }
@@ -96,7 +96,7 class RolesController < ApplicationController
96 end
96 end
97 end
97 end
98 @roles = Role.find(:all, :order => 'position')
98 @roles = Role.find(:all, :order => 'position')
99 @trackers = Tracker.find :all
99 @trackers = Tracker.find(:all, :order => 'position')
100 @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
100 @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
101 end
101 end
102 end
102 end
@@ -28,7 +28,7 class TrackersController < ApplicationController
28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
29
29
30 def list
30 def list
31 @tracker_pages, @trackers = paginate :trackers, :per_page => 10
31 @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
32 render :action => "list", :layout => false if request.xhr?
32 render :action => "list", :layout => false if request.xhr?
33 end
33 end
34
34
@@ -48,6 +48,21 class TrackersController < ApplicationController
48 end
48 end
49 end
49 end
50
50
51 def move
52 @tracker = Tracker.find(params[:id])
53 case params[:position]
54 when 'highest'
55 @tracker.move_to_top
56 when 'higher'
57 @tracker.move_higher
58 when 'lower'
59 @tracker.move_lower
60 when 'lowest'
61 @tracker.move_to_bottom
62 end if params[:position]
63 redirect_to :action => 'list'
64 end
65
51 def destroy
66 def destroy
52 @tracker = Tracker.find(params[:id])
67 @tracker = Tracker.find(params[:id])
53 unless @tracker.issues.empty?
68 unless @tracker.issues.empty?
@@ -70,7 +70,7 class Query < ActiveRecord::Base
70 def available_filters
70 def available_filters
71 return @available_filters if @available_filters
71 return @available_filters if @available_filters
72 @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
72 @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
73 "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } },
73 "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
74 "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
74 "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
75 "subject" => { :type => :text, :order => 8 },
75 "subject" => { :type => :text, :order => 8 },
76 "created_on" => { :type => :date_past, :order => 9 },
76 "created_on" => { :type => :date_past, :order => 9 },
@@ -20,6 +20,7 class Tracker < ActiveRecord::Base
20 has_many :issues
20 has_many :issues
21 has_many :workflows, :dependent => :delete_all
21 has_many :workflows, :dependent => :delete_all
22 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
22 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
23 acts_as_list
23
24
24 validates_presence_of :name
25 validates_presence_of :name
25 validates_uniqueness_of :name
26 validates_uniqueness_of :name
@@ -7,6 +7,7
7 <table class="list">
7 <table class="list">
8 <thead><tr>
8 <thead><tr>
9 <th><%=l(:label_tracker)%></th>
9 <th><%=l(:label_tracker)%></th>
10 <th><%=l(:button_sort)%></th>
10 <th></th>
11 <th></th>
11 </tr></thead>
12 </tr></thead>
12 <tbody>
13 <tbody>
@@ -14,6 +15,12
14 <tr class="<%= cycle("odd", "even") %>">
15 <tr class="<%= cycle("odd", "even") %>">
15 <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td>
16 <td><%= link_to tracker.name, :action => 'edit', :id => tracker %></td>
16 <td align="center">
17 <td align="center">
18 <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => tracker, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
19 <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => tracker, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
20 <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => tracker, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %>
21 <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => tracker, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
22 </td>
23 <td align="center">
17 <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
24 <%= button_to l(:button_delete), { :action => 'destroy', :id => tracker }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
18 </td>
25 </td>
19 </tr>
26 </tr>
@@ -11,7 +11,7 http://redmine.rubyforge.org/
11 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
11 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
12 * mail notifications added when a document, a file or an attachment is added
12 * mail notifications added when a document, a file or an attachment is added
13 * tooltips added on Gantt chart and calender to view the details of the issues
13 * tooltips added on Gantt chart and calender to view the details of the issues
14 * ability to set the sort order for roles, issue statuses
14 * ability to set the sort order for roles, trackers, issue statuses
15 * added missing fields to csv export: priority, start date, due date, done ratio
15 * added missing fields to csv export: priority, start date, due date, done ratio
16 * 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-)
16 * 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-)
17 * added back "fixed version" field on issue screen and in filters
17 * added back "fixed version" field on issue screen and in filters
General Comments 0
You need to be logged in to leave comments. Login now