Skip to content

Commit

Permalink
* [feature] the sub-app can use the root project's layout now.
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Mar 6, 2012
1 parent be5759e commit ec12674
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions padrino-core/lib/padrino-core/application/rendering.rb
Expand Up @@ -101,6 +101,11 @@ def fetch_layout_path(given_layout=nil)
return cached_layout_path if cached_layout_path
has_layout_at_root = Dir["#{views}/#{layout_name}.*"].any?
layout_path = has_layout_at_root ? layout_name.to_sym : File.join('layouts', layout_name.to_s).to_sym
# Check the layout file is exists in sub-app?
# try to use the root project's layout if not
# added via riceball
has_layout = Dir["#{views}/#{layout_path}.*"].any?
layout_path = has_layout ? layout_path : File.join('..', '..', 'app', 'views', layout_path.to_s).to_sym
@_cached_layout[layout_name] = layout_path unless reload_templates?
layout_path
end
Expand Down

0 comments on commit ec12674

Please sign in to comment.