Sha256: 26bdbfa05abaaa9683e4f1e0a239f5237a3b9af83c1ae2b187c388b96a22f820

Contents?: true

Size: 866 Bytes

Versions: 6

Compression:

Stored size: 866 Bytes

Contents

module Refinery
  module Pages
    module Admin
      module InstanceMethods

        def error_404(exception=nil)
          if (@page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])).present?
            params[:action] = 'error_404'
            # change any links in the copy to the admin_root_path
            # and any references to "home page" to "Dashboard"
            part_symbol = Page.default_parts.first.to_sym
            @page[part_symbol] = @page[part_symbol].to_s.gsub(
                                   /href=(\'|\")\/(\'|\")/, "href='#{admin_root_path}'"
                                 ).gsub("home page", "Dashboard")

            render :template => "/pages/show",
                   :layout => layout?,
                   :status => 404
          else
            super
          end
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-pages-0.9.9.21 lib/refinery/pages/admin/instance_methods.rb
refinerycms-pages-0.9.9.20 lib/refinery/pages/admin/instance_methods.rb
refinerycms-pages-0.9.9.19 lib/refinery/pages/admin/instance_methods.rb
refinerycms-pages-0.9.9.18 lib/refinery/pages/admin/instance_methods.rb
refinerycms-pages-0.9.9.17 lib/refinery/pages/admin/instance_methods.rb
refinerycms-pages-0.9.9.16 lib/refinery/pages/admin/instance_methods.rb