Class: Decidim::Components::BaseController

Inherits:
ApplicationController show all
Includes:
NeedsPermission, ParticipatorySpaceContext, Settings
Defined in:
app/controllers/decidim/components/base_controller.rb

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.

Direct Known Subclasses

EndorsementsController

Instance Method Summary collapse

Methods included from RegistersPermissions

register_permissions

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#current_componentObject



43
44
45
# File 'app/controllers/decidim/components/base_controller.rb', line 43

def current_component
  request.env["decidim.current_component"]
end

#current_manifestObject



47
48
49
# File 'app/controllers/decidim/components/base_controller.rb', line 47

def current_manifest
  @current_manifest ||= current_component.manifest
end

#current_participatory_spaceObject



39
40
41
# File 'app/controllers/decidim/components/base_controller.rb', line 39

def current_participatory_space
  request.env["decidim.current_participatory_space"]
end

#permission_class_chainObject



59
60
61
62
63
64
65
66
# File 'app/controllers/decidim/components/base_controller.rb', line 59

def permission_class_chain
  [
    current_component.manifest.permissions_class,
    current_participatory_space.manifest.permissions_class,
    Decidim::Admin::Permissions,
    Decidim::Permissions
  ]
end

#permission_scopeObject



55
56
57
# File 'app/controllers/decidim/components/base_controller.rb', line 55

def permission_scope
  :public
end

#redirect_unless_feature_privateObject

Raises:

  • (ActionController::RoutingError)


68
69
70
# File 'app/controllers/decidim/components/base_controller.rb', line 68

def redirect_unless_feature_private
  raise ActionController::RoutingError, "Not Found" unless current_user_can_visit_space?
end

#share_tokenObject



51
52
53
# File 'app/controllers/decidim/components/base_controller.rb', line 51

def share_token
  params[:share_token]
end