Skip to content

Instantly share code, notes, and snippets.

@bartonhammond
Last active September 30, 2015 21:39
Show Gist options
  • Save bartonhammond/6531571014c219ce8475 to your computer and use it in GitHub Desktop.
Save bartonhammond/6531571014c219ce8475 to your computer and use it in GitHub Desktop.
How to initialize menu option PostSubmit to hide. 'data-hidden' doesn't seem to work.
<template name="nav">
<div data-id="nav"
data-css="nav"
data-view="toolbar">
<div data-view="label"
data-label="{{t9n 'app.displayName'}}"
data-width=200>
</div>
<div data-view="menu">
<ul data-view="data">
<li data-id="menuHome"
data-href="/">{{t9n 'nav.menu.home'}}
</li>
<li data-id="menuPrivate"
data-href="{{pathFor 'postslist'}}">{{t9n 'nav.menu.postsList'}}
</li>
<li data-id="menuSubmit"
data-hidden=1
data-href="{{pathFor 'postSubmit'}}">{{t9n 'nav.menu.postSubmit'}}
</li>
</ul>
</div>
{{>navButton}}
</div>
</template>
'use strict';
Template.navButton.helpers({
text: function(){
var key = Meteor.userId() ?
WebixDefaults.texts.navSignOut : WebixDefaults.texts.navSignIn;
var text =T9n.get(key);
if ($$('nav-button')) {
$$('nav-button').define('label',text);
$$('nav-button').refresh();
}
return text;
},
dataClick: function() {
return `
if (!Meteor.userId()){
Router.go('/signin');
} else {
Meteor.logout(function() {
Router.go('/');
});
}`
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment