Class: Workflowable::WorkflowsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Workflowable::WorkflowsController
- Defined in:
- app/controllers/workflowable/workflows_controller.rb
Instance Method Summary collapse
- #configure_stages ⇒ Object
-
#create ⇒ Object
POST /workflows POST /workflows.json.
-
#destroy ⇒ Object
DELETE /workflows/1 DELETE /workflows/1.json.
-
#edit ⇒ Object
GET /workflows/1/edit.
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #stages ⇒ Object
-
#update ⇒ Object
PUT /workflows/1 PUT /workflows/1.json.
Instance Method Details
#configure_stages ⇒ Object
93 94 95 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 93 def configure_stages end |
#create ⇒ Object
POST /workflows POST /workflows.json
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 41 def create @workflow = Workflow.new(workflow_params) respond_to do |format| if @workflow.save format.html { if(@workflow.stages.count > 1) redirect_to configure_stages_workflow_path(@workflow), notice: 'Workflow was successfully created. Please configure transitions.' else redirect_to @workflow, notice: 'Workflow was successfully created.' end } format.json { render json: @workflow, status: :created, location: @workflow } else format.html { render action: "new" } format.json { render json: @workflow.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /workflows/1 DELETE /workflows/1.json
100 101 102 103 104 105 106 107 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 100 def destroy @workflow.destroy respond_to do |format| format.html { redirect_to workflows_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /workflows/1/edit
35 36 37 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 35 def edit end |
#index ⇒ Object
21 22 23 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 21 def index @workflows = Workflowable::Workflow.order(:name) end |
#new ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 25 def new @workflow = Workflow.new respond_to do |format| format.html # new.html.erb format.json { render json: @workflow } end end |
#show ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 79 def show respond_to do |format| format.html # new.html.erb format.json { render json: @workflow } end end |
#stages ⇒ Object
89 90 91 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 89 def stages end |
#update ⇒ Object
PUT /workflows/1 PUT /workflows/1.json
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/workflowable/workflows_controller.rb', line 65 def update respond_to do |format| if @workflow.update_attributes(workflow_params) format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @workflow.errors, status: :unprocessable_entity } end end end |