mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-22 03:16:34 +00:00
[sort] new interaction for 'myhome shared libs'
This commit is contained in:
@@ -100,8 +100,9 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
sortByName: function() {
|
sortByName: function() {
|
||||||
|
$('.by-time .sort-icon', this.$table).hide();
|
||||||
var repos = this.repos;
|
var repos = this.repos;
|
||||||
var el = $('.by-name', this.$table);
|
var el = $('.by-name .sort-icon', this.$table);
|
||||||
repos.comparator = function(a, b) { // a, b: model
|
repos.comparator = function(a, b) { // a, b: model
|
||||||
var result = Common.compareTwoWord(a.get('name'), b.get('name'));
|
var result = Common.compareTwoWord(a.get('name'), b.get('name'));
|
||||||
if (el.hasClass('icon-caret-up')) {
|
if (el.hasClass('icon-caret-up')) {
|
||||||
@@ -113,13 +114,14 @@ define([
|
|||||||
repos.sort();
|
repos.sort();
|
||||||
this.$tableBody.empty();
|
this.$tableBody.empty();
|
||||||
repos.each(this.addOne, this);
|
repos.each(this.addOne, this);
|
||||||
el.toggleClass('icon-caret-up icon-caret-down');
|
el.toggleClass('icon-caret-up icon-caret-down').show();
|
||||||
repos.comparator = null;
|
repos.comparator = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
sortByTime: function() {
|
sortByTime: function() {
|
||||||
|
$('.by-name .sort-icon', this.$table).hide();
|
||||||
var repos = this.repos;
|
var repos = this.repos;
|
||||||
var el = $('.by-time', this.$table);
|
var el = $('.by-time .sort-icon', this.$table);
|
||||||
repos.comparator = function(a, b) { // a, b: model
|
repos.comparator = function(a, b) { // a, b: model
|
||||||
if (el.hasClass('icon-caret-down')) {
|
if (el.hasClass('icon-caret-down')) {
|
||||||
return a.get('mtime') < b.get('mtime') ? 1 : -1;
|
return a.get('mtime') < b.get('mtime') ? 1 : -1;
|
||||||
@@ -130,7 +132,7 @@ define([
|
|||||||
repos.sort();
|
repos.sort();
|
||||||
this.$tableBody.empty();
|
this.$tableBody.empty();
|
||||||
repos.each(this.addOne, this);
|
repos.each(this.addOne, this);
|
||||||
el.toggleClass('icon-caret-up icon-caret-down');
|
el.toggleClass('icon-caret-up icon-caret-down').show();
|
||||||
repos.comparator = null;
|
repos.comparator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user