Skip to content

Commit

Permalink
add case studies
Browse files Browse the repository at this point in the history
  • Loading branch information
Anne-Laure de Boissieu committed Apr 23, 2021
1 parent e02b7e1 commit 1d76a02
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 43 deletions.
1 change: 1 addition & 0 deletions content/technologies/symfony.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: "Symfony"
logo: "build/images/technos/symfony.svg"
title: "Nous utilisons Symfony pour créer des applications robustes"
articles: [dev/architecture-hexagonale-symfony, dev/comment-integrer-vue-js-application-symfony, dev/authentification-par-lien-magique]
caseStudies: [tribu, cirano, climapp]
---

Pour nos développements backend, nous nous appuyons sur Symfony, un framework PHP largement plébiscité par la communauté.
Expand Down
10 changes: 10 additions & 0 deletions src/Controller/TechnologyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Controller;

use App\Model\Article;
use App\Model\CaseStudy;
use App\Model\Technology;
use Stenope\Bundle\ContentManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand Down Expand Up @@ -42,9 +43,18 @@ public function show(Technology $technology): Response
);
}

if(count($technology->caseStudies) > 0 ){
$caseStudies = $this->manager->getContents(
CaseStudy::class,
['date' => false],
fn ($article) => in_array($article->slug, $technology->caseStudies)
);
}

return $this->render('technology/technology.html.twig', [
'technology' => $technology,
'articles' => \array_slice($articles, 0, 3),
'caseStudies' => $caseStudies ?? [],
])->setLastModified($technology->lastModified);
}
}
1 change: 1 addition & 0 deletions src/Model/Technology.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Technology
public string $content;
public ?string $description;
public ?array $articles;
public ?array $caseStudies;
public \DateTimeInterface $lastModified;

/** Show a dedicated page or not */
Expand Down
90 changes: 47 additions & 43 deletions templates/technology/technology.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,54 @@
- max 2 études de cas
- ne pas afficher ce bloc si aucune étude de cas n'est liée
#}
<h2 class="h2--dash">Projets créés avec Symfony</h2>
<ul class="article-list">
<li class="miniature-inline" data-aos="fade-up-left">
<a href="#" class="miniature-inline__image">
<span class="image" style="background-image: url(https://stevensegallery.com/510/270)"></span>
</a>
<div class="miniature-inline__content">
<span class="info">Client</span>
<a href="#" class="title">
Titre
</a>
<p class="description">Pour les besoins d’une solution globale d’administration et de gestion de transport de déchets, nous avons opté pour Symfony afin de gérer un back-office solide.</p>
<a href="#" class="btn btn--secondary btn--animated">
<span>
Voir l'étude de cas
<svg class="icon" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 40 20">
<path class="tip" d="M21,2.7 28.2,10.3 21,17.4"/>
<path class="base" d="M28.2,10.3c-0.1,0-18.3,0-27.8,0"/>
</svg>
</span>
</a>
</div>
</li>
</ul>
{% if caseStudies is not empty %}
<h2 class="h2--dash">Projets créés avec {{ technology.name }}</h2>

{#
Todo :
- câbler les articles liés à la techno (actuellement dans le contenu de chaque techno)
- max 4 articles
- ne pas afficher ce bloc si aucun article n'est lié
#}
<h2 class="h2--dash">Articles liés</h2>
<ul class="article-list">
{% for article in articles %}
<li class="miniature" data-aos="fade-in" data-aos-delay="{{ loop.index * 150 }}">
<a href="#" class="miniature__image">
<span class="image" style="{{ macros.backgroundImageSrcset(article.thumbnail, 'article_thumbnail.sm') }}"></span>
</a>
<div class="miniature__content">
<a href="{{ path('blog_article', { article: article.slug }) }}" class="title">{{ article.title }}</a>
<a href="{{ path('blog_article', { article: article.slug }) }}" class="link link--brand">Lire l'article</a>
</div>
</li>
<ul class="article-list">
{% for caseStudy in caseStudies %}

<li class="miniature-inline" data-aos="fade-up-left">
<a href="#" class="miniature-inline__image">
<span class="image" style="{{ macros.backgroundImageSrcset(caseStudy.images|first, 'case_study_thumbnail.md') }}"></span>
</a>
<div class="miniature-inline__content">
<span class="info">Client</span>
<a href="{{ path('case_study', { caseStudy: caseStudy.slug }) }}" class="title">
{{ caseStudy.title }}
</a>
<p class="description">{{ caseStudy.shortDescription }}</p>
<a href="{{ path('case_study', { caseStudy: caseStudy.slug }) }}" class="btn btn--secondary btn--animated">
<span>
Voir l'étude de cas
<svg class="icon" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 40 20">
<path class="tip" d="M21,2.7 28.2,10.3 21,17.4"/>
<path class="base" d="M28.2,10.3c-0.1,0-18.3,0-27.8,0"/>
</svg>
</span>
</a>
</div>
</li>
{% endfor %}
</ul>

</ul>
{% endif %}

{% if articles is not empty %}
<h2 class="h2--dash">Articles liés à {{ technology.name }}</h2>
<ul class="article-list">
{% for article in articles %}
<li class="miniature" data-aos="fade-in" data-aos-delay="{{ loop.index * 150 }}">
<a href="#" class="miniature__image">
<span class="image" style="{{ macros.backgroundImageSrcset(article.thumbnail, 'article_thumbnail.sm') }}"></span>
</a>
<div class="miniature__content">
<a href="{{ path('blog_article', { article: article.slug }) }}" class="title">{{ article.title }}</a>
<a href="{{ path('blog_article', { article: article.slug }) }}" class="link link--brand">Lire l'article</a>
</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>

{% endblock content %}

0 comments on commit 1d76a02

Please sign in to comment.