Sha256: d61cb254129cc20dec98376cbd9f12f888acdbc4fbec1e1f4f2ce58a324da839

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Consultations
    class ConsultationWidgetsController < Decidim::WidgetsController
      helper Decidim::SanitizeHelper
      helper ConsultationsHelper

      layout false

      def show
        enforce_permission_to :embed, :participatory_space, current_participatory_space: model if model

        super
      end

      private

      def model
        @model ||= Consultation.where(organization: current_organization).published.find_by(slug: params[:consultation_slug])
      end

      def current_participatory_space
        model
      end

      def iframe_url
        @iframe_url ||= consultation_consultation_widget_url(model)
      end

      def permission_class_chain
        ::Decidim.permissions_registry.chain_for(::Decidim::Consultations::ApplicationController)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-consultations-0.27.9 app/controllers/decidim/consultations/consultation_widgets_controller.rb
decidim-consultations-0.27.8 app/controllers/decidim/consultations/consultation_widgets_controller.rb
decidim-consultations-0.27.7 app/controllers/decidim/consultations/consultation_widgets_controller.rb
decidim-consultations-0.27.6 app/controllers/decidim/consultations/consultation_widgets_controller.rb