From a501638e9dcf55e45613637c52e4169b6324f285 Mon Sep 17 00:00:00 2001 From: Yehuda Katz and Carl Lerche Date: Mon, 23 Mar 2009 15:45:01 -0700 Subject: Checkpoint --- .../lib/action_controller/abstract/layouts.rb | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'actionpack/lib/action_controller/abstract') 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 -- cgit v1.2.3