client/views: refactor rendering

This commit is contained in:
rr-
2016-04-08 10:35:38 +02:00
parent 7871c69aa3
commit 0ceaa8da42
15 changed files with 147 additions and 97 deletions

View File

@ -18,7 +18,9 @@ class HelpController {
showHelpRoute(section) {
topNavController.activate('help');
this.helpView.render(section);
this.helpView.render({
section: section,
});
}
}

View File

@ -16,7 +16,7 @@ class HomeController {
indexRoute() {
topNavController.activate('home');
this.homeView.render();
this.homeView.render({});
}
notFoundRoute() {

View File

@ -32,17 +32,16 @@ class TopNavController {
'help': new NavigationItem('E', 'Help', '/help'),
};
events.listen(
events.Authentication,
() => {
this.updateVisibility();
this.topNavView.render(this.items, this.activeItem);
this.topNavView.activate(this.activeItem);
});
const rerender = () => {
this.updateVisibility();
this.topNavView.render({
items: this.items,
activeItem: this.activeItem});
this.topNavView.activate(this.activeItem);
};
this.updateVisibility();
this.topNavView.render(this.items, this.activeItem);
this.topNavView.activate(this.activeItem);
events.listen(events.Authentication, rerender);
rerender();
}
updateVisibility() {

View File

@ -54,7 +54,7 @@ class UsersController {
this.user = response.user;
next();
}).catch(response => {
this.userView.empty();
this.userView.emptyView(this.userView.contentHolder);
events.notify(events.Error, response.description);
});
}