client/top-nav: hide top nav for home

This commit is contained in:
rr- 2016-05-29 12:27:02 +02:00
parent bab88f4739
commit 1a6ea4f58a
1 changed files with 17 additions and 2 deletions

View File

@ -6,17 +6,32 @@ class TopNavView {
constructor() { constructor() {
this._template = views.getTemplate('top-nav'); this._template = views.getTemplate('top-nav');
this._navHolder = document.getElementById('top-nav-holder'); this._navHolder = document.getElementById('top-nav-holder');
this._lastCtx = null;
} }
render(ctx) { render(ctx) {
this._lastCtx = ctx;
const target = this._navHolder; const target = this._navHolder;
const source = this._template(ctx); const source = this._template(ctx);
views.showView(this._navHolder, source); views.showView(this._navHolder, source);
} }
show() {
this._navHolder.style.visibility = 'initial';
this._navHolder.style.position = 'initial';
}
hide() {
this._navHolder.style.visibility = 'hidden';
this._navHolder.style.position = 'fixed';
}
activate(itemName) { activate(itemName) {
if (itemName == 'home') {
this.hide();
} else {
this.show();
}
const allItemsSelector = '#top-nav-holder [data-name]'; const allItemsSelector = '#top-nav-holder [data-name]';
const currentItemSelector = const currentItemSelector =
'#top-nav-holder [data-name="' + itemName + '"]'; '#top-nav-holder [data-name="' + itemName + '"]';