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

add 'updateGroups' for side-nav, and other improvement

This commit is contained in:
llj
2016-01-09 14:35:16 +08:00
parent e1981509c6
commit ec6679e448
7 changed files with 58 additions and 29 deletions

View File

@@ -17,6 +17,7 @@ define([
this.data = {
'cur_tab': this.default_cur_tab,
'show_group_list': false, // when cur_tab is not 'group'
'groups': app.pageOptions.groups,
'mods_enabled': app.pageOptions.user_mods_enabled,
'can_add_repo': app.pageOptions.can_add_repo,
};
@@ -85,13 +86,32 @@ define([
});
},
setCurTab: function (cur_tab, options) {
setCurTab: function(cur_tab, options) {
this.data.cur_tab = cur_tab || this.default_cur_tab;
if (options) {
$.extend(this.data, options);
}
this.data.show_group_list = $('#group-nav .grp-list:visible').length ? true : false;
this.render();
},
updateGroups: function() {
var _this = this;
$.ajax({
url: Common.getUrl({name: 'groups'}),
type: 'GET',
dataType: 'json',
cache: false,
success: function(data) {
data.sort(function(a, b) {
return Common.compareTwoWord(a.name, b.name);
});
_this.data.groups = data;
_this.render();
},
error: function() {
}
});
}
});