From 9a4926e55952112279790f71f38001d71971fb03 Mon Sep 17 00:00:00 2001 From: vgreb Date: Fri, 28 Aug 2026 21:02:07 +0200 Subject: [PATCH] =?UTF-8?q?Refonte=20visuelle=20des=20pages=20des=20societ?= =?UTF-8?q?=C3=A9s=20membres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/components/MainMenu.html.twig | 17 +- .../components/MainMenu/SubItem.html.twig | 15 ++ templates/layouts/site.html.twig | 4 + templates/site/_members_menu.html.twig | 9 - .../site/company_public_profile.html.twig | 160 +++++++++--------- .../company_public_profile_list.html.twig | 74 ++++---- templates/site/partials/_submenu.html.twig | 15 ++ 7 files changed, 154 insertions(+), 140 deletions(-) create mode 100644 templates/components/MainMenu/SubItem.html.twig delete mode 100644 templates/site/_members_menu.html.twig create mode 100644 templates/site/partials/_submenu.html.twig diff --git a/templates/components/MainMenu.html.twig b/templates/components/MainMenu.html.twig index 1fcf20c99..ad1648645 100644 --- a/templates/components/MainMenu.html.twig +++ b/templates/components/MainMenu.html.twig @@ -8,14 +8,19 @@ {% block account %}{% endblock %} - {% if this.entries.sub|length > 0 %} + {# Une page sans feuille CMS peut fournir son propre sous-menu via le bloc `sub`. #} + {% set custom_sub %}{% block sub %}{% endblock %}{% endset %} + + {% if custom_sub|trim is not empty or this.entries.sub|length > 0 %}
- {% for entry in this.entries.sub %} - - {% endfor %} + {% if custom_sub|trim is not empty %} + {{ custom_sub }} + {% else %} + {% for entry in this.entries.sub %} + {{ entry.feuille.nom }} + {% endfor %} + {% endif %}
{% endif %} diff --git a/templates/components/MainMenu/SubItem.html.twig b/templates/components/MainMenu/SubItem.html.twig new file mode 100644 index 000000000..a86c1cca3 --- /dev/null +++ b/templates/components/MainMenu/SubItem.html.twig @@ -0,0 +1,15 @@ +{# @prop variant 'default'|'active' Le type d'entrée #} +{# @block content Label de l'entrée #} +{%- props variant = 'default' -%} +{%- set style = html_cva( + base: "block pb-2 text-gray-800 border-b-3 hover:border-neutre-400 uppercase text-sm", + variants: { + variant: { + default: 'border-transparent', + active: 'border-black', + }, + }, +) -%} +
+ {%- block content %}{% endblock -%} +
diff --git a/templates/layouts/site.html.twig b/templates/layouts/site.html.twig index 6c34192f3..8a5464f84 100644 --- a/templates/layouts/site.html.twig +++ b/templates/layouts/site.html.twig @@ -14,6 +14,9 @@ {% endif %} {% endset %} + {# Sous-menu fourni par la page, pour celles qui n'ont pas de feuille CMS associée. #} + {% set submenu_content %}{% block submenu %}{% endblock %}{% endset %} +
@@ -44,6 +47,7 @@ {{ account_buttons }} + {{ submenu_content }}
diff --git a/templates/site/_members_menu.html.twig b/templates/site/_members_menu.html.twig deleted file mode 100644 index 13987074b..000000000 --- a/templates/site/_members_menu.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% include 'site/secondary_menu.html.twig' with { - menu: [ - { - "nom" : "Entreprises", - "lien": path('company_public_profile_list'), - 'is_active': current == "compagnies", - }, - ] -} only %} diff --git a/templates/site/company_public_profile.html.twig b/templates/site/company_public_profile.html.twig index 2b5c9d569..feb3d1668 100644 --- a/templates/site/company_public_profile.html.twig +++ b/templates/site/company_public_profile.html.twig @@ -1,17 +1,15 @@ -{% extends 'admin/association/membership/_base.html.twig' %} +{% extends 'layouts/site.html.twig' %} {% block submenu %} - {% include 'site/_members_menu.html.twig' with { - current: "compagnies" - } only %} + {# `matches` : la fiche d'une entreprise garde cet onglet actif. #} + {% include 'site/partials/_submenu.html.twig' with { items: [ + { label: 'Entreprises', route: 'company_public_profile_list', + matches: ['company_public_profile_list', 'company_public_profile'] }, + ] } only %} {% endblock %} -{% block page_title %}{{ company_member.companyName }}{% endblock %} - {% block title %}{{ company_member.companyName }} est adhérente à l'AFUP{% endblock %} -{% block body_css %}migrated-page{% endblock %} - {% set logo_url = path('company_public_profile_logo', {id : company_member.id, slug: company_member.slug }) %} {% block metas %} @@ -23,87 +21,87 @@ {% endblock %} -{% block page_content %} +{% block content %} -

L'entreprise

-
-
- -
-
- {{ company_member.description|nl2br }} -
-
+ {# Reprend la hiérarchie du legacy : la page de recrutement prime, puis le contact, puis le site. #} + {% set cta = company_member.careersPageUrl ? 'careers' : (company_member.contactPageUrl ? 'contact' : 'website') %} -
-
-
- {% if company_member.websiteUrl %} - Site web - {% endif %} - - {% if company_member.careersPageUrl %} - Page de recrutement - {% endif %} - - {% if company_member.contactPageUrl %} - Page de contact - {% endif %} -
+
-

Présente dans les antennes

-
- {% for antenne in antennes %} -
-
- {{ antenne.label }} -
- {% else %} -
- {{ company_member.companyName }} n'a pas renseigné d'antenne à proximité. -
- {% endfor %} +
+
+
+

{{ company_member.companyName }}

+
- - {% if badges|length > 0 %} -

Badges

- -
- {% for badge in badges %} -
- Badge {{badge }} +
+ L'entreprise +

{{ company_member.description|nl2br }}

+ + {% if company_member.websiteUrl or company_member.careersPageUrl or company_member.contactPageUrl or company_member.cleanedTwitterHandle %} +
+ {% if company_member.websiteUrl %} + Site web + {% endif %} + + {% if company_member.careersPageUrl %} + Page de recrutement + {% endif %} + + {% if company_member.contactPageUrl %} + Page de contact + {% endif %} + + {% if company_member.cleanedTwitterHandle %} + + + @{{ company_member.cleanedTwitterHandle }} + + {% endif %}
- {% endfor %} -
{% endif %} - -
- {% if company_member.cleanedTwitterHandle %} - + + +
+ Présente dans les antennes + {% if antennes is not empty %} +
+ {% for antenne in antennes %} + +
+ +
+ {# min-w-0 : sans lui un nom long refuse de se compresser et déborde de la carte. #} +

{{ antenne.label }}

+
+ {% endfor %} +
+ {% else %} +

{{ company_member.companyName }} n'a pas renseigné d'antenne à proximité.

+ {% endif %} +
+ + {% if badges|length > 0 %} +
+ Badges +
+ {% for badge in badges %} + Badge {{ badge }} + {% endfor %} +
+
{% endif %} +
{% endblock %} diff --git a/templates/site/company_public_profile_list.html.twig b/templates/site/company_public_profile_list.html.twig index a61220d79..bf56324ea 100644 --- a/templates/site/company_public_profile_list.html.twig +++ b/templates/site/company_public_profile_list.html.twig @@ -1,54 +1,40 @@ -{% extends 'admin/association/membership/_base.html.twig' %} +{% extends 'layouts/site.html.twig' %} {% block submenu %} - {% include 'site/_members_menu.html.twig' with { - current: "compagnies" - } only %} + {# `matches` : la fiche d'une entreprise garde cet onglet actif. #} + {% include 'site/partials/_submenu.html.twig' with { items: [ + { label: 'Entreprises', route: 'company_public_profile_list', + matches: ['company_public_profile_list', 'company_public_profile'] }, + ] } only %} {% endblock %} {% block title %}Les entreprises adhérentes à l'AFUP{% endblock %} -{% block page_title %}Entreprises adhérentes{% endblock %} - -{% block page_content %} - -
- Ces entreprises soutiennent l'association et la communauté PHP française en étant adhérentes à l'AFUP. -
- - - - - {% for group in company_member_list|batch(3, false) %} - - {% for company_member in group %} - - {% endfor %} - - - - {% for company_member in group %} - - {% endfor %} - +{% block content %} + +
+ +
+

Entreprises adhérentes

+

+ Ces entreprises soutiennent l'association et la communauté PHP française en étant adhérentes à l'AFUP. +

+
+ +
+ {% for company_member in company_member_list %} + {# Un seul lien par entreprise : le legacy en posait deux (logo puis nom) vers la même cible. #} + + + + {{ company_member.companyName }} + + {% endfor %} +
-
-
- {% if company_member %} - - {% set logo_url = path('company_public_profile_logo', {id : company_member.id, slug: company_member.slug }) %} - - - {% endif %} -
- {% if company_member %} - - {{ company_member.companyName }} - - {% endif %} -
+
{% endblock %} diff --git a/templates/site/partials/_submenu.html.twig b/templates/site/partials/_submenu.html.twig new file mode 100644 index 000000000..33a852221 --- /dev/null +++ b/templates/site/partials/_submenu.html.twig @@ -0,0 +1,15 @@ +{# + Rendu générique d'un sous-menu de la barre secondaire, à placer dans le bloc `submenu`. + Remplace `site/secondary_menu.html.twig` pour les pages passées à la nouvelle charte. + + items : liste de { label, route, params (optionnel), matches (optionnel) } + `matches` liste les routes qui allument l'onglet ; par défaut, sa propre route. + À renseigner quand plusieurs pages partagent le même onglet (une liste et sa fiche). +#} +{% set current_route = app.request.attributes.get('_route') %} + +{% for item in items %} + {{ item.label }} +{% endfor %}