Sha256: 267e2b74df54c94433cb12498ebc7d5e7babe014cea9f48cb8a143feac6c95a5

Contents?: true

Size: 594 Bytes

Versions: 4

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Debates
    class WidgetsController < Decidim::WidgetsController
      helper Debates::ApplicationHelper

      def show
        enforce_permission_to :embed, :debate, debate: model if model

        super
      end

      private

      def model
        @model ||= Debate.not_hidden.where(component: current_component).find(params[:debate_id])
      end

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

      def permission_class_chain
        [Decidim::Debates::Permissions]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-debates-0.27.9 app/controllers/decidim/debates/widgets_controller.rb
decidim-debates-0.27.8 app/controllers/decidim/debates/widgets_controller.rb
decidim-debates-0.27.7 app/controllers/decidim/debates/widgets_controller.rb
decidim-debates-0.27.6 app/controllers/decidim/debates/widgets_controller.rb