Class: ReWorkflowsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ReWorkflowsController
- Defined in:
- app/controllers/re_workflows_controller.rb
Instance Method Summary collapse
- #add ⇒ Object
- #change ⇒ Object
- #copy ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #duplicate ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #plan ⇒ Object
- #preview ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#add ⇒ Object
93 94 95 |
# File 'app/controllers/re_workflows_controller.rb', line 93 def add @re_workflows = ReWorkflow.order_title.find(:all) end |
#change ⇒ Object
79 80 81 |
# File 'app/controllers/re_workflows_controller.rb', line 79 def change RulesEngine::Discovery.discover! end |
#copy ⇒ Object
97 98 99 |
# File 'app/controllers/re_workflows_controller.rb', line 97 def copy @re_workflow_copy = ReWorkflow.new end |
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/re_workflows_controller.rb', line 24 def create @re_workflow = ReWorkflow.new(params[:re_workflow]) if @re_workflow.save flash[:success] = 'Workflow Created.' respond_to do |format| format.html do redirect_to(change_re_workflow_path(@re_workflow)) end format.js do render :action => "create" end end else render :action => "new" end end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/re_workflows_controller.rb', line 65 def destroy @re_workflow.destroy flash[:success] = 'Workflow Removed.' respond_to do |format| format.html do redirect_to(re_workflows_path) end format.js do render :inline => "window.location.href = '#{re_workflows_path}';" end end end |
#duplicate ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'app/controllers/re_workflows_controller.rb', line 101 def duplicate @re_workflow_copy = ReWorkflow.new @re_workflow_copy.revert!(@re_workflow.publish) @re_workflow_copy.attributes = params[:re_workflow] if @re_workflow_copy.save flash[:success] = 'Workflow Duplicated.' respond_to do |format| format.html do redirect_to(change_re_workflow_path(@re_workflow_copy)) end format.js do render :inline => "window.location.href = '#{change_re_workflow_path(@re_workflow_copy)}';" end end else render :action => "copy" end end |
#edit ⇒ Object
43 44 |
# File 'app/controllers/re_workflows_controller.rb', line 43 def edit end |
#index ⇒ Object
13 14 15 |
# File 'app/controllers/re_workflows_controller.rb', line 13 def index @re_workflows = ReWorkflow.order_title.find(:all) end |
#new ⇒ Object
20 21 22 |
# File 'app/controllers/re_workflows_controller.rb', line 20 def new @re_workflow = ReWorkflow.new end |
#plan ⇒ Object
86 87 88 89 90 91 |
# File 'app/controllers/re_workflows_controller.rb', line 86 def plan klass = RePlanWorkflow klass = klass.order_plan_title klass = klass.by_workflow_id(@re_workflow.id) @re_plan_workflows = klass.paginate(:include => :re_plan, :page => params[:page] || 1, :per_page => 10) end |
#preview ⇒ Object
83 84 |
# File 'app/controllers/re_workflows_controller.rb', line 83 def preview end |
#show ⇒ Object
17 18 |
# File 'app/controllers/re_workflows_controller.rb', line 17 def show end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/re_workflows_controller.rb', line 46 def update update_params = params[:re_workflow] || {} @re_workflow.attributes = update_params.except(:code) if @re_workflow.save flash[:success] = 'Workflow Updated.' respond_to do |format| format.html do redirect_to(change_re_workflow_path(@re_workflow)) end format.js do render :action => "update" end end else render :action => "edit" end end |