-
Notifications
You must be signed in to change notification settings - Fork 5
/
layer_client.js
37 lines (32 loc) · 1.19 KB
/
layer_client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Template.registerHelper('RouterLayerPathFor', function(routeName, options) {
return routeName && RouterLayer.pathFor(routeName, options.hash);
});
Template.registerHelper('RouterLayerIsActiveRoute', function(routeName, options) {
return routeName && RouterLayer.isActiveRoute(routeName, options.hash) ? 'active': null;
});
Template.registerHelper('RouterLayerIsActiveRoutePartial', function(routeName) {
return routeName && RouterLayer.isActiveRoutePartial(routeName) ? 'active': null;
});
if (RouterLayer.router == 'flow-router') {
Template.registerHelper('yield', function() {
if (this.templateContent) {
return this.templateContent;
} else {
return this.content && Template[this.content()];
}
});
Template.registerHelper('Layout', new Template('flowRouter_newTemplate', function () {
var data = { layout: this._templateInstance.data.template, content: this.templateContentBlock }
return Blaze.With(data, function() {
return Template.flowRouter_layoutHelper
});
}));
Template.flowRouter_layoutHelper.helpers({
data: function() {
return { templateContent: this.content };
},
template: function() {
return this.layout;
}
})
}