Skip to content

Commit

Permalink
success-screen: Fixing success_screen__hide_ballot_tracker and succes…
Browse files Browse the repository at this point in the history
…s_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
  • Loading branch information
edulix authored Jan 12, 2022
1 parent 38885f7 commit 9f5a5b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h1 ng-i18next="avBooth.successTitle"></h1>

&nbsp;
<span
ng-if="!election.presentation.extra_options.success_screen__hide_ballot_tracker && election.presentation.extra_options.success_screen__hide_qr_code !== true">
ng-if="election.presentation.extra_options.success_screen__hide_qr_code !== true">
<span ng-i18next>
avBooth.successBallotQrCode
</span>
Expand All @@ -130,7 +130,7 @@ <h1 ng-i18next="avBooth.successTitle"></h1>
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
Expand Down
37 changes: 22 additions & 15 deletions avBooth/success-screen-directive/success-screen-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: [
{
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 9f5a5b8

Please sign in to comment.