Class: Decidim::Components::BaseController
Overview
Controller from which all component engines inherit from. It’s in charge of setting the appropiate layout, including necessary helpers, and overall fooling the engine into thinking it’s isolated.
Instance Method Summary
collapse
#disable_http_caching
enhance_controller, extended, included
Instance Method Details
#current_component ⇒ Object
Also known as:
current_feature
42
43
44
|
# File 'app/controllers/decidim/components/base_controller.rb', line 42
def current_component
request.env["decidim.current_component"]
end
|
#current_manifest ⇒ Object
47
48
49
|
# File 'app/controllers/decidim/components/base_controller.rb', line 47
def current_manifest
@current_manifest ||= current_component.manifest
end
|
#current_participatory_space ⇒ Object
36
37
38
|
# File 'app/controllers/decidim/components/base_controller.rb', line 36
def current_participatory_space
request.env["decidim.current_participatory_space"]
end
|
#permission_class_chain ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'app/controllers/decidim/components/base_controller.rb', line 55
def permission_class_chain
[
current_component.manifest.permissions_class,
current_participatory_space.manifest.permissions_class,
Decidim::Admin::Permissions,
Decidim::Permissions
]
end
|
#permission_scope ⇒ Object
51
52
53
|
# File 'app/controllers/decidim/components/base_controller.rb', line 51
def permission_scope
:public
end
|
#redirect_unless_feature_private ⇒ Object
64
65
66
|
# File 'app/controllers/decidim/components/base_controller.rb', line 64
def redirect_unless_feature_private
raise ActionController::RoutingError, "Not Found" unless current_user_can_visit_space?
end
|