Sha256: 225e4d1fdd4425a321e9f9bda65c156ac663029fd3d880505f3c82d78626ba5e

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require_dependency "yawl_rails/application_controller"

module YawlRails
  class ProcessesController < ApplicationController
    def index
      @processes = ::Yawl::Process.order(:id).reverse

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

    def show
      @process = ::Yawl::Process.first(:id => params[:id])

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

    def restart
      @process = ::Yawl::Process.first(:id => params[:id])
      @process.start_first_unfinished_step

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

    def steps
      @process = ::Yawl::Process.first(:id => params[:id])

      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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yawl_rails-0.1.1 app/controllers/yawl_rails/processes_controller.rb
yawl_rails-0.1.0 app/controllers/yawl_rails/processes_controller.rb