##// END OF EJS Templates
Refactor: Extract methods to before_filters...
Eric Davis -
r3422:be20d9804078
parent child
Show More
@@ -19,7 +19,9 class WorkflowsController < ApplicationController
19 layout 'admin'
19 layout 'admin'
20
20
21 before_filter :require_admin
21 before_filter :require_admin
22
22 before_filter :find_roles
23 before_filter :find_trackers
24
23 def index
25 def index
24 @workflow_counts = Workflow.count_by_tracker_and_role
26 @workflow_counts = Workflow.count_by_tracker_and_role
25 end
27 end
@@ -40,8 +42,6 class WorkflowsController < ApplicationController
40 redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker
42 redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker
41 end
43 end
42 end
44 end
43 @roles = Role.find(:all, :order => 'builtin, position')
44 @trackers = Tracker.find(:all, :order => 'position')
45
45
46 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
46 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
47 if @tracker && @used_statuses_only && @tracker.issue_statuses.any?
47 if @tracker && @used_statuses_only && @tracker.issue_statuses.any?
@@ -51,8 +51,6 class WorkflowsController < ApplicationController
51 end
51 end
52
52
53 def copy
53 def copy
54 @trackers = Tracker.find(:all, :order => 'position')
55 @roles = Role.find(:all, :order => 'builtin, position')
56
54
57 if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any'
55 if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any'
58 @source_tracker = nil
56 @source_tracker = nil
@@ -80,4 +78,14 class WorkflowsController < ApplicationController
80 end
78 end
81 end
79 end
82 end
80 end
81
82 private
83
84 def find_roles
85 @roles = Role.find(:all, :order => 'builtin, position')
86 end
87
88 def find_trackers
89 @trackers = Tracker.find(:all, :order => 'position')
90 end
83 end
91 end
General Comments 0
You need to be logged in to leave comments. Login now