Sha256: 9aba928db6054b78b72aea84e0bdc3e2d68e788d9f4028b35ad51430b34955e4

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class WidgetsController < Decidim::ApplicationController
    skip_before_action :verify_authenticity_token
    after_action :allow_iframe, only: :show
    helper ResourceHelper

    layout "decidim/widget"

    helper_method :model, :iframe_url, :current_participatory_space

    def show
      raise ActionController::RoutingError, "Not Found" if model.nil?

      respond_to do |format|
        format.js { render "decidim/widgets/show" }
        format.html
      end
    end

    private

    def current_component
      @current_component ||= request.env["decidim.current_component"]
    end

    def current_participatory_space
      @current_participatory_space ||= model.component.participatory_space
    end

    def iframe_url
      raise NotImplementedError
    end

    def allow_iframe
      response.headers.delete "X-Frame-Options"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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