aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract
diff options
context:
space:
mode:
authorYehuda Katz and Carl Lerche <wycats@gmail.com>2009-03-23 15:45:01 -0700
committerYehuda Katz and Carl Lerche <wycats@gmail.com>2009-03-23 15:45:01 -0700
commita501638e9dcf55e45613637c52e4169b6324f285 (patch)
treeafc99eff992a16b6b328563eb9db8cf707686cf2 /actionpack/lib/action_controller/abstract
parent34f058e082754bb726a4753fa26e8e8c082702c0 (diff)
downloadrails-a501638e9dcf55e45613637c52e4169b6324f285.tar.gz
rails-a501638e9dcf55e45613637c52e4169b6324f285.tar.bz2
rails-a501638e9dcf55e45613637c52e4169b6324f285.zip
Checkpoint
Diffstat (limited to 'actionpack/lib/action_controller/abstract')
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb36
1 files changed, 36 insertions, 0 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