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

[sort] fix, rewrote

This commit is contained in:
llj
2016-09-08 16:26:23 +08:00
parent a11925b033
commit 585d0163d0
6 changed files with 184 additions and 182 deletions

View File

@@ -87,14 +87,17 @@ define([
this.$emptyTip.hide();
this.renderReposHd();
this.$tableBody.empty();
this.repos = Common.sortCollection(this.repos);
// sort
Common.updateSortIconByMode({'context': this.$el});
Common.sortLibs({'libs': this.repos});
this.repos.each(this.addOne, this);
this.$table.show();
} else {
this.$table.hide();
this.$emptyTip.show();
}
Common.updateSortIconByMode(this);
},
showRepoList: function() {
@@ -125,17 +128,9 @@ define([
},
sortByName: function() {
if (app.pageOptions.sort_mode == 'name_up') {
// change sort mode
Cookies.set('sort_mode', 'name_down');
app.pageOptions.sort_mode = 'name_down';
} else {
Cookies.set('sort_mode', 'name_up');
app.pageOptions.sort_mode = 'name_up';
}
Common.updateSortIconByMode(this);
this.repos = Common.sortCollection(this.repos);
Common.toggleSortByNameMode();
Common.updateSortIconByMode({'context': this.$el});
Common.sortLibs({'libs': this.repos});
this.$tableBody.empty();
this.repos.each(this.addOne, this);
@@ -145,17 +140,9 @@ define([
},
sortByTime: function() {
if (app.pageOptions.sort_mode == 'time_down') {
// change sort mode
Cookies.set('sort_mode', 'time_up');
app.pageOptions.sort_mode = 'time_up';
} else {
Cookies.set('sort_mode', 'time_down');
app.pageOptions.sort_mode = 'time_down';
}
Common.updateSortIconByMode(this);
this.repos = Common.sortCollection(this.repos);
Common.toggleSortByTimeMode();
Common.updateSortIconByMode({'context': this.$el});
Common.sortLibs({'libs': this.repos});
this.$tableBody.empty();
this.repos.each(this.addOne, this);