MODIF CONFIGS DRUPAL centre de ressources: tri par étape + ressources mis en avant

This commit is contained in:
Valentin Le Moign 2025-05-22 00:51:02 +02:00
parent bfb39a0259
commit e85851bd4d
11 changed files with 95 additions and 9 deletions

View File

@ -2,9 +2,10 @@ features:
node_user_picture: false
comment_user_picture: true
comment_user_verification: true
favicon: 1
favicon: 0
logo:
use_default: 1
use_default: 0
path: 'public://favicon-caravane_1.png'
favicon:
use_default: 0
path: ''

View File

@ -7,6 +7,7 @@ dependencies:
- field.field.node.ressource.field_date_ressource
- field.field.node.ressource.field_etape
- field.field.node.ressource.field_introduction
- field.field.node.ressource.field_mis_en_avant
- field.field.node.ressource.field_parties_ressource
- field.field.node.ressource.field_thematiques
- field.field.node.ressource.field_type_de_ressource
@ -22,11 +23,12 @@ third_party_settings:
field_group:
group_details:
children:
- field_type_de_ressource
- field_thematiques
- field_etape
- status
- path
- field_mis_en_avant
- field_type_de_ressource
label: Details
region: content
parent_name: ''
@ -128,6 +130,13 @@ content:
rows: 5
placeholder: ''
third_party_settings: { }
field_mis_en_avant:
type: boolean_checkbox
weight: 31
region: content
settings:
display_label: true
third_party_settings: { }
field_parties_ressource:
type: paragraphs
weight: 5
@ -165,7 +174,7 @@ content:
third_party_settings: { }
field_type_de_ressource:
type: options_select
weight: 31
weight: 32
region: content
settings: { }
third_party_settings: { }

View File

@ -7,6 +7,7 @@ dependencies:
- field.field.node.ressource.field_date_ressource
- field.field.node.ressource.field_etape
- field.field.node.ressource.field_introduction
- field.field.node.ressource.field_mis_en_avant
- field.field.node.ressource.field_parties_ressource
- field.field.node.ressource.field_thematiques
- field.field.node.ressource.field_type_de_ressource
@ -54,6 +55,16 @@ content:
third_party_settings: { }
weight: 107
region: content
field_mis_en_avant:
type: boolean
label: above
settings:
format: default
format_custom_false: ''
format_custom_true: ''
third_party_settings: { }
weight: 109
region: content
field_parties_ressource:
type: entity_reference_revisions_entity_view
label: above

View File

@ -8,6 +8,7 @@ dependencies:
- field.field.node.ressource.field_date_ressource
- field.field.node.ressource.field_etape
- field.field.node.ressource.field_introduction
- field.field.node.ressource.field_mis_en_avant
- field.field.node.ressource.field_parties_ressource
- field.field.node.ressource.field_thematiques
- field.field.node.ressource.field_type_de_ressource
@ -29,6 +30,7 @@ hidden:
field_date_ressource: true
field_etape: true
field_introduction: true
field_mis_en_avant: true
field_parties_ressource: true
field_thematiques: true
field_type_de_ressource: true

View File

@ -0,0 +1,23 @@
uuid: 3e824533-8b04-4c3c-acb4-cdf87f40e281
langcode: fr
status: true
dependencies:
config:
- field.storage.node.field_mis_en_avant
- node.type.ressource
id: node.ressource.field_mis_en_avant
field_name: field_mis_en_avant
entity_type: node
bundle: ressource
label: 'mis en avant'
description: ''
required: false
translatable: false
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: Activé
off_label: Désactivé
field_type: boolean

View File

@ -0,0 +1,18 @@
uuid: e92021e0-c606-4e50-b042-012920aa6341
langcode: fr
status: true
dependencies:
module:
- node
id: node.field_mis_en_avant
field_name: field_mis_en_avant
entity_type: node
type: boolean
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -200,7 +200,7 @@ display:
type: normal
title: 'Les partenaires'
description: ''
weight: -48
weight: -47
expanded: false
menu_name: main
parent: ''

View File

@ -122,11 +122,14 @@ export async function getRessourceItemCard(item) {
}
const relatedEtape = await REST.get(item.relationships.field_etape.links.related.href);
console.log(item);
return {
ressourceType: item.attributes.field_type_de_ressource,
title: item.attributes.title,
auteurice: item.attributes.field_autheurice,
promoted: item.attributes.field_mis_en_avant,
date: getCleanDate(item.attributes.field_date_ressource),
url: ressourceFetch.data.data.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
relatedEtape: relatedEtape.data.data.attributes.title,

View File

@ -83,6 +83,9 @@ const ressourcesByType = (type) => {
searchQuery.value === '' ||
ressource.title.toLowerCase().includes(searchQuery.value.toLowerCase())
).sort((a, b) => {
if (a.promoted && !b.promoted) return -1;
if (!a.promoted && b.promoted) return 1;
const dateA = useParseDate(a.date);
const dateB = useParseDate(b.date);

View File

@ -1,7 +1,8 @@
<template>
<div
:data-href="ressource.url"
:id="`ressource-${index}`">
:id="`ressource-${index}`"
:class="ressource.promoted ? 'promoted' : ''">
<figure>
<img :src="ressource.vignette.url" :alt="ressource.vignette.alt" />
</figure>

View File

@ -1590,12 +1590,27 @@ body{
> .ressource-item > div {
display: flex;
gap: 0.8rem;
@media screen and (min-width: $desktop-min-width) {
gap: 1.2rem;
}
cursor: pointer;
transform: scale(1);
transition: transform 0.2s ease-in-out;
&.promoted {
&::after {
content: '';
position: absolute;
top: -10px;
left: -10px;
width: 20px !important;
height: 20px !important;
background-color: $brand-color;
mask-image: url("/themes/custom/caravane/assets/pictograms/hexagone.svg");
mask-size: contain;
mask-repeat: no-repeat;
}
}
&:hover {
transform: scale(1.05);
}