Sha256: 10fab504fff661214b2b53a10171253fa6a48eb89ecc35cee1ef394684d4c559

Contents?: true

Size: 812 Bytes

Versions: 5

Compression:

Stored size: 812 Bytes

Contents

module Refinery
  module Pages
    module Admin
      class PreviewController < AdminController
        include Pages::InstanceMethods
        include Pages::RenderOptions

        before_filter :find_page

        layout :layout

        def show
          render_with_templates?
        end

        protected
        def admin?
          false
        end

        def find_page
          if @page = Refinery::Page.find_by_path_or_id(params[:path], params[:id])
            # Preview existing pages
            @page.attributes = params[:page]
          elsif params[:page]
            # Preview a non-persisted page
            @page = Page.new params[:page]
          end
        end
        alias_method :page, :find_page

        def layout
          'application'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-pages-2.1.4 app/controllers/refinery/pages/admin/preview_controller.rb
refinerycms-pages-2.1.3 app/controllers/refinery/pages/admin/preview_controller.rb
refinerycms-pages-2.1.2 app/controllers/refinery/pages/admin/preview_controller.rb
refinerycms-pages-2.1.1 app/controllers/refinery/pages/admin/preview_controller.rb
refinerycms-pages-2.1.0 app/controllers/refinery/pages/admin/preview_controller.rb