From 19cb2f6458266e9c0f73d5cc67eaab20e75b1f7d Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 7 Jun 2025 00:23:36 +0200 Subject: [PATCH] up edit --- assets/app.js | 11 ++++++++--- assets/styles/app.css | 4 ++++ assets/utils.js | 23 +++++++++++++++++++++++ templates/base.html.twig | 3 +++ templates/public/edit.html.twig | 23 ++++++++++------------- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/assets/app.js b/assets/app.js index d7cda981..83767232 100644 --- a/assets/app.js +++ b/assets/app.js @@ -17,10 +17,13 @@ import './edit.js'; document.addEventListener('DOMContentLoaded', () => { console.log('DOMContentLoaded'); - + const randombg = genererCouleurPastel(); // Appliquer la couleur au body - document.body.style.backgroundColor = randombg; + + document.querySelectorAll('body, .edit-land, .body-landing').forEach(element => { + element.style.backgroundColor = randombg; + }); // Gestion du bouton pour afficher tous les champs const btnShowAllFields = document.querySelector('#showAllFields'); @@ -30,7 +33,9 @@ document.addEventListener('DOMContentLoaded', () => { // Sélectionner tous les inputs dans le formulaire const form = document.querySelector('form'); if (form) { - const hiddenInputs = form.querySelectorAll('.d-none'); + // Sélectionner tous les inputs sauf #validation_messages + const hiddenInputs = form.querySelectorAll('#advanced_tags'); + hiddenInputs.forEach(input => { input.classList.toggle('d-none'); }); diff --git a/assets/styles/app.css b/assets/styles/app.css index 0c9addc4..961f08ec 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -108,4 +108,8 @@ table.js-sort-table th:active { .end-hour { margin-left: -1rem; +} + +.good_filled { + border-color: green; } \ No newline at end of file diff --git a/assets/utils.js b/assets/utils.js index 834878e4..7358a945 100644 --- a/assets/utils.js +++ b/assets/utils.js @@ -16,6 +16,29 @@ function colorHeadingTable() { function check_validity(e) { + + list_inputs_good_to_fill = [ + 'input[name="commerce_tag_value__contact:email"]', + 'input[name="commerce_tag_value__contact:phone"]', + 'input[name="commerce_tag_value__contact:website"]', + 'commerce_tag_value__contact:mastodon', + 'input[name="commerce_tag_value__address"]', + 'input[name="custom_opening_hours"]', + 'input[name="commerce_tag_value__contact:street"]', + 'input[name="commerce_tag_value__contact:housenumber"]', + 'input[name="custom__cuisine"]', + ] + + list_inputs_good_to_fill.forEach(selector => { + const input = document.querySelector(selector); + if (input) { + if (input.value.trim() !== '') { + input.classList.add('good_filled'); + } else { + input.classList.remove('good_filled'); + } + } + }); let errors = []; document.querySelectorAll('.is-invalid').forEach(input => { input.classList.remove('is-invalid'); diff --git a/templates/base.html.twig b/templates/base.html.twig index 57255dc9..c53b2d1a 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -124,5 +124,8 @@ }); {% endblock %} + + {% block completion_progress %} + {% endblock %} diff --git a/templates/public/edit.html.twig b/templates/public/edit.html.twig index 8ed00345..c55b28a4 100644 --- a/templates/public/edit.html.twig +++ b/templates/public/edit.html.twig @@ -18,9 +18,7 @@ {% endblock %} {% block body %} -
-
-
+

{{ 'display.welcome'|trans }} {{ commerce_overpass.tags_converted.name }}

@@ -131,7 +129,7 @@
-
+
{{ 'display.last_modification'|trans }}: {{ commerce_overpass['@attributes'].timestamp }}, {{ 'display.days_ago'|trans({'%days%': date(commerce_overpass['@attributes'].timestamp).diff(date()).days}) }} {{ 'display.by'|trans }} @@ -149,13 +147,9 @@ -
- {# - - {{ 'display.view_stats'|trans }} - #} +
- + Dashboard @@ -167,11 +161,13 @@

-
+
-
+ +{% endblock %} +{% block completion_progress %}
@@ -186,7 +182,6 @@
- {% endblock %} {% block javascripts %} {{ parent() }} @@ -219,5 +214,7 @@ window.addEventListener('resize', () => { updateMapHeightForLargeScreens(); }); +check_validity(); + {% endblock %} \ No newline at end of file