code refactor

This commit is contained in:
MaysWind 2018-11-10 22:25:32 +08:00
parent e1cca4d772
commit cd346fd821
2 changed files with 18 additions and 9 deletions

View file

@ -215,6 +215,10 @@
});
};
$scope.isAllTasksSelected = function () {
return $rootScope.taskContext.isAllSelected();
};
$scope.selectAllTasks = function () {
$rootScope.taskContext.selectAll();
};

View file

@ -133,15 +133,7 @@
return result;
},
selectAll: function () {
if (!this.list || !this.selected || this.list.length < 1) {
return;
}
if (!this.enableSelectAll) {
return;
}
isAllSelected: function () {
var isAllSelected = true;
for (var i = 0; i < this.list.length; i++) {
@ -153,6 +145,19 @@
}
}
return isAllSelected;
},
selectAll: function () {
if (!this.list || !this.selected || this.list.length < 1) {
return;
}
if (!this.enableSelectAll) {
return;
}
var isAllSelected = this.isAllSelected();
for (var i = 0; i < this.list.length; i++) {
var task = this.list[i];
this.selected[task.gid] = !isAllSelected;