From da1c8b54510ee1436fefe97ba32372a08299b83e Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Fri, 17 Sep 2021 17:59:42 +0200 Subject: [PATCH 01/19] feat(check-all): added shift click functionality --- frontend/src/utils/check-all/check-all.js | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/check-all/check-all.js b/frontend/src/utils/check-all/check-all.js index b9796eeb5..e1bef2b09 100644 --- a/frontend/src/utils/check-all/check-all.js +++ b/frontend/src/utils/check-all/check-all.js @@ -18,6 +18,8 @@ export class CheckAll { _tableIndices; + _lastCheckedCell = null; + constructor(element, app) { if (!element) { throw new Error('Check All utility cannot be setup without an element!'); @@ -35,13 +37,44 @@ export class CheckAll { if (DEBUG_MODE > 0) console.log(this._columns); + + //Todo: 1 forEach loop - this._findCheckboxColumns().forEach(columnId => this._checkAllColumns.push(new CheckAllColumn(this._element, app, this._columns[columnId]))); + let checkboxColumns = this._findCheckboxColumns(); + + checkboxColumns.forEach(columnId => this._checkAllColumns.push(new CheckAllColumn(this._element, app, this._columns[columnId]))); + + checkboxColumns.forEach(columnId => { + let currentColumn = this._columns[columnId]; + currentColumn.forEach(el => el.addEventListener('click', (ev) => { + + if(ev.shiftKey && this.lastCheckedCell !== null) { + let lastClickedIndex = this._tableIndices.rowIndex(this._lastCheckedCell); + let currentCellIndex = this._tableIndices.rowIndex(el); + if(currentCellIndex > lastClickedIndex) + this._checkMultipleCells(lastClickedIndex, currentCellIndex, columnId); + else + this._checkMultipleCells(currentCellIndex, lastClickedIndex, columnId); + } else { + this._lastCheckedCell = el; + } + })); + + }); // mark initialized this._element.classList.add(CHECK_ALL_INITIALIZED_CLASS); } + _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { + for(let i=firstRowIndex; i<=lastRowIndex; i++) { + let cell = this._columns[columnId][i]; + if (cell.tagName !== 'TH') { + cell.querySelector(CHECKBOX_SELECTOR).checked = true; + } + } + } + _gatherColumns() { for (const rowIndex of Array(this._tableIndices.maxRow + 1).keys()) { for (const colIndex of Array(this._tableIndices.maxCol + 1).keys()) { @@ -97,6 +130,7 @@ class CheckAllColumn { this._checkAllCheckbox = document.createElement('input'); this._checkAllCheckbox.setAttribute('type', 'checkbox'); this._checkAllCheckbox.setAttribute('id', this._checkboxId); + th.insertBefore(this._checkAllCheckbox, th.firstChild); // set up new checkbox From 7d8fc4301bedee4d0f990a1ef5d657f457598a2f Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 21 Sep 2021 15:01:06 +0200 Subject: [PATCH 02/19] chore(check-range): added readme.md for checkrange util --- frontend/src/utils/inputs/checkrange.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 frontend/src/utils/inputs/checkrange.md diff --git a/frontend/src/utils/inputs/checkrange.md b/frontend/src/utils/inputs/checkrange.md new file mode 100644 index 000000000..894a3bd4f --- /dev/null +++ b/frontend/src/utils/inputs/checkrange.md @@ -0,0 +1,5 @@ +# Checkrange Utility +Is set on the table header of a specific row. Remembers the last checked checkbox. When the users shift-clicks another checkbox in the same row, all checkboxes in between are also checked. + +# Attribute: table:not([uw-no-check-all] +(will be setup on all tables which use the util check-all) \ No newline at end of file From c28dca7b76f60c9c34da845ef1322ae0e839d79f Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 21 Sep 2021 17:15:32 +0200 Subject: [PATCH 03/19] chore(check-all): removed checkrange from checkall --- frontend/src/utils/check-all/check-all.js | 28 ----------------------- 1 file changed, 28 deletions(-) diff --git a/frontend/src/utils/check-all/check-all.js b/frontend/src/utils/check-all/check-all.js index e1bef2b09..94115ffee 100644 --- a/frontend/src/utils/check-all/check-all.js +++ b/frontend/src/utils/check-all/check-all.js @@ -37,44 +37,16 @@ export class CheckAll { if (DEBUG_MODE > 0) console.log(this._columns); - - //Todo: 1 forEach loop let checkboxColumns = this._findCheckboxColumns(); checkboxColumns.forEach(columnId => this._checkAllColumns.push(new CheckAllColumn(this._element, app, this._columns[columnId]))); - checkboxColumns.forEach(columnId => { - let currentColumn = this._columns[columnId]; - currentColumn.forEach(el => el.addEventListener('click', (ev) => { - - if(ev.shiftKey && this.lastCheckedCell !== null) { - let lastClickedIndex = this._tableIndices.rowIndex(this._lastCheckedCell); - let currentCellIndex = this._tableIndices.rowIndex(el); - if(currentCellIndex > lastClickedIndex) - this._checkMultipleCells(lastClickedIndex, currentCellIndex, columnId); - else - this._checkMultipleCells(currentCellIndex, lastClickedIndex, columnId); - } else { - this._lastCheckedCell = el; - } - })); - - }); // mark initialized this._element.classList.add(CHECK_ALL_INITIALIZED_CLASS); } - _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { - for(let i=firstRowIndex; i<=lastRowIndex; i++) { - let cell = this._columns[columnId][i]; - if (cell.tagName !== 'TH') { - cell.querySelector(CHECKBOX_SELECTOR).checked = true; - } - } - } - _gatherColumns() { for (const rowIndex of Array(this._tableIndices.maxRow + 1).keys()) { for (const colIndex of Array(this._tableIndices.maxCol + 1).keys()) { From 337bf73067f2b98450d0388a1c064f0d2f9c456c Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 21 Sep 2021 17:17:22 +0200 Subject: [PATCH 04/19] feat(checkrange): new util checkrange --- frontend/src/utils/inputs/checkrange.js | 97 +++++++++++++++++++++++++ frontend/src/utils/inputs/inputs.js | 2 + 2 files changed, 99 insertions(+) create mode 100644 frontend/src/utils/inputs/checkrange.js diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js new file mode 100644 index 000000000..c65475b3a --- /dev/null +++ b/frontend/src/utils/inputs/checkrange.js @@ -0,0 +1,97 @@ +import { Utility } from '../../core/utility'; +import { TableIndices } from '../../lib/table/table'; + + +const CHECKRANGE_INITIALIZED_CLASS = 'checkrange--initialized'; +const CHECKBOX_SELECTOR = '[type="checkbox"]'; + + +@Utility({ + selector: 'table:not([uw-no-check-all])', + }) +export class CheckRange { + _lastCheckedCell = null; + _element; + _tableIndices + _columns = new Array(); + + constructor(element) { + if(!element) { + throw new Error('Check All Utility cannot be setup without an element'); + } + + this._element = element; + + if (this._element.classList.contains(CHECKRANGE_INITIALIZED_CLASS)) + return false; + + this._tableIndices = new TableIndices(this._element); + + this._gatherColumns(); + + let checkboxColumns = this._findCheckboxColumns(); + + checkboxColumns.forEach(columnId => this._setUpShiftClickOnColumn(columnId)); + + this._element.classList.add(CHECKRANGE_INITIALIZED_CLASS); + } + + _setUpShiftClickOnColumn(columnId) { + let column = this._columns[columnId]; + column.forEach(el => el.addEventListener('click', (ev) => { + + if(ev.shiftKey && this.lastCheckedCell !== null) { + let lastClickedIndex = this._tableIndices.rowIndex(this._lastCheckedCell); + let currentCellIndex = this._tableIndices.rowIndex(el); + if(currentCellIndex > lastClickedIndex) + this._checkMultipleCells(lastClickedIndex, currentCellIndex, columnId); + else + this._checkMultipleCells(currentCellIndex, lastClickedIndex, columnId); + } else { + this._lastCheckedCell = el; + } + })); + } + + _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { + for(let i=firstRowIndex; i<=lastRowIndex; i++) { + let cell = this._columns[columnId][i]; + if (cell.tagName !== 'TH') { + cell.querySelector(CHECKBOX_SELECTOR).checked = true; + } + } + } + + + _gatherColumns() { + for (const rowIndex of Array(this._tableIndices.maxRow + 1).keys()) { + for (const colIndex of Array(this._tableIndices.maxCol + 1).keys()) { + + const cell = this._tableIndices.getCell(rowIndex, colIndex); + + if (!cell) + continue; + + if (!this._columns[colIndex]) + this._columns[colIndex] = new Array(); + + this._columns[colIndex][rowIndex] = cell; + } + } + } + + _findCheckboxColumns() { + let checkboxColumnIds = new Array(); + this._columns.forEach((col, i) => { + if (this._isCheckboxColumn(col)) { + checkboxColumnIds.push(i); + } + }); + return checkboxColumnIds; + } + + _isCheckboxColumn(col) { + return col.every(cell => cell.tagName == 'TH' || cell.querySelector(CHECKBOX_SELECTOR)) + && col.some(cell => cell.querySelector(CHECKBOX_SELECTOR)); + } +} \ No newline at end of file diff --git a/frontend/src/utils/inputs/inputs.js b/frontend/src/utils/inputs/inputs.js index a072c2196..13d241895 100644 --- a/frontend/src/utils/inputs/inputs.js +++ b/frontend/src/utils/inputs/inputs.js @@ -2,6 +2,7 @@ import { Checkbox } from './checkbox'; import { FileInput } from './file-input'; import { FileMaxSize } from './file-max-size'; import { Password } from './password'; +import { CheckRange } from './checkrange'; import './inputs.sass'; import './radio-group.sass'; @@ -11,4 +12,5 @@ export const InputUtils = [ FileInput, FileMaxSize, Password, + CheckRange, ]; From ce6f09dd857f53dc8c350d7d29b2164c78645b59 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 28 Sep 2021 16:47:03 +0200 Subject: [PATCH 05/19] feat(checkrange): added tooltip --- frontend/src/utils/inputs/checkrange.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index c65475b3a..76f80260a 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -38,6 +38,7 @@ export class CheckRange { _setUpShiftClickOnColumn(columnId) { let column = this._columns[columnId]; + this._addToolTip(column[0]); column.forEach(el => el.addEventListener('click', (ev) => { if(ev.shiftKey && this.lastCheckedCell !== null) { @@ -53,6 +54,24 @@ export class CheckRange { })); } + _addToolTip(cell){ + console.log('adding Tooltip'); + let tooltipWrap = document.createElement('span'); + tooltipWrap.className = 'tooltip'; + + let tooltipContent = document.createElement('span'); + tooltipContent.className = 'tooltip__content'; + tooltipContent.appendChild(document.createTextNode('Shift Click to mark multiple cells.')); + tooltipWrap.append(tooltipContent); + + let tooltipHandle = document.createElement('span'); + tooltipHandle.className = 'tooltip__handle'; + tooltipWrap.append(tooltipHandle); + + let firstChild = cell.firstChild; + firstChild.parentNode.insertBefore(tooltipWrap, firstChild); + } + _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { for(let i=firstRowIndex; i<=lastRowIndex; i++) { let cell = this._columns[columnId][i]; From ed752b01c04d8e8958072b13c3ad300836b1a598 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 28 Sep 2021 17:29:21 +0200 Subject: [PATCH 06/19] chore(tooltips): implemented a library for frontend tooltips --- .../src/lib/tooltips/frontend-tooltips.js | 20 ++++++++++++++++++ frontend/src/utils/inputs/checkrange.js | 21 ++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 frontend/src/lib/tooltips/frontend-tooltips.js diff --git a/frontend/src/lib/tooltips/frontend-tooltips.js b/frontend/src/lib/tooltips/frontend-tooltips.js new file mode 100644 index 000000000..e81ece714 --- /dev/null +++ b/frontend/src/lib/tooltips/frontend-tooltips.js @@ -0,0 +1,20 @@ +export class FrontendTooltips { + + static addToolTip(element, text) { + console.log('adding Tooltip'); + let tooltipWrap = document.createElement('span'); + tooltipWrap.className = 'tooltip'; + + let tooltipContent = document.createElement('span'); + tooltipContent.className = 'tooltip__content'; + tooltipContent.appendChild(document.createTextNode(text)); + tooltipWrap.append(tooltipContent); + + let tooltipHandle = document.createElement('span'); + tooltipHandle.className = 'tooltip__handle'; + tooltipWrap.append(tooltipHandle); + + let firstChild = element.firstChild; + firstChild.parentNode.insertBefore(tooltipWrap, firstChild); + } +} \ No newline at end of file diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index 76f80260a..18f5ee2ff 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -1,5 +1,6 @@ import { Utility } from '../../core/utility'; import { TableIndices } from '../../lib/table/table'; +import { FrontendTooltips } from '../../lib/tooltips/frontend-tooltips'; const CHECKRANGE_INITIALIZED_CLASS = 'checkrange--initialized'; @@ -38,7 +39,7 @@ export class CheckRange { _setUpShiftClickOnColumn(columnId) { let column = this._columns[columnId]; - this._addToolTip(column[0]); + FrontendTooltips.addToolTip(column[0], 'Shift Click to mark multiple cells'); column.forEach(el => el.addEventListener('click', (ev) => { if(ev.shiftKey && this.lastCheckedCell !== null) { @@ -54,24 +55,6 @@ export class CheckRange { })); } - _addToolTip(cell){ - console.log('adding Tooltip'); - let tooltipWrap = document.createElement('span'); - tooltipWrap.className = 'tooltip'; - - let tooltipContent = document.createElement('span'); - tooltipContent.className = 'tooltip__content'; - tooltipContent.appendChild(document.createTextNode('Shift Click to mark multiple cells.')); - tooltipWrap.append(tooltipContent); - - let tooltipHandle = document.createElement('span'); - tooltipHandle.className = 'tooltip__handle'; - tooltipWrap.append(tooltipHandle); - - let firstChild = cell.firstChild; - firstChild.parentNode.insertBefore(tooltipWrap, firstChild); - } - _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { for(let i=firstRowIndex; i<=lastRowIndex; i++) { let cell = this._columns[columnId][i]; From da3b3391bd5aa9990dfb2818847cf8524ee68a9d Mon Sep 17 00:00:00 2001 From: ros Date: Tue, 19 Oct 2021 14:31:26 +0200 Subject: [PATCH 07/19] feat(erweiterung such-filter usersr): first try --- src/Handler/Users.hs | 11 +++++++++++ testdata/workflows | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Handler/Users.hs b/src/Handler/Users.hs index 29963c64e..01d46fc49 100644 --- a/src/Handler/Users.hs +++ b/src/Handler/Users.hs @@ -167,6 +167,15 @@ postUsersR = do -- Set.foldr (\needle acc -> acc E.||. (user E.^. UserDisplayName) `E.hasInfix` needle) eFalse (criterion :: Set.Set Text) E.any (\c -> user E.^. UserDisplayName `E.hasInfix` E.val c) criteria ) + , ( "user-ident", FilterColumn $ \user criterion -> case getLast (criterion :: Last Text) of + Nothing -> E.val True :: E.SqlExpr (E.Value Bool) + Just needle -> (E.castString (user E.^. UserIdent) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)) + ) + , ( "user-email", FilterColumn $ \user criterion -> case getLast (criterion :: Last Text) of + Nothing -> E.val True :: E.SqlExpr (E.Value Bool) + Just needle -> (E.castString (user E.^. UserEmail) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)) + E.||. (E.castString (user E.^. UserDisplayEmail) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)) +) , ( "matriculation", FilterColumn $ \user (criteria :: Set.Set Text) -> if | Set.null criteria -> E.true -- TODO: why can this be eFalse and work still? | otherwise -> E.any (\c -> user E.^. UserMatrikelnummer `E.hasInfix` E.val c) criteria @@ -192,6 +201,8 @@ postUsersR = do ] , dbtFilterUI = \mPrev -> mconcat [ prismAForm (singletonFilter "user-search") mPrev $ aopt textField (fslI MsgName) + , prismAForm (singletonFilter "user-ident") mPrev $ aopt textField (fslI MsgAdminUserIdent) + , prismAForm (singletonFilter "user-email") mPrev $ aopt textField (fslI MsgAdminUserEmail) -- , prismAForm (singletonFilter "matriculation" ) mPrev $ aopt textField (fslI MsgTableMatrikelNr) , prismAForm (singletonFilter "matriculation") mPrev $ aopt matriculationField (fslI MsgTableMatrikelNr) , prismAForm (singletonFilter "auth-ldap" . maybePrism _PathPiece) mPrev $ aopt (lift `hoistField` selectFieldList [(MsgAuthPWHash "", False), (MsgAuthLDAP, True)]) (fslI MsgAuthMode) diff --git a/testdata/workflows b/testdata/workflows index 39640b53f..071c245fb 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit 39640b53fb43578f35d17f7a0b6cdf7e3cdaa0bd +Subproject commit 071c245fbdd7d409f83627dbd705ac0d10a22d4f From 61c773f51cddb65dd0529f17799cbf7871023137 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 19 Oct 2021 20:51:07 +0200 Subject: [PATCH 08/19] feat(messages): added frontend translation class --- frontend/src/messages.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 frontend/src/messages.js diff --git a/frontend/src/messages.js b/frontend/src/messages.js new file mode 100644 index 000000000..1f1ce3574 --- /dev/null +++ b/frontend/src/messages.js @@ -0,0 +1,17 @@ +export class Translations { + static translations = { + 'checkrangeTooltip' : { + 'de' : 'Shift-Klick, um mehrere Zellen zu markieren.', + 'en' : 'Shift-click to mark multiple cells.', + }, + }; + + static getTranslation(key, language) { + let json = Translations.translations[key]; + if(language === 'en') { + return json.en; + } else { + return json.de; + } + } +}; \ No newline at end of file From e74b61065a5de811bd411c0e863fddf9b9baada0 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 19 Oct 2021 20:52:00 +0200 Subject: [PATCH 09/19] feat(tooltips): added translatable tooltip --- frontend/src/lib/tooltips/frontend-tooltips.js | 1 - frontend/src/utils/inputs/checkrange.js | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/tooltips/frontend-tooltips.js b/frontend/src/lib/tooltips/frontend-tooltips.js index e81ece714..a77c9d4a0 100644 --- a/frontend/src/lib/tooltips/frontend-tooltips.js +++ b/frontend/src/lib/tooltips/frontend-tooltips.js @@ -1,7 +1,6 @@ export class FrontendTooltips { static addToolTip(element, text) { - console.log('adding Tooltip'); let tooltipWrap = document.createElement('span'); tooltipWrap.className = 'tooltip'; diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index 18f5ee2ff..2abf5d582 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -1,6 +1,7 @@ import { Utility } from '../../core/utility'; import { TableIndices } from '../../lib/table/table'; import { FrontendTooltips } from '../../lib/tooltips/frontend-tooltips'; +import { Translations } from '../../messages'; const CHECKRANGE_INITIALIZED_CLASS = 'checkrange--initialized'; @@ -39,7 +40,9 @@ export class CheckRange { _setUpShiftClickOnColumn(columnId) { let column = this._columns[columnId]; - FrontendTooltips.addToolTip(column[0], 'Shift Click to mark multiple cells'); + let language = document.documentElement.lang; + let toolTipMessage = Translations.getTranslation('checkrangeTooltip', language); + FrontendTooltips.addToolTip(column[0], toolTipMessage); column.forEach(el => el.addEventListener('click', (ev) => { if(ev.shiftKey && this.lastCheckedCell !== null) { From b580503c1afe626b03b2bea1fdd2468bbf1bc125 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Mon, 25 Oct 2021 22:26:10 +0200 Subject: [PATCH 10/19] chore(backend): added testdata/workflows directory --- testdata/workflows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/workflows b/testdata/workflows index 1a788c67f..cf7dcf58c 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit 1a788c67fe98cadf1e29b0e328072437955fd660 +Subproject commit cf7dcf58c524176bbdd27ff279d68a5ab90cd06e From 05eda7c50a5a0c61b6c3058653b8b8017ad51005 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 3 Nov 2021 13:02:29 +0100 Subject: [PATCH 11/19] Apply 3 suggestion(s) to 2 file(s) --- frontend/src/utils/inputs/checkrange.js | 3 ++- testdata/workflows | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index 2abf5d582..061b4c975 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -19,7 +19,7 @@ export class CheckRange { constructor(element) { if(!element) { - throw new Error('Check All Utility cannot be setup without an element'); + throw new Error('Check Range Utility cannot be setup without an element'); } this._element = element; @@ -39,6 +39,7 @@ export class CheckRange { } _setUpShiftClickOnColumn(columnId) { + if (!this._columns || columnId < 0 || columnId >= this._columns.length) return; let column = this._columns[columnId]; let language = document.documentElement.lang; let toolTipMessage = Translations.getTranslation('checkrangeTooltip', language); diff --git a/testdata/workflows b/testdata/workflows index cf7dcf58c..c7301b6ed 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit cf7dcf58c524176bbdd27ff279d68a5ab90cd06e +Subproject commit c7301b6ed58b53be21199e4493cf791e7e91c4fd From 86ee2fb14c05e3b6a78c6c51bf961b6c41d3e5c5 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Wed, 3 Nov 2021 14:23:49 +0100 Subject: [PATCH 12/19] fix(frontend-tooltips): icon is shown --- frontend/src/lib/tooltips/frontend-tooltips.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/lib/tooltips/frontend-tooltips.js b/frontend/src/lib/tooltips/frontend-tooltips.js index a77c9d4a0..334c9f78b 100644 --- a/frontend/src/lib/tooltips/frontend-tooltips.js +++ b/frontend/src/lib/tooltips/frontend-tooltips.js @@ -11,6 +11,11 @@ export class FrontendTooltips { let tooltipHandle = document.createElement('span'); tooltipHandle.className = 'tooltip__handle'; + let icon = document.createElement('i'); + icon.classList.add('fas'); + icon.classList.add('fa-question-circle'); + tooltipHandle.append(icon); + console.log(tooltipHandle.innerHTML); tooltipWrap.append(tooltipHandle); let firstChild = element.firstChild; From b7073760eb995e09da3f626794f20b987840bd72 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Wed, 3 Nov 2021 18:55:40 +0100 Subject: [PATCH 13/19] chore(frontend-tooltips): icon after element --- frontend/src/lib/tooltips/frontend-tooltips.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/tooltips/frontend-tooltips.js b/frontend/src/lib/tooltips/frontend-tooltips.js index 334c9f78b..75535ddae 100644 --- a/frontend/src/lib/tooltips/frontend-tooltips.js +++ b/frontend/src/lib/tooltips/frontend-tooltips.js @@ -15,10 +15,8 @@ export class FrontendTooltips { icon.classList.add('fas'); icon.classList.add('fa-question-circle'); tooltipHandle.append(icon); - console.log(tooltipHandle.innerHTML); tooltipWrap.append(tooltipHandle); - - let firstChild = element.firstChild; - firstChild.parentNode.insertBefore(tooltipWrap, firstChild); + + element.append(tooltipWrap); } } \ No newline at end of file From 154f2e35cc0e154ff80002b2e0aff3a76afa1ed6 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Wed, 3 Nov 2021 19:05:13 +0100 Subject: [PATCH 14/19] feat(checkrange): unchecking a range is possible --- frontend/src/utils/inputs/checkrange.js | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index 061b4c975..ee6441b95 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -49,16 +49,25 @@ export class CheckRange { if(ev.shiftKey && this.lastCheckedCell !== null) { let lastClickedIndex = this._tableIndices.rowIndex(this._lastCheckedCell); let currentCellIndex = this._tableIndices.rowIndex(el); + let cell = this._columns[columnId][currentCellIndex]; if(currentCellIndex > lastClickedIndex) - this._checkMultipleCells(lastClickedIndex, currentCellIndex, columnId); + this._handleCellsInBetween(cell, lastClickedIndex, currentCellIndex, columnId); else - this._checkMultipleCells(currentCellIndex, lastClickedIndex, columnId); + this._handleCellsInBetween(cell, currentCellIndex, lastClickedIndex, columnId); } else { this._lastCheckedCell = el; } })); } + _handleCellsInBetween(cell, firstRowIndex, lastRowIndex, columnId) { + if(this._isChecked(cell)) { + this._uncheckMultipleCells(firstRowIndex, lastRowIndex, columnId); + } else { + this._checkMultipleCells(firstRowIndex, lastRowIndex, columnId); + } + } + _checkMultipleCells(firstRowIndex, lastRowIndex, columnId) { for(let i=firstRowIndex; i<=lastRowIndex; i++) { let cell = this._columns[columnId][i]; @@ -68,6 +77,19 @@ export class CheckRange { } } + _uncheckMultipleCells(firstRowIndex, lastRowIndex, columnId) { + for(let i=firstRowIndex; i<=lastRowIndex; i++) { + let cell = this._columns[columnId][i]; + if (cell.tagName !== 'TH') { + cell.querySelector(CHECKBOX_SELECTOR).checked = false; + } + } + } + + _isChecked(cell) { + return cell.querySelector(CHECKBOX_SELECTOR).checked; + } + _gatherColumns() { for (const rowIndex of Array(this._tableIndices.maxRow + 1).keys()) { From 028d1016cbbe7d8e859789edcacbdef072064d8f Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 17 Nov 2021 17:18:13 +0100 Subject: [PATCH 15/19] chore: update workflows --- testdata/workflows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/workflows b/testdata/workflows index c7301b6ed..cf7dcf58c 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit c7301b6ed58b53be21199e4493cf791e7e91c4fd +Subproject commit cf7dcf58c524176bbdd27ff279d68a5ab90cd06e From 52c4206527a8a25e4a81cd7dbbc13a879a39e988 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 18 Nov 2021 19:55:08 +0100 Subject: [PATCH 16/19] chore: bump workflows --- testdata/workflows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/workflows b/testdata/workflows index cf7dcf58c..d567d2957 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit cf7dcf58c524176bbdd27ff279d68a5ab90cd06e +Subproject commit d567d2957cd2a53fb79d2b60e650236509ffe726 From 8511a052742f8dcefed1471831d75a936d1f0557 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 24 Nov 2021 22:16:50 +0100 Subject: [PATCH 17/19] chore: bump workflows --- testdata/workflows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/workflows b/testdata/workflows index 071c245fb..d567d2957 160000 --- a/testdata/workflows +++ b/testdata/workflows @@ -1 +1 @@ -Subproject commit 071c245fbdd7d409f83627dbd705ac0d10a22d4f +Subproject commit d567d2957cd2a53fb79d2b60e650236509ffe726 From 7dbe1ac08aacbda3b145a0da394706273dd6c639 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Sun, 28 Nov 2021 15:11:42 +0100 Subject: [PATCH 18/19] fix(modal): modals are never destroyed --- frontend/src/utils/modal/modal.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/frontend/src/utils/modal/modal.js b/frontend/src/utils/modal/modal.js index 8f013572f..6b8e28a17 100644 --- a/frontend/src/utils/modal/modal.js +++ b/frontend/src/utils/modal/modal.js @@ -72,16 +72,7 @@ export class Modal { } destroy() { - this._eventManager.cleanUp(); - if (this._closerElement !== undefined) - this._closerElement.remove(); - if(this._triggerElement !== undefined) - this._triggerElement.classList.remove(MODAL_TRIGGER_CLASS); - if(this._modalsWrapper !== undefined) - this._modalsWrapper.remove(); - if(this._modalOverlay !== undefined) - this._modalOverlay.remove(); - this._element.classList.remove(MODAL_INITIALIZED_CLASS, MODAL_CLASS); + throw new Error('Destroying modals is not possible.'); } _ensureModalWrapper() { @@ -164,7 +155,6 @@ export class Modal { this._modalsWrapper.classList.remove(MODALS_WRAPPER_OPEN_CLASS); document.removeEventListener('keyup', this._onKeyUp); - this._app.utilRegistry.destroyAll(this._element); }; _fillModal(url) { From cceef60cb84b86593b573f43d055501f484881b8 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Sun, 28 Nov 2021 15:12:42 +0100 Subject: [PATCH 19/19] chore(navigate-away-prompt): add check if parent element contain a closed modal --- frontend/src/utils/form/navigate-away-prompt.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/form/navigate-away-prompt.js b/frontend/src/utils/form/navigate-away-prompt.js index da900ba72..69c430853 100644 --- a/frontend/src/utils/form/navigate-away-prompt.js +++ b/frontend/src/utils/form/navigate-away-prompt.js @@ -107,7 +107,7 @@ export class NavigateAwayPrompt { // allow the event to happen if the form was not touched by the // user (i.e. if the current FormData is equal to the initial FormData) // or the unload event was initiated by a form submit - if (!formDataHasChanged || this.unloadDueToSubmit) + if (!formDataHasChanged || this.unloadDueToSubmit || this._parentModalIsClosed()) return; // cancel the unload event. This is the standard to force the prompt to appear. @@ -117,4 +117,13 @@ export class NavigateAwayPrompt { // for all non standard compliant browsers we return a truthy value to activate the prompt. return true; } + + _parentModalIsClosed() { + const parentModal = this._element.closest('.modal'); + if (!parentModal) + return false; + + const modalClosed = !parentModal.classList.contains('modal--open'); + return modalClosed; + } }