Skip to content

Commit de22677

Browse files
Merge pull request #38 from itk-dev/feature/5260-qr-url-changes
5260: url changes
2 parents f0ad1ef + 7c7082f commit de22677

34 files changed

+986
-134
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/.env.*.local
55
/config/secrets/prod/prod.decrypt.private.php
66
/public/bundles/
7+
/public/uploads/qr-logos/
78
/var/
89
/vendor/
910
###< symfony/framework-bundle ###

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ See [keep a changelog] for information about writing changes to this log.
88

99
## [Unreleased]
1010

11+
[PR-41](https://github.com/itk-dev/itqr/pull/41)
12+
- Added archived concept
13+
[PR-40](https://github.com/itk-dev/itqr/pull/40)
14+
- Added styling to static page.
15+
[PR-39](https://github.com/itk-dev/itqr/pull/39)
16+
- Added various help texts and in-platform-documentation.
17+
[PR-38](https://github.com/itk-dev/itqr/pull/38)
18+
- Limit number of URLs to 1
19+
- Increase URL data type from varchar to text
1120
[PR-37](https://github.com/itk-dev/itqr/pull/37)
1221
- Rename "theme" to "design" in general
1322
- Rename "delete" to "archive" in general

assets/app.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import './styles/app.css';
22

33
const uploadBasePath = 'uploads/qr_codes/';
4+
45
document.addEventListener('DOMContentLoaded', () => {
6+
// Enforce only one URL per QR code.
7+
handleQrUrlCollection();
8+
59
const qrCodeContainer = document.getElementById('qrCodeContainer');
610
const tabsContainer = document.getElementById('qrCodeTabs'); // Navigation tabs
711
const tabContentContainer = document.getElementById('qrCodeTabContent'); // Tab content
812
const form = document.querySelector('.form-wrapper form');
9-
const formName = form.getAttribute('name');
13+
const formName = form ? form.getAttribute('name') : '';
1014
const selectedQrCodes = document.getElementById('selectedQrCodes');
1115

1216
// Ensure all containers and elements exist
1317
if (!qrCodeContainer || !tabsContainer || !tabContentContainer || !form) {
14-
console.error('Required elements not found!');
18+
console.log('Required elements not found');
1519
return;
1620
}
1721

@@ -200,6 +204,37 @@ function handleBatchDisableConfirm() {
200204
});
201205
}
202206

207+
function handleQrUrlCollection() {
208+
const qrUrlCollectionParent = document.querySelector('.qr-urls-collection');
209+
const qrUrlCollectionAddButton = document.querySelector('.qr-urls-collection .field-collection-add-button');
210+
const urlCollectionCount = qrUrlCollectionParent ? parseInt(qrUrlCollectionParent.getAttribute('data-num-items')) : null;
211+
212+
// If the button exists, and no URL is added - add it!
213+
if (qrUrlCollectionAddButton) {
214+
setTimeout(() => {
215+
if (urlCollectionCount !== null && urlCollectionCount === 0) {
216+
qrUrlCollectionAddButton.click();
217+
}
218+
}, 1)
219+
220+
// Hide the add-button if there is already an URL added.
221+
if (parseInt(urlCollectionCount) === 1) {
222+
qrUrlCollectionAddButton.classList.add('d-none');
223+
}
224+
225+
// Handle the click event and hide add-button if an URL was added and the number of URLs is 1.
226+
qrUrlCollectionAddButton.addEventListener('click', () => {
227+
setTimeout(() => {
228+
const urlCollectionCount = qrUrlCollectionParent.getAttribute('data-num-items');
229+
230+
if (parseInt(urlCollectionCount) === 1) {
231+
qrUrlCollectionAddButton.classList.add('d-none');
232+
}
233+
}, 1)
234+
});
235+
}
236+
}
237+
203238
document.addEventListener('readystatechange', function(event) {
204239
if ('complete' === document.readyState) {
205240
handleBatchDisableConfirm();

assets/styles/app.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,8 @@ form[name="batch_download"] .accordion-button {
101101
background-color: #fff;
102102
border-bottom: 1px solid #e9e9e9;
103103
}
104+
105+
106+
.qr-urls-collection .accordion-button {
107+
display: none;
108+
}

assets/styles/archived.css

Lines changed: 162 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/styles/static.css

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
:root {
2+
--spacer-md: 1rem;
3+
--spacer-lg: calc(var(--spacer-md) * 2);
4+
--shadow-color: 240deg 27% 62%;
5+
--shadow-elevation-low:
6+
0.3px 0.3px 0.4px hsl(var(--shadow-color) / 0.34),
7+
0.4px 0.4px 0.6px -1.7px hsl(var(--shadow-color) / 0.28),
8+
0.9px 1px 1.3px -3.5px hsl(var(--shadow-color) / 0.21);
9+
--shadow-elevation-medium:
10+
0.3px 0.3px 0.4px hsl(var(--shadow-color) / 0.29),
11+
0.5px 0.6px 0.8px -0.9px hsl(var(--shadow-color) / 0.25),
12+
1px 1.2px 1.5px -1.7px hsl(var(--shadow-color) / 0.22),
13+
2.2px 2.6px 3.3px -2.6px hsl(var(--shadow-color) / 0.19),
14+
4.5px 5.2px 6.7px -3.5px hsl(var(--shadow-color) / 0.16);
15+
--shadow-elevation-high:
16+
0.3px 0.3px 0.4px hsl(var(--shadow-color) / 0.27),
17+
0.7px 0.8px 1px -0.4px hsl(var(--shadow-color) / 0.25),
18+
1.2px 1.4px 1.8px -0.8px hsl(var(--shadow-color) / 0.24),
19+
1.9px 2.2px 2.8px -1.2px hsl(var(--shadow-color) / 0.22),
20+
2.9px 3.4px 4.4px -1.6px hsl(var(--shadow-color) / 0.21),
21+
4.5px 5.2px 6.7px -1.9px hsl(var(--shadow-color) / 0.19),
22+
6.7px 7.8px 10px -2.3px hsl(var(--shadow-color) / 0.18),
23+
9.7px 11.3px 14.5px -2.7px hsl(var(--shadow-color) / 0.16),
24+
13.6px 16px 20.5px -3.1px hsl(var(--shadow-color) / 0.14),
25+
18.7px 21.9px 28.1px -3.5px hsl(var(--shadow-color) / 0.13);
26+
}
27+
*, *::before, *::after {
28+
box-sizing: border-box;
29+
}
30+
31+
* {
32+
margin: 0;
33+
}
34+
35+
@media (prefers-reduced-motion: no-preference) {
36+
html {
37+
interpolate-size: allow-keywords;
38+
}
39+
}
40+
41+
body {
42+
line-height: 1.5;
43+
-webkit-font-smoothing: antialiased;
44+
font-family: 'Roboto', sans-serif;
45+
background-color: ghostwhite;
46+
}
47+
48+
img, picture, video, canvas, svg {
49+
display: block;
50+
max-width: 100%;
51+
}
52+
53+
input, button, textarea, select {
54+
font: inherit;
55+
}
56+
57+
p, h1, h2, h3, h4, h5, h6 {
58+
overflow-wrap: break-word;
59+
}
60+
61+
p {
62+
text-wrap: pretty;
63+
}
64+
65+
h1, h2, h3, h4, h5, h6 {
66+
text-wrap: balance;
67+
}
68+
69+
#root, #__next {
70+
isolation: isolate;
71+
}
72+
73+
.container {
74+
background-color: #fff;
75+
display: flex;
76+
flex-direction: column;
77+
min-height: 100vh;
78+
max-width: 800px;
79+
margin: 0 auto;
80+
padding: 0 var(--spacer-md);
81+
> h1 {
82+
font-size: clamp(1.75rem, 4.5vw, 3rem);
83+
margin: var(--spacer-md) 0;
84+
}
85+
86+
> p {
87+
88+
}
89+
}
90+
91+
@media screen and (min-width: 800px) {
92+
.container {
93+
padding: 0 var(--spacer-lg);
94+
}
95+
}

config/packages/security.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ security:
1313
dev:
1414
pattern: ^/(_(profiler|wdt)|css|images|js)/
1515
security: false
16+
api:
17+
pattern: ^/api
18+
stateless: true
1619
main:
1720
custom_authenticators:
1821
- App\Security\AzureOIDCAuthenticator

config/routes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ root_redirect:
77
path: /
88
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
99
defaults:
10-
route: 'qr_index'
10+
route: 'admin'
1111
permanent: true

0 commit comments

Comments
 (0)