Sha256: 3abc6159c8a5783a86b95efaa5e952223ded82fcca42747ed83c2ba7a0ec7846

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    module Admin
      # Controller that allows to edit the content of the landing page content blocks
      class VotingsLandingPageContentBlocksController < Decidim::Votings::Admin::ApplicationController
        include Decidim::Admin::LandingPageContentBlocks

        layout "decidim/admin/voting"

        helper_method :current_participatory_space

        private

        def content_block_scope
          :voting_landing_page
        end

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

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

        def edit_resource_landing_page_path
          edit_voting_landing_page_path(scoped_resource)
        end

        def resource_landing_page_content_block_path
          voting_landing_page_content_block_path(scoped_resource, params[:id])
        end

        def submit_button_text
          t("landing_page.content_blocks.edit.update", scope: "decidim.votings.admin")
        end

        alias current_participatory_space scoped_resource
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-elections-0.27.9 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.27.8 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.27.7 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.27.6 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.26.10 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.26.9 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.27.5 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.26.8 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb
decidim-elections-0.27.4 app/controllers/decidim/votings/admin/votings_landing_page_content_blocks_controller.rb