Last active
December 20, 2015 10:49
-
-
Save Pent/6118274 to your computer and use it in GitHub Desktop.
Template layout for Meteor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <body> | |
| {{>body}} | |
| </body> | |
| <template name="body"> | |
| {{renderPage layoutName}} | |
| </template> | |
| <template name="adminLayout"> | |
| {{>adminHeader}} | |
| {{>alerts}} | |
| {{renderPage}} | |
| </template> | |
| <template name="defaultLayout"> | |
| {{>defaultHeader}} | |
| {{>alerts}} | |
| {{renderPage}} | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Meteor.Router.add({ | |
| '/': {to: 'home', as: 'home' }, | |
| '/admin': {to: 'admin', as: 'admin' } | |
| }); | |
| Template.body.helpers({ | |
| layoutName: function() { | |
| switch (Meteor.Router.page()) { | |
| case 'home': | |
| return 'defaultLayout'; | |
| case 'admin': | |
| return 'adminLayout'; | |
| default: | |
| return 'defaultLayout'; | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment