code refactor
This commit is contained in:
parent
e1cca4d772
commit
cd346fd821
|
@ -215,6 +215,10 @@
|
|||
});
|
||||
};
|
||||
|
||||
$scope.isAllTasksSelected = function () {
|
||||
return $rootScope.taskContext.isAllSelected();
|
||||
};
|
||||
|
||||
$scope.selectAllTasks = function () {
|
||||
$rootScope.taskContext.selectAll();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue