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 node_user_picture: false
comment_user_picture: true comment_user_picture: true
comment_user_verification: true comment_user_verification: true
favicon: 1 favicon: 0
logo: logo:
use_default: 1 use_default: 0
path: 'public://favicon-caravane_1.png'
favicon: favicon:
use_default: 0 use_default: 0
path: '' path: ''

View File

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

View File

@ -7,6 +7,7 @@ dependencies:
- field.field.node.ressource.field_date_ressource - field.field.node.ressource.field_date_ressource
- field.field.node.ressource.field_etape - field.field.node.ressource.field_etape
- field.field.node.ressource.field_introduction - 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_parties_ressource
- field.field.node.ressource.field_thematiques - field.field.node.ressource.field_thematiques
- field.field.node.ressource.field_type_de_ressource - field.field.node.ressource.field_type_de_ressource
@ -54,6 +55,16 @@ content:
third_party_settings: { } third_party_settings: { }
weight: 107 weight: 107
region: content 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: field_parties_ressource:
type: entity_reference_revisions_entity_view type: entity_reference_revisions_entity_view
label: above label: above

View File

@ -8,6 +8,7 @@ dependencies:
- field.field.node.ressource.field_date_ressource - field.field.node.ressource.field_date_ressource
- field.field.node.ressource.field_etape - field.field.node.ressource.field_etape
- field.field.node.ressource.field_introduction - 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_parties_ressource
- field.field.node.ressource.field_thematiques - field.field.node.ressource.field_thematiques
- field.field.node.ressource.field_type_de_ressource - field.field.node.ressource.field_type_de_ressource
@ -29,6 +30,7 @@ hidden:
field_date_ressource: true field_date_ressource: true
field_etape: true field_etape: true
field_introduction: true field_introduction: true
field_mis_en_avant: true
field_parties_ressource: true field_parties_ressource: true
field_thematiques: true field_thematiques: true
field_type_de_ressource: 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 type: normal
title: 'Les partenaires' title: 'Les partenaires'
description: '' description: ''
weight: -48 weight: -47
expanded: false expanded: false
menu_name: main menu_name: main
parent: '' parent: ''

View File

@ -67,7 +67,7 @@ export async function getRelatedEtape(direction, path) {
}); });
} }
export async function getRessourceItemCard(item) { export async function getRessourceItemCard(item) {
try { try {
const ressourceFetch = await REST.get(item.links.self.href); const ressourceFetch = await REST.get(item.links.self.href);
@ -121,12 +121,15 @@ export async function getRessourceItemCard(item) {
} }
} }
const relatedEtape = await REST.get(item.relationships.field_etape.links.related.href); const relatedEtape = await REST.get(item.relationships.field_etape.links.related.href);
console.log(item);
return { return {
ressourceType: item.attributes.field_type_de_ressource, ressourceType: item.attributes.field_type_de_ressource,
title: item.attributes.title, title: item.attributes.title,
auteurice: item.attributes.field_autheurice, auteurice: item.attributes.field_autheurice,
promoted: item.attributes.field_mis_en_avant,
date: getCleanDate(item.attributes.field_date_ressource), date: getCleanDate(item.attributes.field_date_ressource),
url: ressourceFetch.data.data.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href, url: ressourceFetch.data.data.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
relatedEtape: relatedEtape.data.data.attributes.title, relatedEtape: relatedEtape.data.data.attributes.title,

View File

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

View File

@ -1,7 +1,8 @@
<template> <template>
<div <div
:data-href="ressource.url" :data-href="ressource.url"
:id="`ressource-${index}`"> :id="`ressource-${index}`"
:class="ressource.promoted ? 'promoted' : ''">
<figure> <figure>
<img :src="ressource.vignette.url" :alt="ressource.vignette.alt" /> <img :src="ressource.vignette.url" :alt="ressource.vignette.alt" />
</figure> </figure>
@ -45,4 +46,4 @@ const props = defineProps({
ressource: Object, ressource: Object,
index: String, index: String,
}); });
</script> </script>

View File

@ -1590,12 +1590,27 @@ body{
> .ressource-item > div { > .ressource-item > div {
display: flex; display: flex;
gap: 0.8rem; gap: 0.8rem;
@media screen and (min-width: $desktop-min-width) { @media screen and (min-width: $desktop-min-width) {
gap: 1.2rem; gap: 1.2rem;
} }
cursor: pointer; cursor: pointer;
transform: scale(1); transform: scale(1);
transition: transform 0.2s ease-in-out; 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 { &:hover {
transform: scale(1.05); transform: scale(1.05);
} }