Class: LcpRuby::ApprovalTasksController
Constant Summary
Controller::BearerAuthentication::BASIC_PREFIX_LENGTH, Controller::BearerAuthentication::BEARER_PREFIX_LENGTH
Instance Method Summary
collapse
#current_evaluator
Instance Method Details
#approve ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/lcp_ruby/approval_tasks_controller.rb', line 6
def approve
authorize @record, :show?
Workflow::Approval::TaskManager.approve_task(
@task, user: current_user, comment: params[:comment].presence
)
redirect_to resource_path(@record), status: :see_other,
notice: I18n.t("lcp_ruby.flash.approval_task_approved",
default: "Task approved successfully.")
end
|
#claim ⇒ Object
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/lcp_ruby/approval_tasks_controller.rb', line 42
def claim
authorize @record, :show?
Workflow::Approval::TaskManager.claim_task(@task, user: current_user)
redirect_to resource_path(@record), status: :see_other,
notice: I18n.t("lcp_ruby.flash.approval_task_claimed",
default: "Task claimed successfully.")
end
|
#delegate ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/controllers/lcp_ruby/approval_tasks_controller.rb', line 52
def delegate
authorize @record, :show?
delegate_to = params[:delegate_to_user_id]
raise Workflow::TaskActionError, "delegate_to_user_id is required" if delegate_to.blank?
Workflow::Approval::TaskManager.delegate_task(
@task, user: current_user, delegate_to_user_id: delegate_to.to_i
)
redirect_to resource_path(@record), status: :see_other,
notice: I18n.t("lcp_ruby.flash.approval_task_delegated",
default: "Task delegated successfully.")
end
|
#reject ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/lcp_ruby/approval_tasks_controller.rb', line 18
def reject
authorize @record, :show?
Workflow::Approval::TaskManager.reject_task(
@task, user: current_user, comment: params[:comment].presence
)
redirect_to resource_path(@record), status: :see_other,
notice: I18n.t("lcp_ruby.flash.approval_task_rejected",
default: "Task rejected.")
end
|
#return_task ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/lcp_ruby/approval_tasks_controller.rb', line 30
def return_task
authorize @record, :show?
Workflow::Approval::TaskManager.return_task(
@task, user: current_user, comment: params[:comment].presence
)
redirect_to resource_path(@record), status: :see_other,
notice: I18n.t("lcp_ruby.flash.approval_task_returned",
default: "Task returned for rework.")
end
|