2012-09-25 09:20:49 +09:00
|
|
|
Template.nav.events = {
|
|
|
|
'click #logout': function(event){
|
2012-08-31 19:41:54 -04:00
|
|
|
event.preventDefault();
|
2012-09-25 09:20:49 +09:00
|
|
|
Meteor.logout();
|
2012-12-05 11:05:05 +09:00
|
|
|
},
|
|
|
|
'click #mobile-menu': function(event){
|
2012-09-18 10:00:53 +09:00
|
|
|
event.preventDefault();
|
2012-10-17 17:25:10 +09:00
|
|
|
$('body').toggleClass('mobile-nav-open');
|
2012-12-05 11:05:05 +09:00
|
|
|
},
|
|
|
|
'click .login-header': function(e){
|
2012-09-19 09:03:25 +09:00
|
|
|
e.preventDefault();
|
2012-11-21 14:28:18 +11:00
|
|
|
Meteor.Router.to('/account');
|
2012-09-19 09:03:25 +09:00
|
|
|
}
|
2012-09-29 12:28:51 +09:00
|
|
|
};
|
|
|
|
|
2012-10-08 16:49:01 +09:00
|
|
|
Template.nav.rendered=function(){
|
2012-10-18 15:04:31 +09:00
|
|
|
if(!Meteor.user()){
|
|
|
|
$('.login-link-text').text("Sign Up/Sign In");
|
|
|
|
}else{
|
|
|
|
$('#login-buttons-logout').before('<a href="/account" class="account-link button">My Account</a>');
|
|
|
|
}
|
2012-10-08 16:49:01 +09:00
|
|
|
};
|
|
|
|
|
2012-09-29 12:28:51 +09:00
|
|
|
Template.nav.helpers({
|
|
|
|
site_title: function(){
|
|
|
|
return getSetting('title');
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
logo_url: function(){
|
2012-09-29 12:28:51 +09:00
|
|
|
return getSetting('logoUrl');
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
logo_height: function(){
|
2012-09-29 12:28:51 +09:00
|
|
|
return getSetting('logoHeight');
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
logo_width: function(){
|
2012-09-29 12:28:51 +09:00
|
|
|
return getSetting('logoWidth');
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
logo_top: function(){
|
2012-09-29 12:28:51 +09:00
|
|
|
return Math.floor((70-getSetting('logoHeight'))/2);
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
logo_offset: function(){
|
2012-09-29 12:28:51 +09:00
|
|
|
return -Math.floor(getSetting('logoWidth')/2);
|
2012-10-05 11:02:03 +09:00
|
|
|
},
|
|
|
|
intercom: function(){
|
|
|
|
return !!getSetting('intercomId');
|
2012-10-05 13:59:40 +09:00
|
|
|
},
|
|
|
|
canPost: function(){
|
|
|
|
return canPost(Meteor.user());
|
2012-10-24 11:04:42 +09:00
|
|
|
},
|
|
|
|
requirePostsApproval: function(){
|
|
|
|
return getSetting('requirePostsApproval');
|
|
|
|
}
|
2012-09-29 12:28:51 +09:00
|
|
|
});
|