Reputation: 41
I have a ruby sinatra app that uses haml. I use layout.haml for a common menu across all pages. Let's say I have login.haml, main.haml and reports.haml. I only want to use layout.haml for login.haml and main.haml. How do I exclude layout.haml from reports.haml? thanks
Upvotes: 4
Views: 2542
Reputation: 4796
Two (and a somewhat) ways:
class MyApp < Sinatra::Base
set :haml, :layout => false
get '/reports' do
haml :reports
end
end
If the number of routes that do not require layouts are less, then this is a pattern:
class MyApp < Sinatra::Base
get '/reports' do
haml :reports, :layout => false
end
end
If the routes that don't need a layout.haml
file are more, however, Sinatra does not seem to support overriding the global declaration of set :haml, :layout => false
. I've taken the liberty to open up an issue for this feature as it seems reasonable enough (Hope you won't mind).
Upvotes: 9