From bc930ab49f825ac258c39eb0a1e4cb4d31270798 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Tue, 28 Jul 2020 00:16:52 +0100 Subject: [PATCH 01/11] Copy to clipboard button --- .../Exercises/Applications/Application.vue | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index aadc52235..4c1295971 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -113,12 +113,25 @@ v-if="!isPanelView" class="govuk-!-margin-top-9" > -

- Personal details - - Any changes made here will also update the candidate information. - -

+
+

+ Personal details + + Any changes made here will also update the candidate information. + +

+
+
+ + + +
@@ -1862,6 +1875,19 @@ export default { pdf.save(`${fileName}.pdf`); }, + copyToClipboard() { + let content = document.querySelector('#panel-pack-div').innerText; + const el = document.createElement('textarea'); + el.value = content; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + document.querySelector('#clipboard-button').innerText = 'Copied'; + setTimeout(() => { + document.querySelector('#clipboard-button').innerText = 'Copy to clipboard'; + },3000); + }, downloadAsDoc() { const fileName = this.generateFilename; const content = document.querySelector('#panel-pack-div').outerHTML; @@ -1910,4 +1936,5 @@ export default { width: auto; } } + From cdac70f8de24c818bf138fd191ae2b7f81895225 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Tue, 28 Jul 2020 09:04:50 +0100 Subject: [PATCH 02/11] Fix failing test for header text application view --- src/views/Exercises/Applications/Application.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index 4c1295971..b7ad0532f 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -113,14 +113,12 @@ v-if="!isPanelView" class="govuk-!-margin-top-9" > -
-

- Personal details - - Any changes made here will also update the candidate information. - -

-
+

+ Personal details + + Any changes made here will also update the candidate information. + +

+
+ + + +
- +
-

+

Personal details Any changes made here will also update the candidate information.

-
- - - -
From b669c3f458de3cc59d077069c24f011133113579 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Tue, 28 Jul 2020 12:01:15 +0100 Subject: [PATCH 04/11] Linting fix --- src/views/Exercises/Applications/Application.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index db75b3b26..76b222235 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -109,11 +109,11 @@
- +
Date: Thu, 30 Jul 2020 18:04:03 +0100 Subject: [PATCH 05/11] Copy panel pack info apart from items marked print-none --- src/components/EditableField.vue | 2 +- .../Exercises/Applications/Application.vue | 42 ++++++++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/components/EditableField.vue b/src/components/EditableField.vue index 097d4b692..70da53b5e 100644 --- a/src/components/EditableField.vue +++ b/src/components/EditableField.vue @@ -34,7 +34,7 @@ {{ link }} diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index 76b222235..a3a8a6f28 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -46,7 +46,13 @@ > Download As Doc - +
-
-
- - -

Personal details - + Any changes made here will also update the candidate information.

@@ -1873,10 +1868,27 @@ export default { pdf.save(`${fileName}.pdf`); }, + removePrintNone(htmlCollection) { + const result = []; + if (!htmlCollection.classList.contains('print-none')) { + if (htmlCollection.children.length){ + Array.from(htmlCollection.children).forEach(element => { + result.push(this.removePrintNone(element)); + }); + } + result.push(htmlCollection.innerText); + } + return result; + }, copyToClipboard() { - let content = document.querySelector('#panel-pack-div').innerText; + const htmlCollection = (document.querySelector('#panel-pack-div')); + const virtualDiv = document.createElement('div'); + virtualDiv.innerHTML = htmlCollection.innerHTML; + const printNoneEls = virtualDiv.querySelectorAll('.print-none'); + printNoneEls.forEach(e => e.remove()); + console.log(virtualDiv.textContent === virtualDiv.innerText); const el = document.createElement('textarea'); - el.value = content; + el.value = virtualDiv.textContent.split(' ').join('\n'); document.body.appendChild(el); el.select(); document.execCommand('copy'); From 8602a909174378c85b779e9a69e0bc9c21aea3de Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Thu, 30 Jul 2020 18:06:28 +0100 Subject: [PATCH 06/11] remove console.log --- src/views/Exercises/Applications/Application.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index a3a8a6f28..e988c4883 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -1886,7 +1886,6 @@ export default { virtualDiv.innerHTML = htmlCollection.innerHTML; const printNoneEls = virtualDiv.querySelectorAll('.print-none'); printNoneEls.forEach(e => e.remove()); - console.log(virtualDiv.textContent === virtualDiv.innerText); const el = document.createElement('textarea'); el.value = virtualDiv.textContent.split(' ').join('\n'); document.body.appendChild(el); From 2b6fe28d04283fd914dac5540fffcb3dbd052e3b Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Fri, 31 Jul 2020 10:03:17 +0100 Subject: [PATCH 07/11] Remove unused function --- .../Exercises/Applications/Application.vue | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index ba2c8c1a3..86ae5863f 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -79,10 +79,8 @@
Created on -

- {{ application.createdAt | formatDate | showAlternative("Unknown") }} +

+ {{ new Date(application.createdAt) | formatDate('longdatetime') }}

@@ -94,7 +92,7 @@ v-if="isApplied" class="govuk-heading-m govuk-!-margin-bottom-0" > - {{ application.appliedAt | formatDate | showAlternative("Unknown") }} + {{ application.appliedAt | formatDate('longdatetime') }}

{ - result.push(this.removePrintNone(element)); - }); - } - result.push(htmlCollection.innerText); - } - return result; - }, copyToClipboard() { const htmlCollection = (document.querySelector('#panel-pack-div')); const virtualDiv = document.createElement('div'); From 4ebbbd9b0fe3b72dd8671394d8bdcd4ba1a5e075 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Fri, 31 Jul 2020 12:00:53 +0100 Subject: [PATCH 08/11] drop down button menu --- .../Exercises/Applications/Application.vue | 94 ++++++++++++++----- 1 file changed, 72 insertions(+), 22 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index 86ae5863f..d01681221 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -33,26 +33,37 @@

@@ -92,7 +103,7 @@ v-if="isApplied" class="govuk-heading-m govuk-!-margin-bottom-0" > - {{ application.appliedAt | formatDate('longdatetime') }} + {{ application.appliedAt | formatDate | showAlternative("Unknown") }}

From 1ffee62adad74f1053b99d8ef8076bad0199f6be Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Fri, 31 Jul 2020 12:31:10 +0100 Subject: [PATCH 09/11] Convert button collection to drop down --- .../Exercises/Applications/Application.vue | 61 ++++++------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/src/views/Exercises/Applications/Application.vue b/src/views/Exercises/Applications/Application.vue index d01681221..d6bc93a91 100644 --- a/src/views/Exercises/Applications/Application.vue +++ b/src/views/Exercises/Applications/Application.vue @@ -33,14 +33,21 @@