Reputation: 3
I'm new to Sails and seems that I cannot find an elegant way to use multiple layouts with sails v.10.
My site has two different sections: public website and admin side. I don't want to set the layout separately for every action for different controllers in the app's admin section. It seems that policies might be the way to handle this but for some reason it's not working and couldn't find details how to handle this from Sails's documentation or around the web.
I think the following way of doing it results in repetition:
module.exports = {
index: function(req, res){
res.view({ layout: 'layoutadmin' });
}
}
Any pointers?
Thanks,
J
Upvotes: 0
Views: 183
Reputation: 1608
res.locals.layout = 'layoutadmin';
This should work inside a policy. If it doesnt, problem is somewhere else.
Upvotes: 1