mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
[myhome side nav] bugfix for 'cur tab'
This commit is contained in:
@@ -528,8 +528,8 @@
|
||||
<% } %>
|
||||
</div>
|
||||
<ul class="side-tabnav-tabs">
|
||||
<li class="tab tab-cur"><a href="{{ SITE_ROOT }}#" class="lib">{% trans "Libraries" %}</a></li>
|
||||
<li class="tab"><a href="{{ SITE_ROOT }}#starred/" class="star">{% trans "Starred" %}</a></li>
|
||||
<li class="tab<% if (cur_tab == 'libs') { %> tab-cur<% } %>"><a href="{{ SITE_ROOT }}#" class="lib">{% trans "Libraries" %}</a></li>
|
||||
<li class="tab<% if (cur_tab == 'starred') { %> tab-cur<% } %>"><a href="{{ SITE_ROOT }}#starred/" class="star">{% trans "Starred" %}</a></li>
|
||||
|
||||
<% if (events_enabled) { %>
|
||||
<li class="tab"><a href="{{ SITE_ROOT }}activities/" class="activity">{% trans "Activities" %}</a></li>
|
||||
|
@@ -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();
|
||||
},
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user