Class: Decidim::Admin::Components::BaseController
Overview
This controller is the abstract class from which all component controllers in their admin engines should inherit from.
Instance Method Summary
collapse
#user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#current_component ⇒ Object
55
56
57
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 55
def current_component
request.env["decidim.current_component"]
end
|
#current_participatory_space ⇒ Object
59
60
61
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 59
def current_participatory_space
current_component.participatory_space
end
|
#parent_path ⇒ Object
63
64
65
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 63
def parent_path
@parent_path ||= ::Decidim::EngineRouter.admin_proxy(current_participatory_space).components_path
end
|
#permission_class_chain ⇒ Object
43
44
45
46
47
48
49
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 43
def permission_class_chain
[
current_component.manifest.permissions_class,
current_participatory_space.manifest.permissions_class,
Decidim::Admin::Permissions
]
end
|
#permission_scope ⇒ Object
51
52
53
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 51
def permission_scope
:admin
end
|
#permissions_context ⇒ Object
36
37
38
39
40
41
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 36
def permissions_context
super.merge(
current_participatory_space:,
participatory_space: current_participatory_space
)
end
|
#set_component_breadcrumb_item ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 71
def set_component_breadcrumb_item
context_breadcrumb_items << {
label: t("components", scope: "decidim.admin.menu"),
url: parent_path,
active: false
}
context_breadcrumb_items << {
label: translated_attribute(current_component.name),
url: ::Decidim::EngineRouter.admin_proxy(current_component).root_path,
active: true
}
end
|
#skip_manage_component_permission ⇒ Object
67
68
69
|
# File 'app/controllers/decidim/admin/components/base_controller.rb', line 67
def skip_manage_component_permission
false
end
|