From e9c3f0fb566d6f96a98449706f77aa689d12c716 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 7 Apr 2019 12:31:44 +0800 Subject: [PATCH] change select all to select all the displayed tasks --- src/scripts/controllers/list.js | 12 ------------ src/scripts/core/root.js | 21 +++++++++++++++++++++ src/views/list.html | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/scripts/controllers/list.js b/src/scripts/controllers/list.js index ecdb8ab..eebe4dc 100644 --- a/src/scripts/controllers/list.js +++ b/src/scripts/controllers/list.js @@ -66,18 +66,6 @@ }, silent); }; - $scope.filterByTaskName = function (task) { - if (!task || !angular.isString(task.taskName)) { - return false; - } - - if (!$rootScope.searchContext || !$rootScope.searchContext.text) { - return true; - } - - return (task.taskName.toLowerCase().indexOf($rootScope.searchContext.text.toLowerCase()) >= 0); - }; - $scope.getOrderType = function () { return ariaNgSettingService.getDisplayOrder(); }; diff --git a/src/scripts/core/root.js b/src/scripts/core/root.js index 81bd981..5b3e575 100644 --- a/src/scripts/core/root.js +++ b/src/scripts/core/root.js @@ -139,6 +139,10 @@ for (var i = 0; i < this.list.length; i++) { var task = this.list[i]; + if (!$rootScope.filterTask(task)) { + continue; + } + if (!this.selected[task.gid]) { isAllSelected = false; break; @@ -160,11 +164,28 @@ for (var i = 0; i < this.list.length; i++) { var task = this.list[i]; + + if (!$rootScope.filterTask(task)) { + continue; + } + this.selected[task.gid] = !isAllSelected; } } }; + $rootScope.filterTask = function (task) { + if (!task || !angular.isString(task.taskName)) { + return false; + } + + if (!$rootScope.searchContext || !$rootScope.searchContext.text) { + return true; + } + + return (task.taskName.toLowerCase().indexOf($rootScope.searchContext.text.toLowerCase()) >= 0); + }; + $rootScope.swipeActions = { leftSwipe: function () { if (isSidebarShowInSmallScreen()) { diff --git a/src/views/list.html b/src/views/list.html index 8f144b1..8bdd666 100644 --- a/src/views/list.html +++ b/src/views/list.html @@ -33,7 +33,7 @@
-