-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to tell which regions have content rendered from a helper #75
Comments
From looking at the code I think this currently isn't possible. The regions are not stored on the BlazeLayout object, they only get passed into its methods. I'm looking for the same kind of functionality as you. Preferably so that I could do something like the following:
This could help reduce the number of layouts/templates needed, especially ones that are near identical to each other except for the fact that one is used instead of the other when an optional region has data. @arunoda Would moving the |
EDIT: On re-reading I realise this isn't exactly what you're looking for. This method will tell you which regions are coming through, but it doesn't tell you if the expected template for each region exists. Usually when you try to include a template that doesn't exist Meteor gets a bit grumpy and throws an error. It seems that with dynamic templates it just quietly does nothing. So if you use the below method it might not work exactly as expected. I have almost found a way to do this. You can try the following:
So with that method you can also use it to display something if a dynamic template is not going to be used. For example:
Hope that helps @joshfttb |
For example, I would like to write a template helper that adds a custom class only when I don't have a template in the navbar region. Is it possible to tell this from a template helper? Thanks!
The text was updated successfully, but these errors were encountered: