From 9f5a5b8b4419fc265fdac469a7532a49160b9213 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Date: Wed, 12 Jan 2022 10:21:15 +0100 Subject: [PATCH] success-screen: Fixing success_screen__hide_ballot_tracker and success_screen__hide_qr_code options (#206) * success-screen: Fixing success_screen__hide_ballot_tracker and success_screen__hide_qr_code options The activation of the `election.presentation.extra_options.success_screen__hide_ballot_tracker` setting should not hide the Download Ballot ticket button in the voting booth success-screen, but it was doing that so we are fixing it. It also hiding the QR Code both in the success screen and within the PDF ballot ticket, so we are fixing that too. * do not show ballot tracker row in PDF if success_screen__hide_ballot_tracker set to true --- .../success-screen-directive.html | 4 +- .../success-screen-directive.js | 37 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/avBooth/success-screen-directive/success-screen-directive.html b/avBooth/success-screen-directive/success-screen-directive.html index dc2a1c83..f223c1c6 100644 --- a/avBooth/success-screen-directive/success-screen-directive.html +++ b/avBooth/success-screen-directive/success-screen-directive.html @@ -115,7 +115,7 @@

  + ng-if="election.presentation.extra_options.success_screen__hide_qr_code !== true"> avBooth.successBallotQrCode @@ -130,7 +130,7 @@

class="btn btn-primary btn-login" tabindex="0" ng-click="downloadBallotTicket()" - ng-if="!election.presentation.extra_options.success_screen__hide_ballot_tracker && election.presentation.extra_options.success_screen__hide_download_ballot_ticket !== true" + ng-if="election.presentation.extra_options.success_screen__hide_download_ballot_ticket !== true" target="_blank" ng-i18next> avBooth.downloadBallotTicket diff --git a/avBooth/success-screen-directive/success-screen-directive.js b/avBooth/success-screen-directive/success-screen-directive.js index 6c17629b..29c99789 100644 --- a/avBooth/success-screen-directive/success-screen-directive.js +++ b/avBooth/success-screen-directive/success-screen-directive.js @@ -133,6 +133,26 @@ angular.module('avBooth') function download(images) { + var ballotTrackerRow = ( + scope.election.presentation.extra_options && + scope.election.presentation.extra_options.success_screen__hide_ballot_tracker + ) ? + {} : + { + columns: [ + { + text: $i18next('avBooth.ballotTicket.tracker'), + style: 'cell', + width: '40%' + }, + { + text: scope.stateData.ballotHash.substr(0, 32) + ' ' + scope.stateData.ballotHash.substr(32, 32), + style: 'cell', + width: '*' + } + ] + }; + var docDefinition = { info: { title: scope.pdf.fileName, @@ -159,20 +179,7 @@ angular.module('avBooth') text: scope.election.presentation.extra_options && scope.election.presentation.extra_options.success_screen__ballot_ticket__h4 || $i18next('avBooth.ballotTicket.h4'), style: 'h4' }, - { - columns: [ - { - text: $i18next('avBooth.ballotTicket.tracker'), - style: 'cell', - width: '40%' - }, - { - text: scope.stateData.ballotHash.substr(0, 32) + ' ' + scope.stateData.ballotHash.substr(32, 32), - style: 'cell', - width: '*' - } - ] - }, + ballotTrackerRow, { columns: [ { @@ -395,7 +402,7 @@ angular.module('avBooth') function generateQrCode() { if ( !scope.election.presentation.extra_options || - !scope.election.presentation.extra_options.success_screen__hide_ballot_tracker + !scope.election.presentation.extra_options.success_screen__hide_qr_code ) { var typeNumber = 0; var errorCorrectionLevel = 'L';