Class: Admin::PendingActionsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/generators/open_loam/install/templates/admin/pending_actions_controller.rb

Overview

The approval queue: staged mutations (OpenLoam::PendingAction) waiting on a human. Manager-only — approving EXECUTES the change. The workflow's role gate is the deeper enforcement (approve!/reject! raise for a non-manager); this screen is a manager screen on top of it.

Constant Summary

Constants included from Pagination

Admin::Pagination::PER_PAGE

Instance Method Summary collapse

Methods inherited from BaseController

skip_authorization!

Methods included from Pagination

#paginate

Instance Method Details

#approve ⇒ Object



14
15
16
17
# File 'lib/generators/open_loam/install/templates/admin/pending_actions_controller.rb', line 14

def approve
  @pending_action.approve!(by: current_actor)
  redirect_to admin_pending_actions_path, notice: approval_notice(@pending_action)
end

#index ⇒ Object



10
11
12
# File 'lib/generators/open_loam/install/templates/admin/pending_actions_controller.rb', line 10

def index
  @pending = OpenLoam::PendingAction.pending.order(created_at: :desc)
end

#reject ⇒ Object



19
20
21
22
# File 'lib/generators/open_loam/install/templates/admin/pending_actions_controller.rb', line 19

def reject
  @pending_action.reject!(by: current_actor, reason: params[:reason])
  redirect_to admin_pending_actions_path, notice: "Rejected: #{@pending_action.summary}"
end