summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-09-17 16:56:19 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-09-17 16:56:19 +0200
commitc94d6a88aac7f5de2582d133d1660c7739673d02 (patch)
treef8efbe9d6d1f07e35387e4ed825c1b910421294e /pyload/web/app/scripts
parentaccount deletion fix (diff)
downloadpyload-c94d6a88aac7f5de2582d133d1660c7739673d02.tar.xz
improved login / logout rendering
Diffstat (limited to 'pyload/web/app/scripts')
-rw-r--r--pyload/web/app/scripts/controller.js28
1 files changed, 24 insertions, 4 deletions
diff --git a/pyload/web/app/scripts/controller.js b/pyload/web/app/scripts/controller.js
index 683454522..9a892323f 100644
--- a/pyload/web/app/scripts/controller.js
+++ b/pyload/web/app/scripts/controller.js
@@ -6,6 +6,7 @@ define([
// Views
'views/headerView',
+ 'hbs!tpl/header/blank',
'views/notificationView',
'views/dashboard/dashboardView',
'views/dashboard/selectionView',
@@ -14,16 +15,32 @@ define([
'views/settings/settingsView',
'views/accounts/accountListView'
], function(
- App, Backbone, $, _, HeaderView, NotificationView, DashboardView, SelectionView, FilterView, LoginView, SettingsView, AccountListView) {
+ App, Backbone, $, _, HeaderView, blankHeader, NotificationView, DashboardView, SelectionView, FilterView, LoginView, SettingsView, AccountListView) {
'use strict';
- // TODO some views does not need to be loaded instantly
-
return {
+ // resets the main views
+ reset: function() {
+ if (App.header.currentView) {
+ App.header.currentView.close();
+ App.header.$el.html(blankHeader());
+ App.header.currentView = null;
+ }
+ if (App.content.currentView) {
+ App.content.currentView.close();
+ }
+
+ if (App.actionbar.currentView) {
+ App.actionbar.currentView.close();
+ }
+ },
+
header: function() {
if (!App.header.currentView) {
App.header.show(new HeaderView());
App.header.currentView.init();
+ }
+ if (!App.notification.currentView) {
App.notification.attachView(new NotificationView());
}
},
@@ -33,7 +50,6 @@ define([
App.actionbar.show(new FilterView());
- // TODO: not completely visible after reattaching
// now visible every time
if (_.isUndefined(App.selection.currentView) || _.isNull(App.selection.currentView))
App.selection.attachView(new SelectionView());
@@ -42,10 +58,14 @@ define([
},
login: function() {
+ this.reset();
+
App.content.show(new LoginView());
},
logout: function() {
+ this.reset();
+
$.ajax(App.apiRequest('logout', null, {
success: function() {
App.user.destroy();