From 790dc63c504cda99839315258196180bc158fd0a Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Wed, 3 Jun 2020 12:05:58 +0200 Subject: [PATCH] dordogne-cd24: add commune contact extra cell (#43427) --- static/dordogne-cd24/_custom.scss | 19 +++++++++--- static/dordogne-cd24/config.json | 12 +++++++ static/dordogne-cd24/extra.js | 8 +++++ .../combo/json/contact-commune.html | 31 +++++++++++++++++++ .../combo/json/contact-service.html | 4 +-- 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 static/dordogne-cd24/extra.js create mode 100644 templates/variants/dordogne-cd24/combo/json/contact-commune.html diff --git a/static/dordogne-cd24/_custom.scss b/static/dordogne-cd24/_custom.scss index dc0232f6..abe37571 100644 --- a/static/dordogne-cd24/_custom.scss +++ b/static/dordogne-cd24/_custom.scss @@ -590,10 +590,18 @@ div.linkcell.homepage-link { /* customize json contact service cell */ div.cell.contact-service { background: #f3f7fa; - .title { - font-weight: bold; +} + +/* customize json contact commune cell */ +div.cell.contact-commune { + > div > div { + margin-top: 10px; + background:#f4f7fa; } - h3 { +} + +div.cell.contact-service, div.cell.contact-commune { + h3.service-title { margin-left: 1em; margin-right: 1em; padding: 2em 0 2em 260px; @@ -604,7 +612,10 @@ div.cell.contact-service { background-position: top center; } } - > div > div { + .title { + font-weight: bold; + } + div.service-details, div.commune-details { display: flex; flex-wrap: wrap; > div { diff --git a/static/dordogne-cd24/config.json b/static/dordogne-cd24/config.json index e7c3f1e7..99c82e82 100644 --- a/static/dordogne-cd24/config.json +++ b/static/dordogne-cd24/config.json @@ -24,6 +24,18 @@ "required": true } ] + }, + "contact-commune": { + "cache_duration": 60, + "name": "Cellule coordonnées communes RGPD", + "url": "{{ webservice_url }}", + "form": [ + { + "label": "URL du webservice", + "varname": "webservice_url", + "required": true + } + ] } }, "COMBO_PUBLIC_TEMPLATES.update": { diff --git a/static/dordogne-cd24/extra.js b/static/dordogne-cd24/extra.js new file mode 100644 index 00000000..bdc6d24b --- /dev/null +++ b/static/dordogne-cd24/extra.js @@ -0,0 +1,8 @@ +$(function() { + $('div.contact-commune select').on('change', function() { + var $parent = $(this).parent(); + $parent.find('> div').hide(); + $parent.find('div#commune-' + this.value).show(); + }); + $('div.contact-commune select').trigger('change'); +}); diff --git a/templates/variants/dordogne-cd24/combo/json/contact-commune.html b/templates/variants/dordogne-cd24/combo/json/contact-commune.html new file mode 100644 index 00000000..e09d50c7 --- /dev/null +++ b/templates/variants/dordogne-cd24/combo/json/contact-commune.html @@ -0,0 +1,31 @@ +

Contacter l'organisme

+

Veuillez choisir votre commune

+ + +{% for contact in json.data %} + +{% endfor %} diff --git a/templates/variants/dordogne-cd24/combo/json/contact-service.html b/templates/variants/dordogne-cd24/combo/json/contact-service.html index 19decdaa..a8ea3240 100644 --- a/templates/variants/dordogne-cd24/combo/json/contact-service.html +++ b/templates/variants/dordogne-cd24/combo/json/contact-service.html @@ -1,8 +1,8 @@ {% load assets %} {% for contact in json.data %} -

{{contact.service}}

-
+

{{contact.service}}

+

Adresse postale:

{{contact.organisme}}