-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaultmainjs.js
71 lines (64 loc) · 1.6 KB
/
defaultmainjs.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
if (Meteor.isClient) {
Session.setDefault("showSpinner", false);
Session.setDefault("showCreateModal", false);
Template.registerHelper('session',function(input){
return Session.get(input);
});
Router.onBeforeAction(function () {
$('.button-collapse').sideNav('hide'); //Close slider
this.next();
});
Router.onStop(function () {
Session.set('showCreateModal', false);
});
Template.login.events({
'click #adminAcc': function () {
Meteor.call("createAdmin");
}
});
Template.ApplicationLayout.helpers({
showSpinner: function() {
return Session.get("showSpinner");
}
});
// counter starts at 0
Session.setDefault('counter', 0);
Template.header.events({
'click #menutoggle': function () {
if($('#sidebardiv').hasClass('active')){
$('body').css("overflow-y","hidden");
} else {
$('body').css("overflow-y","visible");
}
}
});
Template.header.helpers({
isAdmin: function () {
var role = Meteor.user().profile.roles;
if(role.indexOf("admin") > -1) {
return true;
} else {
return false;
}
}
});
Template.hello.helpers({
counter: function () {
return Session.get('counter');
}
});
Template.hello.events({
'click button': function () {
// increment the counter when button is clicked
Session.set('counter', Session.get('counter') + 1);
}
});
toggleSpinner = function(boolean) {
Session.set("showSpinner", boolean);
};
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}