Class: Decidim::Admin::TaxonomyFiltersSelectorController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Instance Method Details

#createObject

Updates the component with the selected taxonomy filter



34
35
36
37
38
39
40
# File 'app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb', line 34

def create
  enforce_permission_to :create, :taxonomy_filter

  update_filters!(component.settings.taxonomy_filters + [taxonomy_filter.id.to_s])

  render partial: "decidim/admin/taxonomy_filters_selector/component_table"
end

#destroyObject

Removes the selected taxonomy filter from the component



48
49
50
51
52
53
54
# File 'app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb', line 48

def destroy
  enforce_permission_to :destroy, :taxonomy_filter

  update_filters!(component.settings.taxonomy_filters - [taxonomy_filter.id.to_s]) if taxonomy_filter

  render partial: "decidim/admin/taxonomy_filters_selector/component_table"
end

#indexObject

Renders “choose the taxonomy” step



24
25
26
# File 'app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb', line 24

def index
  enforce_permission_to :index, :taxonomy_filter
end

#newObject

Renders “choose the taxonomy filter” step



29
30
31
# File 'app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb', line 29

def new
  enforce_permission_to :create, :taxonomy_filter
end

#showObject

Renders the component with the selected taxonomy filter



43
44
45
# File 'app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb', line 43

def show
  enforce_permission_to :show, :taxonomy_filter
end