From e85851bd4dd520629a8fc125b2aec095f14bc06e Mon Sep 17 00:00:00 2001 From: Valentin Le Moign Date: Thu, 22 May 2025 00:51:02 +0200 Subject: [PATCH] =?UTF-8?q?MODIF=20CONFIGS=20DRUPAL=20centre=20de=20ressou?= =?UTF-8?q?rces:=20tri=20par=20=C3=A9tape=20+=20ressources=20mis=20en=20av?= =?UTF-8?q?ant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/sync/caravane.settings.yml | 5 ++-- ...ty_form_display.node.ressource.default.yml | 13 +++++++++-- ...ty_view_display.node.ressource.default.yml | 11 +++++++++ ...ity_view_display.node.ressource.teaser.yml | 2 ++ ...ield.node.ressource.field_mis_en_avant.yml | 23 +++++++++++++++++++ .../field.storage.node.field_mis_en_avant.yml | 18 +++++++++++++++ config/sync/views.view.partenaires.yml | 2 +- .../js/utils/content/contentFetchUtils.js | 7 ++++-- .../js/vuejs/components/CentreDeRessource.vue | 3 +++ .../js/vuejs/components/RessourceCard.vue | 5 ++-- .../custom/caravane/assets/scss/main.scss | 15 ++++++++++++ 11 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 config/sync/field.field.node.ressource.field_mis_en_avant.yml create mode 100644 config/sync/field.storage.node.field_mis_en_avant.yml diff --git a/config/sync/caravane.settings.yml b/config/sync/caravane.settings.yml index ee782a8..f0a547a 100644 --- a/config/sync/caravane.settings.yml +++ b/config/sync/caravane.settings.yml @@ -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: '' diff --git a/config/sync/core.entity_form_display.node.ressource.default.yml b/config/sync/core.entity_form_display.node.ressource.default.yml index f064e5d..e6f395a 100644 --- a/config/sync/core.entity_form_display.node.ressource.default.yml +++ b/config/sync/core.entity_form_display.node.ressource.default.yml @@ -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: { } diff --git a/config/sync/core.entity_view_display.node.ressource.default.yml b/config/sync/core.entity_view_display.node.ressource.default.yml index d9cb26c..6f7d991 100644 --- a/config/sync/core.entity_view_display.node.ressource.default.yml +++ b/config/sync/core.entity_view_display.node.ressource.default.yml @@ -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 diff --git a/config/sync/core.entity_view_display.node.ressource.teaser.yml b/config/sync/core.entity_view_display.node.ressource.teaser.yml index eb05f86..5ca8d77 100644 --- a/config/sync/core.entity_view_display.node.ressource.teaser.yml +++ b/config/sync/core.entity_view_display.node.ressource.teaser.yml @@ -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 diff --git a/config/sync/field.field.node.ressource.field_mis_en_avant.yml b/config/sync/field.field.node.ressource.field_mis_en_avant.yml new file mode 100644 index 0000000..7f66952 --- /dev/null +++ b/config/sync/field.field.node.ressource.field_mis_en_avant.yml @@ -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 diff --git a/config/sync/field.storage.node.field_mis_en_avant.yml b/config/sync/field.storage.node.field_mis_en_avant.yml new file mode 100644 index 0000000..fe87fa1 --- /dev/null +++ b/config/sync/field.storage.node.field_mis_en_avant.yml @@ -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 diff --git a/config/sync/views.view.partenaires.yml b/config/sync/views.view.partenaires.yml index 8e48b12..9ad84d8 100644 --- a/config/sync/views.view.partenaires.yml +++ b/config/sync/views.view.partenaires.yml @@ -200,7 +200,7 @@ display: type: normal title: 'Les partenaires' description: '' - weight: -48 + weight: -47 expanded: false menu_name: main parent: '' diff --git a/web/themes/custom/caravane/assets/js/utils/content/contentFetchUtils.js b/web/themes/custom/caravane/assets/js/utils/content/contentFetchUtils.js index f4c588b..9ab0a1c 100644 --- a/web/themes/custom/caravane/assets/js/utils/content/contentFetchUtils.js +++ b/web/themes/custom/caravane/assets/js/utils/content/contentFetchUtils.js @@ -67,7 +67,7 @@ export async function getRelatedEtape(direction, path) { }); } -export async function getRessourceItemCard(item) { +export async function getRessourceItemCard(item) { try { 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 { 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, diff --git a/web/themes/custom/caravane/assets/js/vuejs/components/CentreDeRessource.vue b/web/themes/custom/caravane/assets/js/vuejs/components/CentreDeRessource.vue index 41344f2..d357b4d 100644 --- a/web/themes/custom/caravane/assets/js/vuejs/components/CentreDeRessource.vue +++ b/web/themes/custom/caravane/assets/js/vuejs/components/CentreDeRessource.vue @@ -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); diff --git a/web/themes/custom/caravane/assets/js/vuejs/components/RessourceCard.vue b/web/themes/custom/caravane/assets/js/vuejs/components/RessourceCard.vue index a1071cf..ba7180d 100644 --- a/web/themes/custom/caravane/assets/js/vuejs/components/RessourceCard.vue +++ b/web/themes/custom/caravane/assets/js/vuejs/components/RessourceCard.vue @@ -1,7 +1,8 @@