Sha256: 35703387cf001ae0aa63badd881644c7a12648b828b384c520de6c3d34a07d24

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

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

      helper_method :graphs_path

      layout "decidim/comparative_stats/widget"

      def show
        is_valid = lookup_context.exists?(params[:graph], "decidim/comparative_stats/widgets", true)
        render plain: "not found", status: :not_found unless is_valid
      end

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

      private

      # Mock admin path for tabs.html.erb
      def graphs_path(graph)
        decidim_comparative_stats.widget_url graph
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-comparative_stats-1.1.0 app/controllers/decidim/comparative_stats/widgets_controller.rb
decidim-comparative_stats-1.0.1 app/controllers/decidim/comparative_stats/widgets_controller.rb