Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions db/migrations/20261117090000_add_description_to_articles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddDescriptionToArticles extends AbstractMigration
{
public function change(): void
{
$this
->table('afup_site_article')
->addColumn('description', 'string', [
'limit' => 255,
'null' => true,
'default' => null,
'after' => 'chapeau',
])
->save()
;
}
}
7 changes: 7 additions & 0 deletions db/seeds/SiteRubrique.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public function run(): void
'nom' => "Actualités",
'etat' => 1,
],
[
'id' => Rubrique::ID_RUBRIQUE_ASSOCIATION,
'id_parent' => 0,
'nom' => "Association",
'raccourci' => 'association',
'etat' => 1,
],
];

$table = $this->table('afup_site_rubrique');
Expand Down
1 change: 1 addition & 0 deletions db/seeds/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function run(): void
'prenom' => 'Raoul',
'email' => 'raoul.dupont@mycorp.fr',
'raison_sociale' => 'MyCorp',
'description' => "MyCorp développe des applications PHP sur mesure & accompagne les équipes dans leurs migrations.",
'siret' => '4445451',
'adresse' => '12 cours Hopper',
'code_postal' => '69001',
Expand Down
3 changes: 3 additions & 0 deletions sources/AppBundle/Site/Entity/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class Article
#[ORM\Column(type: 'text', nullable: true)]
public ?string $chapeau = null;

#[ORM\Column(length: 255, nullable: true)]
public ?string $description = null;

#[ORM\Column(type: 'text', nullable: true)]
public ?string $contenu = null;

Expand Down
14 changes: 14 additions & 0 deletions sources/AppBundle/Site/Form/ArticleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
new Assert\Type('string'),
],
])
->add('description', TextareaType::class, [
'label' => 'Description',
'required' => false,
'help' => 'Résumé affiché par les moteurs de recherche (155 caractères conseillés). '
. 'Si ce champ est vide, le début du contenu est utilisé.',
'attr' => [
'maxlength' => 255,
'rows' => 3,
],
'constraints' => [
new Assert\Length(max: 255),
new Assert\Type('string'),
],
])
->add('image', FileType::class, [
'label' => 'Image de couverture',
'required' => false,
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/association/membership/register.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

{% block page_title %}Formulaire d'inscription à l'AFUP{% endblock %}

{% block description %}Formulaire d'adhésion individuelle à l'AFUP : créez votre compte de membre pour soutenir la communauté PHP francophone.{% endblock %}

{% block content %}
<div class="container mx-auto flex flex-col items-center px-4 my-5 gap-4">
<h1 class="font-titre text-5xl text-afup-800 text-center">{{ "Formulaire d'inscription à l'AFUP"|trans }}</h1>
Expand Down
1 change: 1 addition & 0 deletions templates/admin/site/article_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<div class="ui clearing divider"></div>
<div>
<div class="ui form">
{{ form_row(form.description) }}
{{ form_row(form.raccourci) }}
{{ form_row(form.rubrique) }}
{{ form_row(form.datePublication) }}
Expand Down
2 changes: 2 additions & 0 deletions templates/site/become_member.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

{% block title %}Devenir membre de l'AFUP{% endblock %}

{% block description %}Adhérez à l'AFUP en tant que particulier ou entreprise pour soutenir la communauté PHP francophone : Forum PHP, AFUP Day, antennes, mentorat.{% endblock %}

{% block content %}

{% set membership_benefits = [
Expand Down
3 changes: 3 additions & 0 deletions templates/site/cms_page/display.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

{% block title %}{{ article.titre }} - AFUP{% endblock %}

{# Description saisie dans l'admin, à défaut le début du contenu. #}
{% block description %}{{ (article.description ?: article.contenu|markdown_to_html)|meta_description }}{% endblock %}

{% block content %}
<article class="container mx-auto sm:pt-10 flex flex-col gap-5">
<h1 class="text-afup-800 text-2xl sm:text-4xl">{{ article.titre }}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

{% block page_title %}Adhésion entreprise à l'AFUP{% endblock %}

{% block description %}Formulaire d'adhésion à l'AFUP réservé aux entreprises : créez le compte de votre société pour soutenir l'association et la communauté PHP française.{% endblock %}

{% block content %}
<div class="container mx-auto flex flex-col items-center px-4 my-5 gap-4">
<h1 class="font-titre text-5xl text-afup-800 text-center">{{ "Adhésion entreprise à l'AFUP"|trans }}</h1>
Expand Down
2 changes: 2 additions & 0 deletions templates/site/company_public_profile.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

{% block title %}{{ company_member.companyName }} est adhérente à l'AFUP{% endblock %}

{% block description %}{{ (company_member.description ?: company_member.companyName ~ " est une entreprise adhérente à l'AFUP et soutient la communauté PHP française.")|meta_description }}{% endblock %}

{% set logo_url = path('company_public_profile_logo', {id : company_member.id, slug: company_member.slug }) %}

{% block metas %}
Expand Down
2 changes: 2 additions & 0 deletions templates/site/company_public_profile_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

{% block title %}Les entreprises adhérentes à l'AFUP{% endblock %}

{% block description %}Les entreprises adhérentes à l'AFUP, qui soutiennent l'association et la communauté PHP française : présentation, site web et antennes de rattachement.{% endblock %}

{% block content %}

<div class="container mx-auto flex flex-col px-4 py-6 gap-6 sm:px-28 sm:py-10 sm:gap-10">
Expand Down
2 changes: 2 additions & 0 deletions templates/site/meetups/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

{% block title %}Les meetups des antennes de l'AFUP{% endblock %}

{% block description %}Les meetups organisés par les antennes locales de l'AFUP partout en France : prochains rendez-vous et événements passés de la communauté PHP.{% endblock %}

{% block javascripts %}
{{ parent() }}
{# `defer` obligatoire : ce bloc est rendu dans le <head>, sans lui instantsearch
Expand Down
3 changes: 2 additions & 1 deletion templates/site/news/display.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

{% block title %}{{ article.titre }} - AFUP{% endblock %}

{% block description %}{{ (article.chapeau ?: article.contenu)|markdown_to_html|meta_description }}{% endblock %}
{# Description saisie dans l'admin, à défaut le chapeau ou le début du contenu. #}
{% block description %}{{ (article.description ?: (article.chapeau ?: article.contenu)|markdown_to_html)|meta_description }}{% endblock %}

{% block content %}

Expand Down
35 changes: 35 additions & 0 deletions tests/behat/features/Admin/Site/AdminSiteArticles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Feature: Administration - Partie Site
And I fill in "article[titre]" with "Le titre de l'article"
And I fill in "article[chapeau]" with "Le chapeau de l'article"
And I fill in "article[contenu]" with "Le contenu de l'article"
And I fill in "article[description]" with "La description de l'article"
And I fill in "article[raccourci]" with "url-article"
And I select "Actualités" from "article[rubrique]"
And I select "9" from "article[position]"
Expand All @@ -43,6 +44,7 @@ Feature: Administration - Partie Site
Then I should see "Le titre de l'article"
Then I should see "Le chapeau de l'article"
Then I should see "Le contenu de l'article"
And the meta description should be "La description de l'article"

# modification d'un article
When I follow "Administration"
Expand Down Expand Up @@ -198,3 +200,36 @@ Feature: Administration - Partie Site
# l'image n'est plus affichée sur la page publique
When I go to "/news/17-url-article-illustre"
Then I should not see a "article main figure img" element

@reloadDbWithTestData
Scenario: Description d'une page CMS, avec repli sur le début du contenu
Given I am logged in as admin and on the Administration
And I follow "Articles"
When I follow "Ajouter"
Then I should see "Ajouter un article"
And I fill in "article[titre]" with "Les statuts"
And I fill in "article[contenu]" with "Les **statuts** de l'association, adoptés en assemblée générale."
And I fill in "article[description]" with "Les statuts de l'AFUP & leur historique."
And I fill in "article[raccourci]" with "statuts"
And I select "Association" from "article[rubrique]"
And I select "En ligne" from "article[etat]"
And I press "Ajouter"
Then I should see "Liste des articles"

# la description saisie est la meta description de la page
When I go to "/p/17-statuts"
Then I should see "Les statuts"
And the meta description should be "Les statuts de l'AFUP & leur historique."

# la description est éditable
When I follow "Administration"
And I follow "Articles"
And I follow "modifier_17"
Then the "article[description]" field should contain "Les statuts de l'AFUP & leur historique."
When I fill in "article[description]" with ""
And I press "Modifier"
Then I should see "L'article Les statuts a été modifié"

# sans description, la meta description reprend le début du contenu, sans Markdown
When I go to "/p/17-statuts"
Then the meta description should be "Les statuts de l'association, adoptés en assemblée générale."
6 changes: 3 additions & 3 deletions tests/behat/features/Admin/Site/AdminSiteRubriques.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: Administration - Partie Site
Then I should see "Liste des rubriques"
And the ".content table" element should contain "Évènement"
# modification d'une rubrique
When I follow "modifier_10"
When I follow "modifier_86"
Then I should see "Modifier une rubrique"
When I fill in "rubrique[nom]" with "Évènements"
And I press "Modifier"
Expand All @@ -35,10 +35,10 @@ Feature: Administration - Partie Site
Then I should see "Liste des articles"
When I follow "Ajouter"
Then I should see "Ajouter un article"
Then The "article[rubrique]" field should only contain the follow values '["Actualités", "Évènements"]'
Then The "article[rubrique]" field should only contain the follow values '["Actualités", "Association", "Évènements"]'

# suppression d'une rubrique
When I follow "Rubriques"
And I follow "supprimer_10"
And I follow "supprimer_86"
Then I should see "Liste des rubriques"
But the ".content table" element should not contain "Évènements"
32 changes: 32 additions & 0 deletions tests/behat/features/PublicSite/MetaDescriptions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Site Public - Meta descriptions des gabarits

@reloadDbWithTestData
Scenario: Meta description de la liste des entreprises adhérentes
Given I am on "/profile/company"
Then the meta description should be "Les entreprises adhérentes à l'AFUP, qui soutiennent l'association et la communauté PHP française : présentation, site web et antennes de rattachement."

@reloadDbWithTestData
Scenario: Meta description d'une entreprise tirée de sa description
Given I am on "/profile/company/1-mycorp"
Then the meta description should be "MyCorp développe des applications PHP sur mesure & accompagne les équipes dans leurs migrations."

@reloadDbWithTestData
Scenario: Meta description d'une entreprise sans description
Given I am on "/profile/company/2-helios-aerospace"
Then the meta description should be "Helios Aerospace est une entreprise adhérente à l'AFUP et soutient la communauté PHP française."

Scenario: Meta description de la liste des meetups
Given I am on "/meetups/"
Then the meta description should be "Les meetups organisés par les antennes locales de l'AFUP partout en France : prochains rendez-vous et événements passés de la communauté PHP."

Scenario: Meta description de la page « Devenir membre »
Given I am on "/association/devenir-membre"
Then the meta description should be "Adhérez à l'AFUP en tant que particulier ou entreprise pour soutenir la communauté PHP francophone : Forum PHP, AFUP Day, antennes, mentorat."

Scenario: Meta description du formulaire d'adhésion particulier
Given I am on "/association/adherer/particulier"
Then the meta description should be "Formulaire d'adhésion individuelle à l'AFUP : créez votre compte de membre pour soutenir la communauté PHP francophone."

Scenario: Meta description du formulaire d'adhésion entreprise
Given I am on "/association/adherer/entreprise"
Then the meta description should be "Formulaire d'adhésion à l'AFUP réservé aux entreprises : créez le compte de votre société pour soutenir l'association et la communauté PHP française."
Loading