allow user to prevent layout render
This commit is contained in:
parent
5f3eac0344
commit
898b36eab4
|
@ -363,6 +363,7 @@ module Sinatra
|
|||
end
|
||||
|
||||
def determine_layout(renderer, template, options)
|
||||
return if options[:layout] == false
|
||||
layout_from_options = options[:layout] || :layout
|
||||
layout = layouts[layout_from_options]
|
||||
layout ||= resolve_template(renderer, layout_from_options, options, false)
|
||||
|
|
|
@ -137,6 +137,20 @@ context "Haml" do
|
|||
|
||||
end
|
||||
|
||||
specify "can render with no layout" do
|
||||
layout do
|
||||
"X\n= yield\nX"
|
||||
end
|
||||
|
||||
get '/' do
|
||||
haml 'blake', :layout => false
|
||||
end
|
||||
|
||||
get_it '/'
|
||||
|
||||
body.should.equal "blake\n"
|
||||
end
|
||||
|
||||
specify "raises error if template not found" do
|
||||
get '/' do
|
||||
haml :not_found
|
||||
|
|
Loading…
Reference in New Issue