Sha256: 78463d7a2b146853e0d7061fe728a96041f34c2a72f185c3cf30afcaeeb940cb

Contents?: true

Size: 1012 Bytes

Versions: 4

Compression:

Stored size: 1012 Bytes

Contents

module ::Refinery
  module Admin
    class DialogsController < ::Refinery::AdminController
      TYPES = %w[image link]

      before_action :find_dialog_type, :find_iframe_src, :only => [:show]

      def index
        redirect_to Refinery::Core.backend_path
      end

      def show
        render :layout => false
      end

      def from_dialog?
        true
      end

      protected

      def find_dialog_type
        error_404 if TYPES.exclude? params[:id].downcase

        @dialog_type = params[:id].downcase
      end

      def find_iframe_src
        if @dialog_type == 'image'
          @iframe_src = refinery.insert_admin_images_path(
            url_params.merge(:modal => true)
          )
        elsif @dialog_type == 'link'
          @iframe_src = refinery.link_to_admin_pages_dialogs_path url_params
        end
      end

      def url_params
        params.to_unsafe_h.reject { |key, value| /(action)|(controller)/ === key}.
               merge :id => nil
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-core-4.0.3 app/controllers/refinery/admin/dialogs_controller.rb
refinerycms-core-4.0.2 app/controllers/refinery/admin/dialogs_controller.rb
refinerycms-core-4.0.1 app/controllers/refinery/admin/dialogs_controller.rb
refinerycms-core-4.0.0 app/controllers/refinery/admin/dialogs_controller.rb