From 20490dbd399d16e14dc774eb444d813e58542818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 15 May 2018 21:28:19 +0200 Subject: [PATCH] Add indicator for tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- css/style.scss | 14 ++++++++++++++ js/controller/BoardController.js | 16 ++++++++++++++++ templates/part.board.mainView.php | 4 ++++ 3 files changed, 34 insertions(+) diff --git a/css/style.scss b/css/style.scss index d5248aff3..8180a4ac6 100644 --- a/css/style.scss +++ b/css/style.scss @@ -457,6 +457,20 @@ input.input-inline { } } + .card-tasks { + border-radius: 3px; + margin: 4px 4px 4px 0px; + padding: 0 2px; + font-size: 90%; + opacity: 0.5; + display: flex; + align-items: center; + + .icon { + background-size: contain; + } + } + button { padding: 22px; margin: 0; diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index 2d2d1e374..6d4d7e615 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -49,6 +49,22 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St }, true); $scope.params = $state; + /** + * Check for markdown checkboxes in description to render the counter + * + * This should probably be moved to the backend at some point + * + * @param text + * @returns array of [finished, total] checkboxes + */ + $scope.getCheckboxes = function(text) { + const regTotal = /\[(X|\s|\_|\-)\]\s(.*)/ig; + const regFinished = /\[(X|\_|\-)\]\s(.*)/ig; + return [ + ((text || '').match(regFinished) || []).length, + ((text || '').match(regTotal) || []).length + ]; + }; $scope.search = function (searchText) { $scope.searchText = searchText; diff --git a/templates/part.board.mainView.php b/templates/part.board.mainView.php index 1de9a543b..05dff539f 100644 --- a/templates/part.board.mainView.php +++ b/templates/part.board.mainView.php @@ -80,6 +80,10 @@ {{ c.duedate | relativeDateFilterString }} +
+ + {{ getCheckboxes(c.description)[0] }}/{{ getCheckboxes(c.description)[1] }} +