Compare commits

..

6 Commits

Author SHA1 Message Date
Nonimart
2f495878c3 FEATURE Introducing the component
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-25 11:45:25 +02:00
Nonimart
86fd29864c FEATURE Refactoring and optimizing functionnal behaviour 2025-06-25 11:45:16 +02:00
Nonimart
435eb4f218 FIX Conditionnal display of tags to avoid empty vertical space when no tags 2025-06-25 11:44:45 +02:00
Nonimart
f37f9cca3a FEATURE Introducing component 2025-06-25 11:44:11 +02:00
Nonimart
288fb8e733 FEATURE Handling article-authors visibility 2025-06-25 11:43:54 +02:00
Nonimart
3fbd4a4ac6 FEATURE passing a dedicated article-authors component 2025-06-25 11:42:40 +02:00
7 changed files with 106 additions and 28 deletions

View File

@ -4,6 +4,8 @@
@apply container mx-auto grid grid-cols-12 gap-12 py-12 items-start;
grid-template-columns: 1fr 2fr;
&[data-active-tab='article'] {
#article-authors,
.article-informations,
.sidebar .search-field,
.table-matieres {
@apply hidden;
@ -18,6 +20,7 @@
}
}
&[data-active-tab='references'] {
#article-authors,
.article-informations,
.article-content,
.sidebar .index-panel,
@ -26,6 +29,7 @@
}
}
&[data-active-tab='table-of-contents'] {
#article-authors,
.article-informations,
.article-content,
.sidebar .index-panel {
@ -33,6 +37,7 @@
}
}
&[data-active-tab='informations'] {
#article-authors,
.article-content,
.table-matieres,
.sidebar .index-panel {

View File

@ -1,15 +1,15 @@
<?php
get_header();
$revueID = get_field('related_revue', get_the_ID());
?>
<div class="page--single-articles" data-revue-id="<?php echo get_the_ID(); ?>">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('template-parts/post-header'); ?>
<?php get_template_part('template-parts/articles/article-toolbar'); ?>
<div class="content-wrapper" data-active-tab="article">
<aside class="sidebar">
<div class="search-field">
@ -20,6 +20,10 @@ $revueID = get_field('related_revue', get_the_ID());
</aside>
<div class="content-area">
<?php get_template_part('template-parts/articles/article-authors', null, array(
'postId' => get_the_ID()
)); ?>
<?php get_template_part('template-parts/articles/article-informations', null, array(
'revueID' => $revueID
)); ?>
@ -27,12 +31,14 @@ $revueID = get_field('related_revue', get_the_ID());
<?php get_template_part('template-parts/revues/table-matiere-revue', null, array(
'revueID' => $revueID
)); ?>
<?php get_template_part('template-parts/articles/article-content', null, array(
'ID' => get_the_ID()
)); ?>
</div>
</div>

View File

@ -0,0 +1,16 @@
<?php
?>
<div id="article-authors" class="article-authors">
<?php get_template_part('template-parts/authors/authors-list', null, array(
'postId' => get_the_ID()
)); ?>
<?php get_template_part('template-parts/authors/authors-last-publications', null, array(
'postId' => get_the_ID()
)); ?>
</div>

View File

@ -4,17 +4,22 @@ $articleContent = get_the_content($articleID);
$articleTitle = get_the_title($articleID);
$citeReference = get_field('cite_reference', $articleID);
$tags = get_the_terms($articleID, 'etiquettes');
?>
<article class="article-content">
<ul class="article-tags-list">
<?php foreach ($tags as $tag) : ?>
<li class="article-tag">
<?php echo $tag->name; ?>
</li>
<?php endforeach; ?>
</ul>
<?php if ($tags) : ?>
<ul class="article-tags-list">
<?php foreach ($tags as $tag) : ?>
<li class="article-tag">
<?php echo $tag->name; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php the_content(); ?>
<?php if ($citeReference) : ?>
<p id="cite-reference">
<?php echo $citeReference; ?>

View File

@ -0,0 +1,33 @@
<?php
$postId = $args['postId'];
$authors = [];
$isArticle = is_singular('articles');
if ($isArticle) {
$authors = get_field('authors', $postId);
} else {
$authors = getRevueAuthors($postId);
}
if (empty($authors)) return;
$authorsLastPosts = get_posts(array(
'post_type' => $isArticle ? 'articles' : 'revues',
'author' => $authors,
'posts_per_page' => 6,
'orderby' => 'date',
'order' => 'DESC',
));
?>
<?php foreach ($authorsLastPosts as $post) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'ID' => $post->ID,
)); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>

View File

@ -0,0 +1,32 @@
<?php
$postId = $args['postId'];
$isArticle = is_singular('articles');
$componentTitle = $isArticle ? 'Auteur·e·s de l\'article' : 'Auteur·e·s de la revue';
$articleTitle = get_the_title($postId);
$authors = [];
if ($isArticle) {
$authors = get_field('authors', $postId);
} else {
$authors = getRevueAuthors($postId);
}
if (empty($authors)) return;
?>
<section class="revue-authors-list">
<h3 class="revue-authors-list__title"><?php echo $componentTitle; ?></h3>
<?php if ($articleTitle) : ?>
<p class="revue-authors-list__article-title"><?php echo $articleTitle; ?></p>
<?php endif; ?>
<?php foreach ($authors as $authorID) : ?>
<?php get_template_part(
'template-parts/authors/card-author',
null,
array(
'ID' => $authorID,
)
); ?>
<?php endforeach; ?>
</section>

View File

@ -1,19 +0,0 @@
<?php
$revueID = $args['revueID'];
$authors = getRevueAuthors($revueID);
?>
<section class="revue-authors-list">
<h3 class="revue-authors-list__title">Auteur·e·s de la revue</h3>
<?php foreach ($authors as $authorID) : ?>
<?php get_template_part(
'template-parts/authors/card-author',
null,
array(
'ID' => $authorID,
)
); ?>
<?php endforeach; ?>
</section>