aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb36
-rw-r--r--actionpack/lib/action_controller/new_base/layouts.rb26
2 files changed, 36 insertions, 26 deletions
diff --git a/actionpack/lib/action_controller/abstract/layouts.rb b/actionpack/lib/action_controller/abstract/layouts.rb
index c6b99a6d45..29b610610f 100644
--- a/actionpack/lib/action_controller/abstract/layouts.rb
+++ b/actionpack/lib/action_controller/abstract/layouts.rb
@@ -1,7 +1,43 @@
module AbstractController
module Layouts
+
+ def self.included(base)
+ base.extend ClassMethods
+ end
+
+ module ClassMethods
+ def _layout() end
+ end
+
def _render_template(template, options)
_action_view._render_template_with_layout(template, options[:_layout])
end
+
+ private
+
+ def _layout_for_option(name)
+ case name
+ when String then _layout_for_name(name)
+ when true then _default_layout(true)
+ when false then nil
+ end
+ end
+
+ def _layout_for_name(name)
+ view_paths.find_by_parts(name, formats, "layouts")
+ end
+
+ def _default_layout(require_layout = false)
+ # begin
+ # _layout_for_name(controller_path)
+ # rescue ActionView::MissingTemplate
+ # begin
+ # _layout_for_name("application")
+ # rescue ActionView::MissingTemplate => e
+ # raise e if require_layout
+ # end
+ # end
+ _layout_for_option(self.class._layout)
+ end
end
end \ No newline at end of file
diff --git a/actionpack/lib/action_controller/new_base/layouts.rb b/actionpack/lib/action_controller/new_base/layouts.rb
index 3b47a76077..c0efb669b2 100644
--- a/actionpack/lib/action_controller/new_base/layouts.rb
+++ b/actionpack/lib/action_controller/new_base/layouts.rb
@@ -7,31 +7,5 @@ module ActionController
super
end
-
- private
-
- def _layout_for_option(name)
- case name
- when String then _layout_for_name(name)
- when true then _default_layout(true)
- when false then nil
- end
- end
-
- def _layout_for_name(name)
- view_paths.find_by_parts(name, formats, "layouts")
- end
-
- def _default_layout(require_layout = false)
- begin
- _layout_for_name(controller_path)
- rescue ActionView::MissingTemplate
- begin
- _layout_for_name("application")
- rescue ActionView::MissingTemplate => e
- raise e if require_layout
- end
- end
- end
end
end \ No newline at end of file