1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

Reimplement sysadmin with backbone

This commit is contained in:
Daniel Pan
2016-03-16 13:30:00 +08:00
committed by lian
parent fb439f1aef
commit 899f5241d4
11 changed files with 341 additions and 3 deletions

View File

@@ -0,0 +1,49 @@
/*global define*/
define([
'jquery',
'backbone',
'common',
'sysadmin-app/views/side-nav',
'sysadmin-app/views/dashboard'
], function($, Backbone, Common, SideNavView, DashboardView) {
"use strict";
var Router = Backbone.Router.extend({
routes: {
'': 'showDashboard',
'dashboard/': 'showDashboard',
// Default
'*actions': 'showDashboard'
},
initialize: function() {
Common.prepareApiCsrf();
Common.initAccountPopup();
this.sideNavView = new SideNavView();
app.ui = {
sideNavView: this.sideNavView
};
this.dashboardView = new DashboardView();
this.currentView = this.dashboardView;
$('#info-bar .close').click(Common.closeTopNoticeBar);
},
switchCurrentView: function(newView) {
if (this.currentView != newView) {
this.currentView.hide();
this.currentView = newView;
}
},
showDashboard: function() {
this.switchCurrentView(this.dashboardView);
this.sideNavView.setCurTab('dashboard');
}
});
return Router;
});