summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyload/web/app/scripts/controller.js28
-rw-r--r--pyload/web/app/templates/default/header/blank.html4
2 files changed, 28 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();
diff --git a/pyload/web/app/templates/default/header/blank.html b/pyload/web/app/templates/default/header/blank.html
new file mode 100644
index 000000000..305477d4e
--- /dev/null
+++ b/pyload/web/app/templates/default/header/blank.html
@@ -0,0 +1,4 @@
+<div class="span3">
+ <div class="logo"></div>
+ <span class="title visible-large-screen">pyLoad</span>
+</div> \ No newline at end of file