Sha256: a978d7d94559ff6b7b3bdce24984f392891f742c5014a6e075ba4cce8c9a8d8f

Contents?: true

Size: 962 Bytes

Versions: 20

Compression:

Stored size: 962 Bytes

Contents

module Fiona7
  class WorkflowController < ActionController::Base
    def edit
      workflow_action('edit')
    end

    def take
      workflow_action('take')
    end

    def forward
      workflow_action('forward')
    end

    def commit
      workflow_action('commit')
    end

    def sign
      workflow_action('sign')
    end

    def reject
      workflow_action('reject')
    end

    protected
    def workflow_action(action)
      @obj     = WriteObj.find(params[:id])
      @comment = params[:comment]

      if action == 'edit'
        # TODO: this should be implemented in reactor.
        @obj.edit!(@comment)
      else
        @obj.workflow.send(:"#{action}!", @comment)
      end

      render json: {}
    rescue => e
      Rails.logger.error("Error #{e.inspect} when executing workflow operation on #{@obj.id} with comment=#{@comment}")
      render json: {message: e.message, message_for_editor: e.message}, status: 412
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.6.1.1.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.2.3 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.2.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.2.2 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.5.5.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.5.5.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.1.4 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.5.4.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.5.4.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.1.3 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.5.3.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.4.3.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.3.2.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.5.2.0.0 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.1.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.0.1 app/controllers/fiona7/workflow_controller.rb
infopark_fiona7-1.2.0.0.0 app/controllers/fiona7/workflow_controller.rb