Sha256: b620aff907bd0a9ce93e8b11ebb54a72e033728d0a8721edc06bbb12e2b09869

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 Bytes

Contents

module Refinery
  module Pages
    module InstanceMethods

      def error_404(exception=nil)
        if (@page = ::Page.where(:menu_match => "^/404$").includes(:parts, :slugs).first).present?
          # render the application's custom 404 page with layout and meta.
          render :template => "/pages/show",
                 :format => 'html',
                 :status => 404
        else
          super
        end
      end

    protected
      def find_pages_for_menu
        @menu_pages = ::Page.roots.live.in_menu.order('lft ASC').includes(:children)
      end

      def render(*args)
        present(@page) unless admin? or @meta.present?
        super
      end

    private
      def store_current_location!
        return super if admin?

        session[:website_return_to] = url_for(@page.url) if @page.try(:present?)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-pages-0.9.9.22 lib/refinery/pages/instance_methods.rb