Class: Decidim::ScopesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/scopes_controller.rb

Overview

Exposes the scopes text search so users can choose a scope writing its name.

Instance Method Summary collapse

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 RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#pickerObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/decidim/scopes_controller.rb', line 8

def picker
  enforce_permission_to :pick, :scope

  context = picker_context(root, title, max_depth)
  required = params&.[](:required) != "false"

  scopes, parent_scopes = resolve_picker_scopes(root, current)

  render(
    :picker,
    layout: nil,
    locals: {
      required: required,
      title: title,
      root: root,
      current: (current || root),
      scopes: scopes&.order(name: :asc),
      parent_scopes: parent_scopes,
      picker_target_id: (params[:target_element_id] || "content"),
      global_value: params[:global_value],
      max_depth: max_depth,
      context: context
    }
  )
end