Compare commits
No commits in common. "297019f9a9fad25fe5d95f94ee18ee619983cebf" and "e0fd2ffff3b28966bb2b83638218b6b52d11de60" have entirely different histories.
297019f9a9
...
e0fd2ffff3
|
|
@ -21,13 +21,6 @@ add_action('rest_api_init', function () {
|
|||
'permission_callback' => '__return_true',
|
||||
));
|
||||
|
||||
// ################ RÉCUPÉRATION DES ARTICLES D'UNE REVUE ################
|
||||
register_rest_route('dynamiques-datas/v1/build', '/revues/(?P<revue_id>\d+)/articles', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'build_revue_articles',
|
||||
'permission_callback' => '__return_true',
|
||||
));
|
||||
|
||||
|
||||
/* ----------------
|
||||
INTERACTIONS ROUTES
|
||||
|
|
@ -43,11 +36,11 @@ add_action('rest_api_init', function () {
|
|||
});
|
||||
|
||||
|
||||
|
||||
// ################ FILTER ARTICLES ################
|
||||
|
||||
function build_articles($request)
|
||||
{
|
||||
|
||||
$etiquette = esc_html($request->get_param('etiquette'));
|
||||
$auteur = esc_html($request->get_param('auteur'));
|
||||
$sort_by = esc_html($request->get_param('sort_by'));
|
||||
|
|
@ -140,12 +133,10 @@ function build_articles($request)
|
|||
|
||||
// ################ FILTER REVUES ################
|
||||
|
||||
function build_revue_articles($request)
|
||||
function build_revues($request)
|
||||
{
|
||||
|
||||
|
||||
$search = esc_html($request->get_param('search'));
|
||||
$current_revue_id = intval($request->get_param('revue_id'));
|
||||
$current_revue_id = intval($request->get_param('current_revue_id'));
|
||||
|
||||
// Récupérer les articles liés à la revue courante
|
||||
$issue_related_articles = get_field('articles', $current_revue_id);
|
||||
|
|
|
|||
|
|
@ -71,13 +71,6 @@
|
|||
}
|
||||
.search-field {
|
||||
@apply relative;
|
||||
.reset-search-button {
|
||||
@apply absolute top-1/2 right-0 -translate-y-1/2;
|
||||
@apply mr-2 w-8 h-8;
|
||||
@apply bg-contain hidden;
|
||||
background-image: url('../resources/img/icons/carhop-reset-search-cross-green.svg');
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: ' ';
|
||||
@apply block w-8 h-8;
|
||||
|
|
@ -86,16 +79,6 @@
|
|||
@apply bg-contain;
|
||||
background-image: url('../resources/img/icons/carhop-rechercher-green-circle.svg');
|
||||
}
|
||||
|
||||
&:has(input:not(:placeholder-shown)) {
|
||||
.reset-search-button {
|
||||
@apply block;
|
||||
}
|
||||
&:after {
|
||||
@apply hidden;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
@apply border border-primary text-primary w-full;
|
||||
@apply w-full p-4 relative;
|
||||
|
|
@ -108,12 +91,8 @@
|
|||
.tags {
|
||||
@apply hidden lg:block;
|
||||
}
|
||||
.search-field + .article-tags,
|
||||
.search-field + .revue-tags {
|
||||
@apply mt-8;
|
||||
}
|
||||
.tags__title {
|
||||
@apply text-lg uppercase font-semibold mt-0 my-4 nunito;
|
||||
@apply text-lg uppercase font-semibold mt-8 my-4 nunito;
|
||||
}
|
||||
.tags-list {
|
||||
@apply flex flex-wrap gap-4;
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="18" cy="18" r="17" stroke="#136F63" stroke-width="2"/>
|
||||
<path d="M11.8828 25L26.0005 11" stroke="#136F63" stroke-width="2"/>
|
||||
<path d="M25.1172 25L10.9995 11" stroke="#136F63" stroke-width="2"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 308 B |
|
|
@ -6,26 +6,9 @@ export default function handleSearchRevue() {
|
|||
const currentRevueId = document
|
||||
.querySelector('.page--single-revue')
|
||||
?.getAttribute('data-revue-id') as string;
|
||||
const revueToolbarButtons = document.querySelectorAll(
|
||||
'.page--single-revue .revue-toolbar button'
|
||||
) as NodeListOf<HTMLButtonElement>;
|
||||
|
||||
if (!searchRevue || !contentArea) return;
|
||||
|
||||
const resetSearchButton = document.querySelector(
|
||||
'.page--single-revue .sidebar .search-field .reset-search-button'
|
||||
) as HTMLButtonElement;
|
||||
if (!resetSearchButton) return;
|
||||
|
||||
function resetSearch() {
|
||||
searchRevue.value = '';
|
||||
contentArea.innerHTML = originalContent;
|
||||
}
|
||||
|
||||
resetSearchButton.addEventListener('click', () => {
|
||||
resetSearch();
|
||||
});
|
||||
|
||||
// Sauvegarder le contenu original
|
||||
const originalContent = contentArea.innerHTML;
|
||||
|
||||
|
|
@ -40,9 +23,9 @@ export default function handleSearchRevue() {
|
|||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/wp-json/dynamiques-datas/v1/build/revues/${currentRevueId}/articles?search=${encodeURIComponent(
|
||||
`/wp-json/dynamiques-datas/v1/build/revues?search=${encodeURIComponent(
|
||||
searchValue
|
||||
)}`
|
||||
)}¤t_revue_id=${currentRevueId}`
|
||||
);
|
||||
const data = await response.json();
|
||||
|
||||
|
|
@ -57,11 +40,4 @@ export default function handleSearchRevue() {
|
|||
`;
|
||||
}
|
||||
});
|
||||
|
||||
revueToolbarButtons.forEach((button) => {
|
||||
button.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
resetSearch();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,10 @@ $revueID = get_field('related_revue', get_the_ID());
|
|||
|
||||
<div class="content-wrapper" data-active-tab="article">
|
||||
<aside class="sidebar">
|
||||
// commenting because not needed for articles
|
||||
<!-- <div class="search-field">
|
||||
<div class="search-field">
|
||||
<input type="text" placeholder="Rechercher">
|
||||
<button type="button" class="reset-search-button" title="Réinitialiser la recherche"></button>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
|
||||
<?php get_template_part('template-parts/articles/article-tags'); ?>
|
||||
<?php get_template_part('template-parts/articles/index-panel'); ?>
|
||||
|
|
@ -58,5 +57,9 @@ $revueID = get_field('related_revue', get_the_ID());
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
<?php
|
||||
get_footer();
|
||||
|
|
|
|||
|
|
@ -23,26 +23,22 @@ $articles = get_field('articles', $current_issue->ID);
|
|||
<div class="sidebar">
|
||||
<div class="search-field">
|
||||
<input type="text" placeholder="Rechercher dans la revue">
|
||||
<button type="button" class="reset-search-button" title="Réinitialiser la recherche"></button>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
$tags = get_revue_terms($current_issue->ID, 'etiquettes');
|
||||
?>
|
||||
<?php if ($tags) : ?>
|
||||
<div id="revue-tags" class="revue-tags">
|
||||
<div class="tags">
|
||||
<h3 class="tags__title">Tags</h3>
|
||||
<ul class="tags-list">
|
||||
<?php foreach ($tags as $tag) : ?>
|
||||
<li>
|
||||
<a class="article-tag" href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>">
|
||||
<?php echo $tag->name; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<h3 class="tags__title">Tags</h3>
|
||||
<ul class="tags-list">
|
||||
<?php foreach ($tags as $tag) : ?>
|
||||
<li>
|
||||
<a class="article-tag" href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>">
|
||||
<?php echo $tag->name; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ $thematiques = get_terms(array(
|
|||
<?php _e('articles', 'dynamiques'); ?>
|
||||
</span>
|
||||
</h2>
|
||||
<div class="post-grid__toolbar-actions" data-post-type="articles">
|
||||
<div class="post-grid__toolbar-actions">
|
||||
<div class="search-bar">
|
||||
<input type="text" placeholder="<?php _e('Rechercher par mot-clé', 'dynamiques'); ?>">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ $thematiques = get_terms(array(
|
|||
<input type="text" placeholder="<?php _e('Rechercher par mot-clé', 'dynamiques'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="post-grid__toolbar-actions" data-post-type="revues">
|
||||
<div class="post-grid__toolbar-actions">
|
||||
|
||||
<select name="etiquettes">
|
||||
<option value="1"><?php _e('Thématiques', 'dynamiques'); ?></option>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user