Merge pull request 'fix(contactForm): use member contact when on member's page' (#82) from fix/member-contact-instead-of-main-contact into master

Reviewed-on: AstrolabeCAE/SiteWebAstrolabe#82
This commit is contained in:
Florent Le Saout 2024-03-20 15:04:23 +01:00
commit 21a1efbf7c
3 changed files with 10 additions and 1 deletions

View File

@ -53,6 +53,12 @@
</article> </article>
<a class="return-link" href="/equipe/">Voir tous les membres</a> <a class="return-link" href="/equipe/">Voir tous les membres</a>
</section> </section>
{% if emailSlug %}
{% set contactMember = emailSlug %}
{% elif url %}
{% set contactMember = url | replace("/members/","") %}
{% endif %}
{% set contactTitle = ["Écrire à ",name] | join %}
{% include "partials/components/contact-form.njk" %} {% include "partials/components/contact-form.njk" %}
</main> </main>
{% endblock %} {% endblock %}

View File

@ -1,12 +1,14 @@
{% from "macros/form.njk" import label, field, select, option, textarea, checkboxes, button, hidden_field %} {% from "macros/form.njk" import label, field, select, option, textarea, checkboxes, button, hidden_field %}
<section class="[ form-container ]"> <section class="[ form-container ]">
{% if not contactMember %} {% if not removeWave %}
<svg aria-hidden="true" viewBox="0 0 1440 131" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M0 0h1440v131H0z"/><path d="M0 4.643l40-2.326c40-2.5 120-6.888 200 11.67 80 18.735 160 60.854 240 74.894 80 14.04 160 0 240-16.365 80-16.54 160-34.968 240-28.08 80 7.152 160 39.619 240 39.75 80-.131 160-32.598 200-49.139l40-16.365V131H0V4.643z" fill="#D6F253"/></svg> <svg aria-hidden="true" viewBox="0 0 1440 131" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M0 0h1440v131H0z"/><path d="M0 4.643l40-2.326c40-2.5 120-6.888 200 11.67 80 18.735 160 60.854 240 74.894 80 14.04 160 0 240-16.365 80-16.54 160-34.968 240-28.08 80 7.152 160 39.619 240 39.75 80-.131 160-32.598 200-49.139l40-16.365V131H0V4.643z" fill="#D6F253"/></svg>
{% endif %} {% endif %}
<div class="[ inner-wrapper ]"> <div class="[ inner-wrapper ]">
{% if not contactMember %} {% if not contactMember %}
<h2 id="contact-form" class="[ contact-heading ]">Nous contacter</h2> <h2 id="contact-form" class="[ contact-heading ]">Nous contacter</h2>
{% elif contactTitle %}
<h2 id="contact-form" class="[ contact-heading ]">{{ contactTitle }}</h2>
{% endif %} {% endif %}
<form name="contact" method="POST" action="/form/contact-form-handler.php"> <form name="contact" method="POST" action="/form/contact-form-handler.php">
<ol class="[ field-list ]"> <ol class="[ field-list ]">

View File

@ -31,6 +31,7 @@ permalink: '/members/{{ member.fileSlug }}/contact/'
{% else %} {% else %}
{% set contactMember = member.fileSlug | replace("-",".") %} {% set contactMember = member.fileSlug | replace("-",".") %}
{% endif %} {% endif %}
{% set removeWave = true %}
{% include "partials/components/contact-form.njk" %} {% include "partials/components/contact-form.njk" %}
</div> </div>
</div> </div>