Sha256: 0a0c67c9ddb65e4c7f805dd419ffcbcee8fe666e7492ad135fd6b941bfe3b2d7

Contents?: true

Size: 1016 Bytes

Versions: 6

Compression:

Stored size: 1016 Bytes

Contents

module Refinery
  module Pages
    module InstanceMethods

      def self.included(base)
        base.send :helper_method, :refinery_menu_pages
        base.send :alias_method_chain, :render, :presenters
      end

      def error_404(exception=nil)
        if (@page = ::Refinery::Page.where(:menu_match => "^/404$").includes(:parts).first).present?
          # render the application's custom 404 page with layout and meta.
          if self.respond_to? :render_with_templates?, true
            render_with_templates? @page, :status => 404
          else
            render :template => '/refinery/pages/show', :formats => [:html], :status => 404
          end
          return false
        else
          super
        end
      end

      # Compiles the default menu.
      def refinery_menu_pages
        Menu.new Page.fast_menu
      end

    protected
      def render_with_presenters(*args)
        present @page unless admin? || @meta
        render_without_presenters(*args)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-pages-2.1.5 lib/refinery/pages/instance_methods.rb
refinerycms-pages-2.1.4 lib/refinery/pages/instance_methods.rb
refinerycms-pages-2.1.3 lib/refinery/pages/instance_methods.rb
refinerycms-pages-2.1.2 lib/refinery/pages/instance_methods.rb
refinerycms-pages-2.1.1 lib/refinery/pages/instance_methods.rb
refinerycms-pages-2.1.0 lib/refinery/pages/instance_methods.rb