Class: Wf::WorkflowsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wf/workflows_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#wf_current_user

Instance Method Details

#createObject



43
44
45
46
47
48
49
50
51
# File 'app/controllers/wf/workflows_controller.rb', line 43

def create
  @workflow = Wf::Workflow.new(workflow_params)

  if @workflow.save
    redirect_to workflows_path, notice: "workflow was successfully created."
  else
    render :new
  end
end

#destroyObject



25
26
27
28
29
30
31
32
# File 'app/controllers/wf/workflows_controller.rb', line 25

def destroy
  @workflow = Wf::Workflow.find(params[:id])
  @workflow.destroy
  respond_to do |format|
    format.html { redirect_to workflows_path, notice: "workflow was successfully deleted." }
    format.js { render js: "window.location.reload();" }
  end
end

#editObject



16
17
18
19
# File 'app/controllers/wf/workflows_controller.rb', line 16

def edit
  @workflow = Wf::Workflow.find(params[:id])
  breadcrumb @workflow.name, workflow_path(@workflow)
end

#indexObject



8
9
10
# File 'app/controllers/wf/workflows_controller.rb', line 8

def index
  @workflows = Wf::Workflow.order("id DESC").page(params[:page])
end

#newObject



12
13
14
# File 'app/controllers/wf/workflows_controller.rb', line 12

def new
  @workflow = Wf::Workflow.new
end

#showObject



21
22
23
# File 'app/controllers/wf/workflows_controller.rb', line 21

def show
  @workflow = Wf::Workflow.find(params[:id])
end

#updateObject



34
35
36
37
38
39
40
41
# File 'app/controllers/wf/workflows_controller.rb', line 34

def update
  @workflow = Wf::Workflow.find(params[:id])
  if @workflow.update(workflow_params)
    redirect_to workflow_path(@workflow), notice: "workflow was successfully updated."
  else
    render :edit
  end
end