-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2626 from MTES-MCT/feature/2609-technique-csp
[Technique] Améliorer la CSP
- Loading branch information
Showing
104 changed files
with
337 additions
and
3,221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
assets/controllers/back_signalement_view/form_acceptation_refus.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const refusAffectationButtons = document.querySelectorAll('button[name="signalement-affectation-response[deny]"]'); | ||
refusAffectationButtons.forEach(button => { | ||
button.addEventListener('click', function(event) { | ||
if (!confirm('Êtes-vous certain de vouloir refuser ce signalement ?')) { | ||
event.preventDefault(); | ||
} | ||
}); | ||
}); | ||
const refusValidationButtons = document.querySelectorAll('button[name="signalement-validation-response[deny]"]'); | ||
refusValidationButtons.forEach(button => { | ||
button.addEventListener('click', function(event) { | ||
if (!confirm('Êtes-vous certain de vouloir refuser ce signalement ?')) { | ||
event.preventDefault(); | ||
} | ||
}); | ||
}); | ||
const cancelRefusButton = document.querySelectorAll('button[name="signalement-affectation-response[accept]]"]'); | ||
cancelRefusButton.forEach(button => { | ||
button.addEventListener('click', function(event) { | ||
if (!confirm('Êtes-vous certain de vouloir accepter ce signalement ?')) { | ||
event.preventDefault(); | ||
} | ||
}); | ||
}); | ||
const validationButton = document.querySelectorAll('button[name="signalement-validation-response[accept]"]'); | ||
validationButton.forEach(button => { | ||
button.addEventListener('click', function(event) { | ||
if (!confirm('Êtes-vous certain de vouloir valider ce signalement ?')) { | ||
event.preventDefault(); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const setBadge = (el) => { | ||
let container = el.parentElement.querySelector('.selected__value'); | ||
if (el.value !== '') { | ||
let badge = document.createElement('span'); | ||
badge.classList.add('fr-badge', 'fr-badge--success', 'fr-m-1v') | ||
badge.innerText = el.selectedOptions[0].text; | ||
let input = document.createElement('input'); | ||
input.type = "hidden"; | ||
input.name = `${el.id}[]`; | ||
input.value = el.value; | ||
container.append(input); | ||
badge.setAttribute('data-value', el.value); | ||
container.querySelector('.fr-badge:not([data-value])')?.classList?.add('fr-hidden'); | ||
container.append(badge) | ||
el.selectedOptions[0].classList.add('fr-hidden') | ||
badge.addEventListener('click', (event) => { | ||
console.log(badge) | ||
removeBadge(badge); | ||
}) | ||
} else { | ||
container.querySelectorAll('.fr-badge[data-value]').forEach(badge => { | ||
removeBadge(badge); | ||
}) | ||
} | ||
return false; | ||
} | ||
const removeBadge = (badge) => { | ||
let val = badge.getAttribute('data-value'); | ||
let input = badge.parentElement.querySelector(`input[value="${val}"]`); | ||
let select = badge?.parentElement?.parentElement?.querySelector(`select`) ?? badge?.parentElement?.parentElement?.querySelector(`input[type="date"]`); | ||
select.querySelector(`option[value="${val}"]`)?.classList?.remove('fr-hidden'); | ||
input?.remove(); | ||
let badges = badge.parentElement.querySelectorAll('.fr-badge[data-value]').length !== 1; | ||
console.log(badge.parentElement.querySelectorAll('.fr-badge[data-value]').length) | ||
if (!badges) { | ||
badge?.parentElement?.querySelector('.fr-badge:not([data-value])')?.classList?.remove('fr-hidden'); | ||
if (select.tagName === 'SELECT') | ||
select.options[0].selected = true; | ||
} | ||
badge.remove(); | ||
} | ||
document?.querySelectorAll('.select-search-filter-form')?.forEach(select => { | ||
select.addEventListener( | ||
"change", | ||
() => { | ||
setBadge(select); | ||
}, | ||
false, | ||
); | ||
}) | ||
|
||
document?.querySelectorAll('[data-removable="true"]')?.forEach(removale => { | ||
removale.addEventListener('click', () => { | ||
removeBadge(removale); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
parameters: | ||
csp_parameters: | ||
default-src: "'none'" | ||
script-src: "'self' 'unsafe-inline' 'unsafe-eval' https://cdn.matomo.cloud/histologe.matomo.cloud/matomo.js https://cdn.jsdelivr.net/npm/leaflet@1.7.1/dist/ https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/ https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/ https://cdn.jsdelivr.net/npm/tippy.js@6/dist/ https://cdn.jsdelivr.net/npm/quill@2.0.2/dist/ https://cdn.jsdelivr.net/npm/tinymce@7.1.2/" | ||
style-src: "'self' 'unsafe-inline' https://cdn.jsdelivr.net/npm/leaflet@1.7.1/dist/ https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/ https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/ https://cdn.jsdelivr.net/npm/tippy.js@6/dist/ https://cdn.jsdelivr.net/npm/quill@2.0.2/dist/ https://cdn.jsdelivr.net/npm/tinymce@7.1.2/" | ||
style-src-attr: "'self' 'unsafe-inline'" | ||
img-src: "'self' data: blob: https://voxusagers.numerique.gouv.fr https://*.tile.openstreetmap.org https://cdn.jsdelivr.net https://jedonnemonavis.numerique.gouv.fr" | ||
connect-src: "'self' https://api-adresse.data.gouv.fr https://cdn.matomo.cloud https://histologe.matomo.cloud https://koumoul.com https://sentry.incubateur.net" | ||
font-src: "'self'" | ||
frame-src: "'none'" | ||
object-src: "'none'" | ||
base-uri: "'self'" | ||
form-action: "'self'" | ||
frame-ancestors: "'none'" | ||
media-src: "'self'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.