Class: Decidim::Components::BaseController
Overview
Controller from which all component engines inherit from. It is in charge of setting the appropiate layout, including necessary helpers, and overall fooling the engine into thinking it is isolated.
Direct Known Subclasses
Accountability::ApplicationController, Blogs::ApplicationController, Budgets::ApplicationController, Debates::ApplicationController, DummyResources::DummyResourcesController, Elections::ApplicationController, EndorsementsController, Meetings::ApplicationController, Pages::ApplicationController, Proposals::ApplicationController, Sortitions::ApplicationController, Surveys::ApplicationController, Templates::ApplicationController
Instance Method Summary
collapse
register_permissions
#check_user_block_status, #check_user_not_blocked
#snippets
#disable_http_caching
#skip_store_location?, #store_current_location
enhance_controller, extended, included
Instance Method Details
#current_component ⇒ Object
44
45
46
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 44
def current_component
request.env["decidim.current_component"]
end
|
#current_manifest ⇒ Object
48
49
50
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 48
def current_manifest
@current_manifest ||= current_component.manifest
end
|
#current_participatory_space ⇒ Object
40
41
42
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 40
def current_participatory_space
request.env["decidim.current_participatory_space"]
end
|
#permission_class_chain ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 60
def permission_class_chain
[
current_component.manifest.permissions_class,
current_participatory_space.manifest.permissions_class,
Decidim::Admin::Permissions,
Decidim::Permissions
]
end
|
#permission_scope ⇒ Object
56
57
58
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 56
def permission_scope
:public
end
|
#redirect_unless_feature_private ⇒ Object
69
70
71
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 69
def redirect_unless_feature_private
raise ActionController::RoutingError, "Not Found" unless current_user_can_visit_space?
end
|
#set_component_breadcrumb_item ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 73
def set_component_breadcrumb_item
context_breadcrumb_items << {
label: current_component.name,
url: root_path,
active: false,
resource: current_component
}
end
|
#share_token ⇒ Object
52
53
54
|
# File 'decidim-core/app/controllers/decidim/components/base_controller.rb', line 52
def share_token
params[:share_token]
end
|