mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
Reimplement sysadmin with backbone
This commit is contained in:
39
static/scripts/sysadmin-app/views/side-nav.js
Normal file
39
static/scripts/sysadmin-app/views/side-nav.js
Normal file
@@ -0,0 +1,39 @@
|
||||
define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common'
|
||||
], function($, _, Backbone, Common) {
|
||||
'use strict';
|
||||
|
||||
var sideNavView = Backbone.View.extend({
|
||||
el: '#side-nav',
|
||||
|
||||
template: _.template($("#side-nav-tmpl").html()),
|
||||
|
||||
initialize: function() {
|
||||
this.default_cur_tab = 'dashboard';
|
||||
this.data = {
|
||||
'cur_tab': this.default_cur_tab
|
||||
};
|
||||
this.render();
|
||||
this.$el.show();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.data));
|
||||
return this;
|
||||
},
|
||||
|
||||
setCurTab: function(cur_tab, options) {
|
||||
this.data.cur_tab = cur_tab || this.default_cur_tab;
|
||||
if (options) {
|
||||
$.extend(this.data, options);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return sideNavView;
|
||||
});
|
Reference in New Issue
Block a user