Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blog][Team] Added meta members #615

Merged
merged 1 commit into from
May 28, 2024
Merged
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
3 changes: 2 additions & 1 deletion content/member/elao.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
active: false
meta: true # Group of members
active: true

name: La team Elao
position: "Atelier de conception d'applications web et mobile sur-mesure | Experts Symfony et React"
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function tag(string $tag, int $page = 1, int $perPage = 20): Response

#[Route('/auteur/{author}', name: 'blog_author')]
#[Route('/auteur/{author}/{!page}', name: 'blog_author_page', requirements: ['page' => '\d+'])]
public function articlesFromAuthor(Request $request, Member $author, int $page = 1, int $perPage = 20): Response
public function articlesFromAuthor(Member $author, int $page = 1, int $perPage = 20): Response
{
$articles = $this->manager->getContents(
Article::class,
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function home(ContentManagerInterface $manager): Response
{
/** @var Article[] $articles */
$articles = $manager->getContents(Article::class, ['date' => false]);
$members = $manager->getContents(Member::class, [], ['active' => true]);
$members = $manager->getContents(Member::class, [], ['active' => true, 'meta' => false]);
$caseStudies = $manager->getContents(CaseStudy::class, ['date' => false], ['enabled' => true]);

return $this->render('site/home.html.twig', [
Expand Down Expand Up @@ -51,7 +51,7 @@ public function methodology(): Response
#[Route('/nos-valeurs', name: 'values')]
public function values(ContentManagerInterface $manager): Response
{
$activeMembers = $manager->getContents(Member::class, null, static fn (Member $member): bool => $member->active);
$activeMembers = $manager->getContents(Member::class, null, ['active' => true, 'meta' => false]);
$count = \count($activeMembers);
$velotafCount = \count(array_filter($activeMembers, static fn (Member $member): bool => $member->🚲));

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(ContentManagerInterface $manager)
#[Route(name: 'team')]
public function list(): Response
{
$members = $this->manager->getContents(Member::class, ['name' => true], ['active' => true]);
$members = $this->manager->getContents(Member::class, ['name' => true], ['active' => true, 'meta' => false]);

return $this->render('team/index.html.twig', [
'members' => $members,
Expand Down
12 changes: 8 additions & 4 deletions src/Model/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Stenope\Bundle\Attribute\SuggestedDebugQuery;

#[SuggestedDebugQuery('Actifs', filters: '_.active', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Anciens', filters: 'not _.active', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Vélotaffeurs', filters: '_.🚲 and _.active', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Piétons', filters: 'not _.🚲 and _.active', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Actifs', filters: '_.active and not _.meta', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Anciens', filters: 'not _.active and not _.meta', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Vélotaffeurs', filters: '_.🚲 and _.active and not _.meta', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Piétons', filters: 'not _.🚲 and _.active and not _.meta', orders: 'desc:integrationDate')]
#[SuggestedDebugQuery('Meta members', filters: '_.meta', orders: 'desc:integrationDate')]
class Member
{
public string $slug;
Expand Down Expand Up @@ -46,6 +47,9 @@ class Member

public bool $active = false;

/** Group of members: ex: "La team elao" */
public bool $meta = false;

/** Vélotafeur */
public bool $🚲 = false;

Expand Down
4 changes: 2 additions & 2 deletions src/Stenope/Listener/BuildListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ private function addTeamMemberSignatureUrls(): void
// For each active member, we pre-generate their mail signature URLs,
// so it's included in the build despite not being linked anywhere:
/** @var Member $member */
foreach ($this->manager->getContents(Member::class, [], ['active' => true]) as $member) {
foreach ($this->manager->getContents(Member::class, [], ['active' => true, 'meta' => false]) as $member) {
$this->urlGenerator->generate('team_member_mail_signature', ['member' => $member->slug]);
}
}

private function addLegacyTeamMemberRedirects(): void
{
/** @var Member $member */
foreach ($this->manager->getContents(Member::class, [], ['active' => true]) as $member) {
foreach ($this->manager->getContents(Member::class, [], ['active' => true, 'meta' => false]) as $member) {
$this->urlGenerator->generate('app_legacyteam_show', ['member' => $member->slug]);
}
}
Expand Down
6 changes: 4 additions & 2 deletions templates/blog/article.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
author: article.authorsArray | map(author => {
'@type': 'Person',
name: author.name,
url: author.active
url: (author.active and not author.meta)
? url('team_member', { member: author.slug })
: url('team')
,
Expand Down Expand Up @@ -85,7 +85,9 @@
<strong>{{ author.name }}</strong>
</a>
{% else %}
<strong>La team elao</strong>
<a href="{{ path('blog_author', { author: 'elao' }) }}">
<strong>La team elao</strong>
</a>
{% endfor %}
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/blog/author.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div class="article-author article-author--large">
<div class="article-author__image">
{% if author.active %}
{% if author.active and not author.meta %}
<a href="{{ path('team_member', { member: author.slug }) }}">
<img {{ macros.imageSrcset(author.avatar(), 'author_avatar') }} />
</a>
Expand All @@ -29,7 +29,7 @@
</div>
<span class="article-author__info">
Les articles de
{% if author.active %}
{% if author.active and not author.meta %}
<a href="{{ path('team_member', { member: author.slug }) }}">
<strong>{{ author.name }}</strong>
</a>
Expand Down
4 changes: 3 additions & 1 deletion templates/blog/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
<strong>{{ author.name }}</strong>
</a>
{% else %}
<strong>La team elao</strong>
<a href="{{ path('blog_author', { author: 'elao' }) }}">
<strong>La team elao</strong>
</a>
{% endfor %}
</span>
<span class="article-author__info">
Expand Down
2 changes: 1 addition & 1 deletion templates/case_study/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
{% set member = content_get('App\\Model\\Member', memberSlug) %}
<li class="project-team__member" data-aos="fade-in" data-aos-delay="{{ loop.index * 150 }}">
<a
{%- if member.active %}
{%- if member.active and not member.meta %}
href="{{ path('team_member', { member: member.slug }) }}"
{% endif -%}
>
Expand Down
2 changes: 1 addition & 1 deletion templates/site/innovation-workshop.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
</span>
</div>
<div class="thumbnail">
{% set membersCount = content_list('App\\Model\\Member', filterBy = '_.active') | length %}
{% set membersCount = content_list('App\\Model\\Member', filterBy = '_.active and not _.meta') | length %}
<span class="number">{{ membersCount }}</span>
<span class="detail">expert·e·s passionné·e·s</span>
<a href="{{ path('team') }}">
Expand Down
Loading