1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 15:19:06 +00:00

[myhome side nav] bugfix for 'cur tab'

This commit is contained in:
llj
2015-07-22 11:59:50 +08:00
parent f9e28022fd
commit ebf1d7f8d0
3 changed files with 26 additions and 21 deletions

View File

@@ -13,21 +13,18 @@ define([
enableModTemplate: _.template($("#myhome-mods-enable-form-tmpl").html()),
initialize: function() {
},
render: function(cur_tab) {
this.$el.html(this.template({
this.default_cur_tab = 'libs';
this.data = {
'cur_tab': this.default_cur_tab,
'mods_enabled': app.pageOptions.user_mods_enabled,
'can_add_repo': app.pageOptions.can_add_repo,
'events_enabled': app.pageOptions.events_enabled
}));
this.$el.find('li').removeClass('tab-cur');
this.$el.find('a').each(function () {
if ($(this).attr('href').match(cur_tab)) {
$(this).parent().addClass('tab-cur');
return;
}
});
};
this.render();
},
render: function() {
this.$el.html(this.template(this.data));
return this;
},
@@ -80,8 +77,16 @@ define([
});
},
show: function(cur_tab) {
this.render(cur_tab);
show: function(options) {
if (options && options.cur_tab) {
this.data.cur_tab = options.cur_tab;
this.render();
} else {
if (this.data.cur_tab != this.default_cur_tab) {
this.data.cur_tab = this.default_cur_tab;
this.render();
}
}
this.$el.show();
},

View File

@@ -31,35 +31,35 @@ define([
},
showMyRepos: function() {
this.sideNavView.show('my-libs');
this.sideNavView.show();
this.currentView.hide();
this.reposView.show();
this.currentView = this.reposView;
},
showMySubRepos: function() {
this.sideNavView.show('my-libs');
this.sideNavView.show();
this.currentView.hide();
this.subReposView.show();
this.currentView = this.subReposView;
},
showSharedRepos: function() {
this.sideNavView.show('my-libs');
this.sideNavView.show();
this.currentView.hide();
this.sharedReposView.show();
this.currentView = this.sharedReposView;
},
showStarredFile: function() {
this.sideNavView.show('starred');
this.sideNavView.show({'cur_tab': 'starred'});
this.currentView.hide();
this.starredFileView.show();
this.currentView = this.starredFileView;
},
showDir: function(category, repo_id, path) {
this.sideNavView.show('my-libs');
this.sideNavView.show();
var path = path || '/';
this.currentView.hide();
this.dirView.showDir(category, repo_id, path);