Skip to content

Commit 9f93aaa

Browse files
reloxx13andi34
authored andcommitted
add short help text below qr code
Change-Id: I1f3cbeaf58b2d56eda30e6450a25f88efb2e6e99
1 parent 71ce1b9 commit 9f93aaa

File tree

8 files changed

+92
-6
lines changed

8 files changed

+92
-6
lines changed

assets/js/core.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,12 +1225,24 @@ const photoBooth = (function () {
12251225
if (document.getElementById('resultQR')) {
12261226
document.getElementById('resultQR').remove();
12271227
}
1228+
const qrWrapper = document.createElement('div');
1229+
qrWrapper.id = 'resultQR';
1230+
qrWrapper.setAttribute('class', 'stage-code ' + config.qr.result);
1231+
12281232
const qrResultImage = document.createElement('img');
12291233
qrResultImage.src = environment.publicFolders.api + '/qrcode.php?filename=' + filename;
12301234
qrResultImage.alt = 'qr code';
1231-
qrResultImage.id = 'resultQR';
1232-
qrResultImage.setAttribute('class', 'stage-code ' + config.qr.result);
1233-
resultPage.append(qrResultImage);
1235+
qrResultImage.classList.add('stage-code__image');
1236+
qrWrapper.append(qrResultImage);
1237+
1238+
const qrShortText = config.qr.short_text;
1239+
if (qrShortText && qrShortText.length > 0) {
1240+
const qrCaption = document.createElement('p');
1241+
qrCaption.classList.add('stage-code__caption');
1242+
qrCaption.textContent = qrShortText;
1243+
qrWrapper.append(qrCaption);
1244+
}
1245+
resultPage.append(qrWrapper);
12341246
}
12351247

12361248
if (!filternav.hasClass('sidenav--open')) {

assets/js/photoswipe.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,28 @@ function initPhotoSwipeFromDOM(gallerySelector) {
184184
if (document.getElementById('pswpQR')) {
185185
document.getElementById('pswpQR').remove();
186186
}
187+
const qrWrapper = document.createElement('div');
188+
qrWrapper.id = 'pswpQR';
189+
qrWrapper.setAttribute('class', 'pswp-qrcode ' + config.qr.pswp);
187190
const qrImage = document.createElement('img');
191+
188192
qrImage.src =
189193
environment.publicFolders.api +
190194
'/qrcode.php?filename=' +
191195
pswp.currSlide.data.src.split('\\').pop().split('/').pop();
192196
qrImage.alt = 'qr code';
193-
qrImage.id = 'pswpQR';
194-
qrImage.setAttribute('class', 'pswp-qrcode ' + config.qr.pswp);
195-
$('.pswp').append(qrImage);
197+
qrImage.classList.add('pswp-qrcode__image');
198+
qrWrapper.append(qrImage);
199+
200+
const qrShortText = config.qr.short_text;
201+
if (qrShortText && qrShortText.length > 0) {
202+
const qrCaption = document.createElement('p');
203+
qrCaption.classList.add('pswp-qrcode__caption');
204+
qrCaption.textContent = qrShortText;
205+
qrWrapper.append(qrCaption);
206+
}
207+
208+
$('.pswp').append(qrWrapper);
196209
});
197210
}
198211
},

assets/sass/components/_stage.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@
137137
&-code {
138138
position: absolute;
139139
width: 10rem;
140+
box-sizing: border-box;
141+
text-align: center;
142+
color: #000;
143+
background: #fff;
144+
padding: 0.6rem;
145+
border-radius: var(--button-border-radius, 0.8rem);
146+
box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.16);
147+
display: flex;
148+
flex-direction: column;
149+
align-items: center;
150+
151+
&__image {
152+
display: block;
153+
width: 100%;
154+
height: auto;
155+
}
156+
157+
&__caption {
158+
margin: 0;
159+
display: inline-block;
160+
font-size: 1rem;
161+
line-height: 1;
162+
padding: 0;
163+
}
140164
&.left {
141165
left: 2rem;
142166
&--top {

assets/sass/vendor/_photoswipe.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@
8888
.pswp-qrcode {
8989
position: absolute;
9090
width: 8rem;
91+
box-sizing: border-box;
92+
background: #fff;
93+
color: #000;
94+
padding: 0.5rem;
95+
border-radius: var(--button-border-radius, 0.8rem);
96+
box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.16);
97+
display: flex;
98+
flex-direction: column;
99+
align-items: center;
100+
gap: 0.35rem;
101+
102+
&__image {
103+
display: block;
104+
width: 100%;
105+
height: auto;
106+
}
107+
108+
&__caption {
109+
margin: 0;
110+
font-size: 1.2rem;
111+
line-height: 1.2;
112+
text-align: center;
113+
}
114+
91115
&.left {
92116
left: 2rem;
93117
&--top {

lib/configsetup.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,13 @@
21072107
'name' => 'qr[append_filename]',
21082108
'value' => $config['qr']['append_filename'],
21092109
],
2110+
'qr_short_text' => [
2111+
'view' => 'advanced',
2112+
'type' => 'input',
2113+
'placeholder' => $defaultConfig['qr']['short_text'],
2114+
'name' => 'qr[short_text]',
2115+
'value' => htmlentities($config['qr']['short_text'] ?? ''),
2116+
],
21102117
'qr_custom_text' => [
21112118
'view' => 'advanced',
21122119
'type' => 'checkbox',

resources/lang/de.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@
615615
"manual:qr:qr_pswp": "Wählen Sie eine Position, um den QR-Code innerhalb der Galerie neben dem Bild anzuzeigen. QR-Code muss aktiviert sein. Wählen Sie \"hidden\" um den QR-Code auszublenden. Wenn Sie eine Position wählen, wird die QR Schaltfläche in der Galerie ausgeblendet.",
616616
"manual:qr:qr_result": "Wählen Sie eine Position, um den QR-Code direkt nach Aufnahme eines Bildes auf dem Ergebnisbildschirm anzuzeigen. Die QR-Code-Anzeige muss aktiviert sein. Wählen Sie \"versteckt\" um den QR-Code auszublenden.",
617617
"manual:qr:qr_text": "Definieren Sie einen eigenen Hilfetext, der unter dem QR-Code angezeigt wird.",
618+
"manual:qr:qr_short_text": "Optionaler kurzer Text direkt unter dem QR-Code (Ergebnis & Galerie). Leer lassen, um den Standard \"Zum Herunterladen scannen\" zu verwenden.",
618619
"manual:qr:qr_url": "Definieren Sie eine URL, auf die über den QR-Code verwiesen werden soll.",
619620
"manual:remotebuzzer:remotebuzzer_collagebutton": "Wenn aktiviert, kann die Collage über eine HTTP-Anfrage ausgelöst werden.",
620621
"manual:remotebuzzer:remotebuzzer_custombutton": "Wenn aktiviert, kann die benutzerdefinierte Aktion über eine HTTP-Anfrage ausgelöst werden.",
@@ -850,8 +851,10 @@
850851
"qr:qr_enabled": "QR-Codes aktivieren",
851852
"qr:qr_pswp": "QR-Code Position innerhalb der Galerie:",
852853
"qr:qr_result": "QR-Code Position auf Ergebnisbildschirm:",
854+
"qr:qr_short_text": "Kurzer QR-Text (unter dem Code)",
853855
"qr:qr_text": "Eigener Hilfetext",
854856
"qr:qr_url": "URL für QR-Code",
857+
"qrScanToDownload": "Zum Herunterladen scannen",
855858
"qrHelp": "Um das Bild auf Ihr Handy herunterzuladen, verbinden Sie sich mit dem WLAN:",
856859
"share": "Teilen",
857860
"viewer_photo_title": "Dein Foto",

resources/lang/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@
638638
"manual:qr:qr_enabled": "If enabled, a QR-Button is visible on the result screen and inside gallery. User can download a picture while scanning the QR Code. If you're accessing Photobooth via \"localhost\", \"127.0.0.1\" or if you have Photobooth installed inside a subfolder, please define IP address of the Photobooth web server to make the QR Code working. <p>Example if Photobooth can be accessed directly: <code>192.168.0.50</code>.</p><p>Example if Photobooth is installed inside a subfolder: <code>192.168.0.50/photobooth</code>.</p>",
639639
"manual:qr:qr_pswp": "Choose a position to show the QR Code inside the gallery aside the image. QR Code must be enabled. Choose \"hidden\" to hide the QR Code. Selecting a position hides the qr button inside the gallery.",
640640
"manual:qr:qr_result": "Choose a position to show the QR Code on the result screen directly after taking a picture. QR Code must be enabled. Choose \"hidden\" to hide the QR Code.",
641+
"manual:qr:qr_short_text": "Optional short caption shown directly under the QR code (result screen & gallery). Leave empty to use the default \"Scan to download\" text.",
641642
"manual:qr:qr_text": "Define own help text which will be visible below the QR Code.",
642643
"manual:qr:qr_url": "Define a URL to point at via QR Code.",
643644
"manual:remotebuzzer:remotebuzzer_collagebutton": "If enabled, collage can be triggered via HTTP request.",
@@ -890,6 +891,7 @@
890891
"qr:qr_enabled": "Use QR Codes",
891892
"qr:qr_pswp": "QR Code position inside the gallery:",
892893
"qr:qr_result": "QR Code position on result screen:",
894+
"qr:qr_short_text": "Short QR caption (below code)",
893895
"qr:qr_text": "Own help text",
894896
"qr:qr_url": "URL for QR Code",
895897
"qrHelp": "To download the picture to your smartphone, connect to the WiFi:",

src/Configuration/Section/QrConfiguration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function getNode(): NodeDefinition
1515
->booleanNode('enabled')->defaultValue(true)->end()
1616
->scalarNode('url')->defaultValue('')->end()
1717
->booleanNode('append_filename')->defaultValue(true)->end()
18+
->scalarNode('short_text')->defaultValue('')->end()
1819
->booleanNode('custom_text')->defaultValue(false)->end()
1920
->scalarNode('text')->defaultValue('')->end()
2021
->enumNode('result')

0 commit comments

Comments
 (0)