Class: Decidim::Votings::Admin::VotingsLandingPageController

Inherits:
ApplicationController
  • Object
show all
Includes:
Admin::ContentBlocks::LandingPage, Admin::ParticipatorySpaceAdminBreadcrumb
Defined in:
app/controllers/decidim/votings/admin/votings_landing_page_controller.rb

Overview

Controller that allows to (de)activate the content blocks from a voting landing page

Instance Method Summary collapse

Instance Method Details

#content_block_scopeObject



17
18
19
# File 'app/controllers/decidim/votings/admin/votings_landing_page_controller.rb', line 17

def content_block_scope
  :voting_landing_page
end

#enforce_permission_to_update_resourceObject



25
26
27
# File 'app/controllers/decidim/votings/admin/votings_landing_page_controller.rb', line 25

def enforce_permission_to_update_resource
  enforce_permission_to :manage_landing_page, :voting, voting: scoped_resource
end

#resource_content_block_cellObject



38
39
40
# File 'app/controllers/decidim/votings/admin/votings_landing_page_controller.rb', line 38

def resource_content_block_cell
  "decidim/votings/content_block"
end

#resource_create_url(manifest_name) ⇒ Object



33
34
35
36
# File 'app/controllers/decidim/votings/admin/votings_landing_page_controller.rb', line 33

def resource_create_url(manifest_name)
  voting_landing_page_content_blocks_path(participatory_process_group_id: params[:participatory_process_group_id],
                                          manifest_name:)
end

#resource_sort_urlObject



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

def resource_sort_url
  voting_landing_page_path(scoped_resource)
end

#scoped_resourceObject Also known as: current_participatory_space



21
22
23
# File 'app/controllers/decidim/votings/admin/votings_landing_page_controller.rb', line 21

def scoped_resource
  @scoped_resource ||= Voting.find_by(slug: params[:voting_slug], organization: current_organization)
end