Sha256: 757dd000399f304882a8bcba087f5f1a27370a1d8e76b5f8192e2209edd57d1e
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
class FlowController < ApplicationController before_filter :set_active_nav def list @meta_title = 'Active Flows' @flows = Distribot::Flow.active render @flows.empty? ? :empty_list : :list end def create @meta_title = 'Create Flow' if request.method == 'POST' begin @flow = Distribot::Flow.create!(JSON.parse(params[:json], symbolize_names: true)) flash[:notice] = 'Successfully Created' redirect_to show_flow_path(flow_id: @flow.id) rescue flash[:error] = 'There was a problem - please try again' begin @flow = Distribot::Flow.new(JSON.parse(params[:json])) rescue JSON::ParserError => e flash[:error] = "Invalid JSON: #{e}" @flow_json = params[:json] @flow = Distribot::Flow.new() end end else @flow = Distribot::Flow.new( phases: [ { name: "start", is_initial: true, transitions_to: "finish" }, { name: "finish", is_final: true, } ] ) end end def show @flow = Distribot::Flow.find(params[:flow_id]) @meta_title = "View Flow #{@flow.id}" end def pause end def resume end def cancel end private def set_active_nav @active_nav = :flows end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
distribot-ui-0.1.0 | app/controllers/flow_controller.rb |