Permalink
Browse files

Remove one more place where core knows about pages and move it to pag…

…es instead.
  • Loading branch information...
1 parent 3788269 commit 4562f4dddf6232d7d3921bc5ca9811b3618a57f4 @parndt parndt committed Apr 1, 2011
View
22 core/lib/refinery/admin/base_controller.rb
@@ -31,24 +31,10 @@ def searching?
end
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
- # fallback to the default 404.html page.
- render :file => Rails.root.join("public", "404.html").cleanpath.to_s,
- :layout => false,
- :status => 404
- end
+ # fallback to the default 404.html page.
+ render :file => Rails.root.join("public", "404.html").cleanpath.to_s,
+ :layout => false,
+ :status => 404
end
protected
View
27 pages/lib/refinery/pages/admin/instance_methods.rb
@@ -0,0 +1,27 @@
+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
View
4 pages/lib/refinerycms-pages.rb
@@ -7,6 +7,9 @@ module Refinery
module Pages
autoload :InstanceMethods, File.expand_path('../refinery/pages/instance_methods', __FILE__)
+ module Admin
+ autoload :InstanceMethods, File.expand_path('../refinery/pages/admin/instance_methods', __FILE__)
+ end
class << self
attr_accessor :root
@@ -26,6 +29,7 @@ class Engine < ::Rails::Engine
refinery.after_inclusion do
::ApplicationController.send :include, ::Refinery::Pages::InstanceMethods
+ ::Admin::BaseController.send :include, ::Refinery::Pages::Admin::InstanceMethods
end
config.after_initialize do
View
4 pages/refinerycms-pages.gemspec
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
s.version = %q{0.9.9.15}
s.summary = %q{Pages engine for Refinery CMS}
s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
- s.date = %q{2011-04-01}
+ s.date = %q{2011-04-02}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com}
s.rubyforge_project = %q{refinerycms}
@@ -106,6 +106,8 @@ Gem::Specification.new do |s|
'lib/pages/tabs.rb',
'lib/refinery',
'lib/refinery/pages',
+ 'lib/refinery/pages/admin',
+ 'lib/refinery/pages/admin/instance_methods.rb',
'lib/refinery/pages/instance_methods.rb',
'lib/refinerycms-pages.rb',
'license.md',

0 comments on commit 4562f4d

Please sign in to comment.