Class: Decidim::Admin::ModerationsController
Overview
This controller allows admins to manage moderations in a participatory process.
Instance Method Summary
collapse
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#hide ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/decidim/admin/moderations_controller.rb', line 38
def hide
enforce_permission_to :hide, authorization_scope
Admin::HideResource.call(reportable, current_user) do
on(:ok) do
flash[:notice] = I18n.t("reportable.hide.success", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
on(:invalid) do
flash.now[:alert] = I18n.t("reportable.hide.invalid", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
end
end
|
#index ⇒ Object
13
14
15
|
# File 'app/controllers/decidim/admin/moderations_controller.rb', line 13
def index
enforce_permission_to :read, authorization_scope
end
|
#show ⇒ Object
17
18
19
20
|
# File 'app/controllers/decidim/admin/moderations_controller.rb', line 17
def show
enforce_permission_to :read, authorization_scope
@moderation = collection.find(params[:id])
end
|
#unhide ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'app/controllers/decidim/admin/moderations_controller.rb', line 54
def unhide
enforce_permission_to :unhide, authorization_scope
Admin::UnhideResource.call(reportable, current_user) do
on(:ok) do
flash[:notice] = I18n.t("reportable.unhide.success", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
on(:invalid) do
flash.now[:alert] = I18n.t("reportable.unhide.invalid", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
end
end
|
#unreport ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/decidim/admin/moderations_controller.rb', line 22
def unreport
enforce_permission_to :unreport, authorization_scope
Admin::UnreportResource.call(reportable, current_user) do
on(:ok) do
flash[:notice] = I18n.t("reportable.unreport.success", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
on(:invalid) do
flash.now[:alert] = I18n.t("reportable.unreport.invalid", scope: "decidim.moderations.admin")
redirect_to moderations_path
end
end
end
|