summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-04 05:33:45 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-04 05:33:45 +0000
commitbe20d98040789626885b6697a040d1d5fecb2274 (patch)
tree8b7c6d658fdc60f7655c1a449e7004f46fb21a09 /app/controllers
parent3a99f189139f1b950dae5303c7cee7fbc52ad178 (diff)
downloadredmine-be20d98040789626885b6697a040d1d5fecb2274.tar.gz
redmine-be20d98040789626885b6697a040d1d5fecb2274.zip
Refactor: Extract methods to before_filters
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3536 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/workflows_controller.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index 35ec8ab71..ed4640129 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -19,7 +19,9 @@ class WorkflowsController < ApplicationController
layout 'admin'
before_filter :require_admin
-
+ before_filter :find_roles
+ before_filter :find_trackers
+
def index
@workflow_counts = Workflow.count_by_tracker_and_role
end
@@ -40,8 +42,6 @@ class WorkflowsController < ApplicationController
redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker
end
end
- @roles = Role.find(:all, :order => 'builtin, position')
- @trackers = Tracker.find(:all, :order => 'position')
@used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
if @tracker && @used_statuses_only && @tracker.issue_statuses.any?
@@ -51,8 +51,6 @@ class WorkflowsController < ApplicationController
end
def copy
- @trackers = Tracker.find(:all, :order => 'position')
- @roles = Role.find(:all, :order => 'builtin, position')
if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any'
@source_tracker = nil
@@ -80,4 +78,14 @@ class WorkflowsController < ApplicationController
end
end
end
+
+ private
+
+ def find_roles
+ @roles = Role.find(:all, :order => 'builtin, position')
+ end
+
+ def find_trackers
+ @trackers = Tracker.find(:all, :order => 'position')
+ end
end