diff --git a/templates/site/talks/_talk_card.html.twig b/templates/site/talks/_talk_card.html.twig
index 3eebf3bea..40eec2044 100644
--- a/templates/site/talks/_talk_card.html.twig
+++ b/templates/site/talks/_talk_card.html.twig
@@ -1,5 +1,18 @@
-{# Carte d'un talk : vignette (ou image par défaut), titre en lien, puis le bloc « details » de l'appelant. #}
+{# Carte d'un talk, la même sur le hub, les pages événement et speaker, et dans les résultats de recherche
+ Algolia (htdocs/js/talk/list.js : modifier les deux ensemble).
+
+ Vignette, titre, puis une ligne « Speakers · Événement · Date », chaque partie n'apparaissant que si elle est
+ fournie ; ce qui a une page est un lien (couleur AFUP), le reste est du texte (gris) :
+ - `speakers` et `speaker_slugs` (slug de la page speaker, par ID de ligne speaker) ;
+ - `event` ;
+ - `date`, avec l'heure si `date_with_time`.
+ Enfin les liens vers les slides et l'article de blog du talk. #}
{% set talk_url = path('talks_show', {id: talk.id, slug: talk.slug}) %}
+{% set link_class = 'text-afup-500 hover:underline' %}
+{% set resource_class = 'inline-flex items-center gap-1.5 rounded-lg bg-afup-100 px-2 py-1 text-xs font-medium text-afup-500 hover:bg-afup-500 hover:text-white' %}
+{% set speakers = speakers|default([]) %}
+{% set event = event|default(null) %}
+{% set date = date|default(null) %}
{{ talk.title }}
- {% block details %}{% endblock %}
+ {% if speakers is not empty or event is not null or date is not null %}
+
+ {%- for speaker in speakers -%}
+ {%- if speaker_slugs|default({})[speaker.id] is defined -%}
+ {{ speaker.label }}
+ {%- else -%}
+ {{ speaker.label }}
+ {%- endif -%}
+ {{- not loop.last ? ' et ' -}}
+ {%- endfor -%}
+ {%- if event is not null -%}
+ {{- speakers is not empty ? ' · ' -}}
+ {{ event.title }}
+ {%- endif -%}
+ {%- if date is not null -%}
+ {{- speakers is not empty or event is not null ? ' · ' -}}
+ {%- if date_with_time|default(false) -%}
+
+ {%- else -%}
+
+ {%- endif -%}
+ {%- endif -%}
+
+ {% endif %}
+ {% if talk.slidesUrl or talk.blogPostUrl %}
+
+ {% include 'site/talks/_events_by_year.html.twig' %}
{% endblock %}
diff --git a/templates/site/talks/list.html.twig b/templates/site/talks/list.html.twig
index 75f629649..fa8b46333 100644
--- a/templates/site/talks/list.html.twig
+++ b/templates/site/talks/list.html.twig
@@ -2,6 +2,8 @@
{% block title %}{{ title }}{% endblock %}
+{% block description %}Les talks et vidéos des conférences de l'AFUP : Forum PHP, AFUP Day, PHP Tour… Dernières vidéos, toutes les éditions année par année, les speakers et une recherche dans tout l'historique.{% endblock %}
+
{% block canonical %}
{% endblock %}
@@ -37,36 +39,68 @@
évènements, rendez-vous sur event.afup.org.
+ {% if show_hub %}
+
+
Tous les événements
+
Tous les speakers de A à Z
+
+ {% endif %}
+
+
+ {# Recherche Algolia (htdocs/js/talk/list.js) : sans recherche active, la liste affichée est celle des dernières
+ vidéos, rendue côté serveur (lisible sans JavaScript et par les moteurs) ; dès qu'une recherche ou un filtre est
+ actif, le script la masque et affiche les résultats Algolia à sa place, puis la rétablit quand on efface tout.
+ Sur une URL de recherche, la liste serveur n'est pas rendue : seuls les résultats s'affichent. #}
+
+ {{ show_hub ? 'Dernières vidéos' : 'Résultats de la recherche' }}
+
{# instantsearch remplace cet input ; les classes sont posées via cssClasses.input #}
-
- {# flex-col et non flex-col-reverse : en mobile le bloc de filtres fait ~500px, il doit
- passer APRÈS les résultats et non les repousser sous la ligne de flottaison. #}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {# flex-col et non flex-col-reverse : en mobile le bloc de filtres fait ~500px, il doit
+ passer APRÈS les résultats et non les repousser sous la ligne de flottaison. #}
+
+
+ {% if latest_talks is not empty %}
+
+ {% for latest in latest_talks %}
+
+ {% include 'site/talks/_talk_card.html.twig' with {talk: latest.talk, speakers: latest.speakers, speaker_slugs: speaker_slugs, event: latest.event} only %}
+
+ {% endfor %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+ {% if show_hub %}
+
+ Les éditions
+ {% include 'site/talks/_events_by_year.html.twig' with {heading_level: 3} %}
+
+ {% endif %}
diff --git a/tests/behat/features/PublicSite/Talks.feature b/tests/behat/features/PublicSite/Talks.feature
index fe6f84954..d4b7d2724 100644
--- a/tests/behat/features/PublicSite/Talks.feature
+++ b/tests/behat/features/PublicSite/Talks.feature
@@ -3,7 +3,7 @@ Feature: Site Public - Talks
@reloadDbWithTestData
Scenario: Accès à la liste des vidéos
Given I am on the homepage
- When I follow "Vidéos"
+ When I follow "Talks"
Then I should see "Historique des conférences de l'AFUP"
And the response should contain ""
When I go to "/talks/?p=1"
@@ -116,6 +116,9 @@ Feature: Site Public - Talks
And the response should contain "href=\"/talks/evenements/passed\""
And the response should contain "https://img.youtube.com/vi/MseSkWbhxV8/hqdefault.jpg"
And the response should contain "/images/no_video.jpg"
+ # Carte d'un talk, la même partout : événement lié puis date, et les slides
+ And the "main ul article:has(a[href='/talks/2-rest-ou-graphql-exemples-illustres-avec-symfony-et-api-platform']) p" element should contain "forum ·
"
+ When I go to "/talks/?fR[event.title][0]=forum&p=1"
+ Then the response should not contain "id=\"dernieres-videos\""
+ And I should see "forum les vidéos"
+ When I go to "/talks/?p=2"
+ Then the response should not contain "id=\"dernieres-videos\""
+ When I go to "/talks/?q=&hPP=7&idx=afup_talks&p=0&is_v=1&utm_source=newsletter"
+ Then the response should contain "id=\"dernieres-videos\""
diff --git a/tests/integration/AppBundle/Event/Talk/PublishedTalkRepositoryEventTest.php b/tests/integration/AppBundle/Event/Talk/PublishedTalkRepositoryEventTest.php
index 1514d1824..097abc7f6 100644
--- a/tests/integration/AppBundle/Event/Talk/PublishedTalkRepositoryEventTest.php
+++ b/tests/integration/AppBundle/Event/Talk/PublishedTalkRepositoryEventTest.php
@@ -89,10 +89,43 @@ public function testEventSummariesCountPublishedTalksAndVideos(): void
);
}
+ public function testLatestTalksWithVideoAreSortedBySlotEnd(): void
+ {
+ // Le créneau du talk 301 se termine après celui du talk 300, qui a un identifiant plus petit.
+ $this->insertTalk(301, 3, 'Forum 2018, fin de journée', strtotime('2018-10-25 17:00:00'), speakerIds: [12, 11], youtubeId: 'video301', slidesUrl: 'https://slides.example/301', blogPostUrl: 'https://blog.example/301');
+ $this->insertTalk(110, 1, 'Vidéo, créneau en cours', time() - 600, youtubeId: 'video110', slotEnd: time() + 600);
+ $this->insertTalk(111, 1, 'Vidéo, non planifié', strtotime('2019-10-24 11:00:00'), youtubeId: 'video111', scheduled: false);
+ $repository = new PublishedTalkRepository($this->connection);
+ $toRows = static fn(array $latest): array => array_map(static fn(array $row): array => [
+ $row['talk']->id,
+ $row['talk']->title,
+ $row['talk']->youtubeId,
+ $row['event']->path,
+ array_map(static fn(PublishedSpeaker $speaker): int => $speaker->id, $row['speakers']),
+ $row['talk']->slidesUrl,
+ $row['talk']->blogPostUrl,
+ ], $latest);
+
+ // Exclus : sans vidéo ou vidéo vide (101, 103, 200), clinique (104), publication à venir (107), créneau en
+ // cours (110), non planifié (111).
+ self::assertSame(
+ [
+ [100, 'Clôture', 'video100', 'forumphp2019', [10], null, null],
+ [102, 'Salle 2', 'video102', 'forumphp2019', [10], null, null],
+ // Deux speakers : le talk n'apparaît qu'une fois, la limite porte sur les talks.
+ [301, 'Forum 2018, fin de journée', 'video301', 'forumphp2018', [11, 12], 'https://slides.example/301', 'https://blog.example/301'],
+ [300, 'Forum 2018', 'video300', 'forumphp2018', [], null, null],
+ ],
+ $toRows($repository->getLatestTalksWithVideo(12)),
+ );
+ self::assertSame([100, 102], array_column($toRows($repository->getLatestTalksWithVideo(2)), 0));
+ self::assertSame([100, 102, 301], array_column($toRows($repository->getLatestTalksWithVideo(3)), 0));
+ }
+
/**
* @param list $speakerIds
*/
- private function insertTalk(int $id, int $eventId, string $title, ?int $slotStart, int $type = Talk::TYPE_FULL_LONG, int $room = 1, array $speakerIds = [], ?string $youtubeId = null, bool $scheduled = true, ?string $publishedOn = null, ?int $slotEnd = null): void
+ private function insertTalk(int $id, int $eventId, string $title, ?int $slotStart, int $type = Talk::TYPE_FULL_LONG, int $room = 1, array $speakerIds = [], ?string $youtubeId = null, bool $scheduled = true, ?string $publishedOn = null, ?int $slotEnd = null, ?string $slidesUrl = null, ?string $blogPostUrl = null): void
{
$this->connection->insert('afup_sessions', [
'session_id' => $id,
@@ -103,6 +136,8 @@ private function insertTalk(int $id, int $eventId, string $title, ?int $slotStar
'genre' => $type,
'plannifie' => (int) $scheduled,
'youtube_id' => $youtubeId,
+ 'slides_url' => $slidesUrl,
+ 'blog_post_url' => $blogPostUrl,
'date_publication' => null !== $publishedOn ? date('Y-m-d H:i:s', (int) strtotime($publishedOn)) : null,
]);
diff --git a/tests/unit/AppBundle/Indexation/Talks/TransformerTest.php b/tests/unit/AppBundle/Indexation/Talks/TransformerTest.php
index 61e790154..f46ee2f3e 100644
--- a/tests/unit/AppBundle/Indexation/Talks/TransformerTest.php
+++ b/tests/unit/AppBundle/Indexation/Talks/TransformerTest.php
@@ -62,9 +62,14 @@ public function testTransform(): void
->setBiography('Dimitri Fontaine travaille sur PostgreSQL, à la fois en tant que Contributeur Majeur du projet au sein d\'une communauté vibrante et en tant qu\'expert PostgreSQL pour 2ndQuadrant.')
->setTwitter('tapoueh');
- $transformer = new Transformer();
+ ($otherSpeaker = new Speaker())
+ ->setId(801)
+ ->setFirstname('Sans')
+ ->setLastname('Page');
+
+ $transformer = new Transformer(static fn(Speaker $speaker): ?string => $speaker->getId() === 800 ? 'dimitri-fontaine' : null);
- $result = $transformer->transform($planning, $talk, $event, new \ArrayObject([$speaker]));
+ $result = $transformer->transform($planning, $talk, $event, new \ArrayObject([$speaker, $otherSpeaker]));
self::assertEquals(
[
@@ -75,19 +80,28 @@ public function testTransform(): void
'event' => [
'id' => 10,
'title' => 'PHP Tour Lyon 2014',
+ 'path' => 'phptourlyon2014',
'start_date' => '2014-06-24',
],
'type' => [
'id' => 1,
'label' => 'Conférence (40 minutes)',
],
- 'speakers_label' => 'Dimitri FONTAINE',
+ 'speakers_label' => 'Dimitri FONTAINE et Sans PAGE',
'speakers' => [
[
'id' => 800,
'first_name' => 'Dimitri',
'last_name' => 'Fontaine',
'label' => 'Dimitri FONTAINE',
+ 'slug' => 'dimitri-fontaine',
+ ],
+ [
+ 'id' => 801,
+ 'first_name' => 'Sans',
+ 'last_name' => 'Page',
+ 'label' => 'Sans PAGE',
+ 'slug' => null,
],
],
'has_video' => true,