Sha256: d998e4bf52c0eed153f27291cb60aa34d82cc2c0b3b16e6a899be10c7659bb01
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
require_dependency "yawl_rails/application_controller" module YawlRails class ProcessesController < ApplicationController before_filter :load_process, only: [:show, :restart, :steps] 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 def show 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.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 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 protected def load_process @process = ::Yawl::Process.first(:name => params[:id]) if @process.nil? respond_to do |format| format.html { render :text => "Process not found", :status => 404 } format.json { render :json => { "error" => "Process not found" }, :status => 404 } end false end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yawl_rails-0.2.1 | app/controllers/yawl_rails/processes_controller.rb |
yawl_rails-0.2.0 | app/controllers/yawl_rails/processes_controller.rb |