Class: YawlRails::ProcessesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/yawl_rails/processes_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/yawl_rails/processes_controller.rb', line 7

def index
  page = (params[:page] || 1).to_i
  @processes = ::Yawl::Process.pagination_dataset.order(:id).reverse.paginate(page, Yawl::Config.pagination_per_page)

  respond_to do |format|
    format.html
    format.json { render :json => @processes }
  end
end

#restartObject



24
25
26
27
28
29
30
31
# File 'app/controllers/yawl_rails/processes_controller.rb', line 24

def restart
  @process.start_first_unfinished_step

  respond_to do |format|
    format.html { redirect_to yawl_process_path(@process.name), :status => 303 }
    format.json { render :json => @process.to_hash, :location => yawl_process_url(@process.name) }
  end
end

#showObject



17
18
19
20
21
22
# File 'app/controllers/yawl_rails/processes_controller.rb', line 17

def show
  respond_to do |format|
    format.html
    format.json { render :json => @process.to_hash.merge(:steps => @process.steps.map(&:to_hash)) }
  end
end

#stepsObject



33
34
35
36
37
38
# File 'app/controllers/yawl_rails/processes_controller.rb', line 33

def steps
  respond_to do |format|
    format.html { render :partial => "step_rows" }
    format.json { render :json => @process.to_hash.merge(:steps => @process.steps.map(&:to_hash)) }
  end
end