Class: Wf::PlacesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#wf_current_user

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/wf/places_controller.rb', line 14

def create
  @workflow = Wf::Workflow.find(params[:workflow_id])
  @place = @workflow.places.new(place_params)
  if @place.save
    redirect_to workflow_path(@workflow), notice: "place was successfully created."
  else
    render :new
  end
end

#destroyObject



24
25
26
27
28
29
# File 'app/controllers/wf/places_controller.rb', line 24

def destroy
  @workflow = Wf::Workflow.find(params[:workflow_id])
  @place = @workflow.places.find(params[:id])
  @place.destroy
  render js: "window.location.reload()"
end

#editObject



31
32
33
34
35
# File 'app/controllers/wf/places_controller.rb', line 31

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

#newObject



8
9
10
11
12
# File 'app/controllers/wf/places_controller.rb', line 8

def new
  @workflow = Wf::Workflow.find(params[:workflow_id])
  @place = @workflow.places.new
  breadcrumb @workflow.name, workflow_path(@workflow)
end

#updateObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/wf/places_controller.rb', line 37

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