2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('nav')].helpers({
|
2014-08-15 11:51:30 +09:00
|
|
|
primaryNav: function () {
|
|
|
|
return primaryNav;
|
|
|
|
},
|
|
|
|
hasPrimaryNav: function () {
|
|
|
|
return !!primaryNav.length;
|
|
|
|
},
|
|
|
|
secondaryNav: function () {
|
|
|
|
return secondaryNav;
|
|
|
|
},
|
|
|
|
hasSecondaryNav: function () {
|
|
|
|
return !!secondaryNav.length;
|
2014-06-23 11:40:21 +09:00
|
|
|
},
|
2014-08-15 11:56:53 +09:00
|
|
|
dropdownClass: function () {
|
2014-08-15 12:30:51 +09:00
|
|
|
return getThemeSetting('useDropdowns', true) ? 'has-dropdown' : 'no-dropdown';
|
2014-08-15 11:56:53 +09:00
|
|
|
},
|
2014-08-13 17:12:52 +09:00
|
|
|
getTemplate: function () {
|
|
|
|
return getTemplate(this);
|
|
|
|
},
|
2014-08-12 16:16:44 +09:00
|
|
|
userMenu: function () {
|
|
|
|
return getTemplate('userMenu');
|
|
|
|
},
|
2012-09-29 12:28:51 +09:00
|
|
|
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_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');
|
2013-04-06 16:50:40 +09:00
|
|
|
}
|
2013-11-14 23:01:59 -05:00
|
|
|
});
|
2013-11-15 15:29:39 +09:00
|
|
|
|
2014-07-13 11:32:37 +09:00
|
|
|
Template[getTemplate('nav')].rendered = function(){
|
|
|
|
if(!Meteor.loggingIn() && !Meteor.user()){
|
2013-11-15 15:29:39 +09:00
|
|
|
$('.login-link-text').text("Sign Up/Sign In");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('nav')].events({
|
2013-11-15 15:29:39 +09:00
|
|
|
'click #logout': function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
Meteor.logout();
|
|
|
|
},
|
2014-07-09 09:46:24 +09:00
|
|
|
'click .mobile-menu-button': function(e){
|
2013-11-15 15:29:39 +09:00
|
|
|
e.preventDefault();
|
|
|
|
$('body').toggleClass('mobile-nav-open');
|
|
|
|
},
|
|
|
|
'click .login-header': function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
Router.go('/account');
|
2014-07-13 11:32:37 +09:00
|
|
|
},
|
2014-09-16 15:18:27 -04:00
|
|
|
'click #login-name-link': function(){
|
2014-07-13 11:32:37 +09:00
|
|
|
if(Meteor.user() && !$('account-link').exists()){
|
2014-09-16 15:46:48 -04:00
|
|
|
var $loginButtonsLogout = $('#login-buttons-logout');
|
|
|
|
$loginButtonsLogout.before('<a href="/users/'+Meteor.user().slug+'" class="account-link button">View Profile</a>');
|
|
|
|
$loginButtonsLogout.before('<a href="/account" class="account-link button">Edit Account</a>');
|
|
|
|
}
|
2013-11-15 15:29:39 +09:00
|
|
|
}
|
2013-11-24 16:13:53 +02:00
|
|
|
});
|