Sha256: ffd1f7f119a9eca2af94e9a9df903134614d52d7cb14bbe842f1a1c2fd51c2dc
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
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 def list @obj = WriteObj.find(params[:id]) actions = [] if ::Fiona7.workflows_enabled? and @obj.workflow.present? actions = @obj.send(:crul_obj).valid_actions else actions = @obj.send(:crul_obj).valid_actions.select{ |a| ["release","edit"].include? a } end render json: { actions: actions } rescue => e Rails.logger.error("Error #{e.inspect} when executing valid_actions on #{@obj.id}") render json: {message: e.message, message_for_editor: e.message}, status: 412 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
infopark_fiona7-1.6.1.1.5 | app/controllers/fiona7/workflow_controller.rb |