added the ability to set the sort order for roles

git-svn-id: http://redmine.rubyforge.org/svn/trunk@208 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-01-31 20:57:01 +00:00
parent 99f006f2c9
commit 671a0fa101
9 changed files with 44 additions and 8 deletions
+20 -2
View File
@@ -18,6 +18,9 @@
class RolesController < ApplicationController
layout 'base'
before_filter :require_admin
verify :method => :post, :only => [ :destroy, :move ],
:redirect_to => { :action => :list }
def index
list
@@ -25,7 +28,7 @@ class RolesController < ApplicationController
end
def list
@role_pages, @roles = paginate :roles, :per_page => 10
@role_pages, @roles = paginate :roles, :per_page => 10, :order => "position"
render :action => "list", :layout => false if request.xhr?
end
@@ -62,6 +65,21 @@ class RolesController < ApplicationController
redirect_to :action => 'list'
end
def move
@role = Role.find(params[:id])
case params[:position]
when 'highest'
@role.move_to_top
when 'higher'
@role.move_higher
when 'lower'
@role.move_lower
when 'lowest'
@role.move_to_bottom
end if params[:position]
redirect_to :action => 'list'
end
def workflow
@role = Role.find_by_id(params[:role_id])
@tracker = Tracker.find_by_id(params[:tracker_id])
@@ -77,7 +95,7 @@ class RolesController < ApplicationController
flash[:notice] = l(:notice_successful_update)
end
end
@roles = Role.find :all
@roles = Role.find(:all, :order => 'position')
@trackers = Tracker.find :all
@statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
end