From e50f96596f387f041d8f7cc74cacbea7d51cbd6e Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 7 Apr 2025 14:19:02 +0200 Subject: [PATCH] actus read more --- composer.json | 1 + composer.lock | 52 +++++++++- ...ity_view_display.node.actualite.teaser.yml | 54 +++++++---- config/sync/core.extension.yml | 1 + config/sync/views.view.actus.yml | 4 +- config/sync/views.view.block_content.yml | 2 +- .../dist/assets/css/bundle.css | 8 +- .../src/assets/scss/pages/actualites.scss | 3 +- .../scss/partials/actu-caroussel-home.scss | 16 ++-- .../node--actualite--teaser.html.twig | 11 ++- .../node--actualite--teaser.html.twig.backup | 95 +++++++++++++++++++ 11 files changed, 209 insertions(+), 38 deletions(-) create mode 100644 web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig.backup diff --git a/composer.json b/composer.json index 34770ec..b5fedb4 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "drupal/paragraphs": "^1.17", "drupal/quick_node_clone": "^1.18", "drupal/simple_sitemap": "^4.1", + "drupal/smart_read_more_link": "^2.0", "drupal/social_media_links": "^2.9", "drupal/structure_sync": "^2.0", "drupal/verf": "^2.1", diff --git a/composer.lock b/composer.lock index 5f286d4..345fa33 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9ec9a1cf919f08fa39c2521ea0aa030e", + "content-hash": "b067bb5aa94237e0021d81567a805955", "packages": [ { "name": "asm89/stack-cors", @@ -7005,6 +7005,56 @@ "issues": "https://drupal.org/project/issues/simple_sitemap" } }, + { + "name": "drupal/smart_read_more_link", + "version": "2.0.7", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/smart_read_more_link.git", + "reference": "2.0.7" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/smart_read_more_link-2.0.7.zip", + "reference": "2.0.7", + "shasum": "e05efef5089f0c9b88917120164b43131419237c" + }, + "require": { + "drupal/core": "^9 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.0.7", + "datestamp": "1698674670", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Ilcho Vuchkov (vuil)", + "homepage": "https://www.drupal.org/u/vuil", + "role": "Maintainer" + }, + { + "name": "vuil", + "homepage": "https://www.drupal.org/user/3568458" + } + ], + "description": "Dynamic read more link for text fields.", + "homepage": "https://drupal.org/project/smart_read_more_link", + "support": { + "source": "https://drupal.org/project/smart_read_more_link", + "issues": "https://www.drupal.org/project/issues/smart_read_more_link?categories=All" + } + }, { "name": "drupal/smart_trim", "version": "2.1.0", diff --git a/config/sync/core.entity_view_display.node.actualite.teaser.yml b/config/sync/core.entity_view_display.node.actualite.teaser.yml index a4e8cf2..72edb2f 100644 --- a/config/sync/core.entity_view_display.node.actualite.teaser.yml +++ b/config/sync/core.entity_view_display.node.actualite.teaser.yml @@ -18,21 +18,23 @@ dependencies: - node.type.actualite module: - datetime_range - - image_delta_formatter + - file + - image_field_caption + - link - manage_display - - text + - smart_read_more_link id: node.actualite.teaser targetEntityType: node bundle: actualite mode: teaser content: body: - type: text_summary_or_trimmed + type: smart_read_more_link label: visually_hidden settings: - trim_length: 600 + trim_length: '6000000' third_party_settings: { } - weight: 5 + weight: 2 region: content field_date: type: daterange_default @@ -40,31 +42,49 @@ content: settings: timezone_override: '' format_type: jj - separator: '-' from_to: both + separator: '-' third_party_settings: { } - weight: 3 + weight: 5 region: content - field_images: - type: image_delta_formatter + field_fichiers: + type: file_default + label: visually_hidden + settings: + use_description_as_link_text: true + third_party_settings: { } + weight: 6 + region: content + field_images: + type: image_caption label: visually_hidden settings: - deltas: '0' image_style: wide - image_link: content + image_link: '' image_loading: attribute: lazy - deltas_reversed: 0 third_party_settings: { } weight: 0 region: content + field_liens: + type: link + label: visually_hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 7 + region: content field_site: type: entity_reference_label label: visually_hidden settings: link: true third_party_settings: { } - weight: 2 + weight: 3 region: content field_type_d_actualite: type: entity_reference_label @@ -72,22 +92,20 @@ content: settings: link: false third_party_settings: { } - weight: 1 + weight: 4 region: content title: type: title label: visually_hidden settings: - link_to_entity: true + link_to_entity: false tag: h2 third_party_settings: { } - weight: 4 + weight: 1 region: content hidden: created: true field_a_la_une: true - field_fichiers: true - field_liens: true field_poid: true field_tous_les_sites: true langcode: true diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 5ce06eb..74f0daa 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -104,6 +104,7 @@ module: simple_sitemap: 0 simple_sitemap_engines: 0 simple_sitemap_views: 0 + smart_read_more_link: 0 smart_trim: 0 smtp: 0 social_media_links: 0 diff --git a/config/sync/views.view.actus.yml b/config/sync/views.view.actus.yml index 94ec6e0..7d120aa 100644 --- a/config/sync/views.view.actus.yml +++ b/config/sync/views.view.actus.yml @@ -3,7 +3,7 @@ langcode: fr status: true dependencies: config: - - core.entity_view_mode.node.full + - core.entity_view_mode.node.teaser - field.storage.node.body - field.storage.node.field_date - field.storage.node.field_site @@ -458,7 +458,7 @@ display: type: 'entity:node' options: relationship: none - view_mode: full + view_mode: teaser query: type: views_query options: diff --git a/config/sync/views.view.block_content.yml b/config/sync/views.view.block_content.yml index ef8eceb..c53f3aa 100644 --- a/config/sync/views.view.block_content.yml +++ b/config/sync/views.view.block_content.yml @@ -273,6 +273,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 @@ -287,7 +288,6 @@ display: items_per_page_options_all_label: '- Tout -' offset: false offset_label: Décalage - pagination_heading_level: h4 exposed_form: type: basic options: diff --git a/web/themes/custom/quartiers_de_demain/dist/assets/css/bundle.css b/web/themes/custom/quartiers_de_demain/dist/assets/css/bundle.css index 7a9deb8..09c3b91 100644 --- a/web/themes/custom/quartiers_de_demain/dist/assets/css/bundle.css +++ b/web/themes/custom/quartiers_de_demain/dist/assets/css/bundle.css @@ -1818,15 +1818,13 @@ footer { order: 5; line-height: 1rem; } -#actus-caroussel .content-actus .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_title a { - color: rgb(7, 50, 194); - font-size: 1.2rem; -} #actus-caroussel .content-actus .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_title h2 { margin-top: 0.5rem; margin-bottom: 0; padding-left: 0; font-family: "gilroy-medium"; + color: rgb(7, 50, 194); + font-size: 1.2rem; } #actus-caroussel .content-actus .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_field_sous_titre { color: rgb(7, 50, 194); @@ -4588,8 +4586,6 @@ main { #actualites .layout-content .content_container .views-element-container .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_title h2 { font-size: 1.2rem; font-family: "gilroy-medium"; -} -#actualites .layout-content .content_container .views-element-container .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_title a { color: rgb(7, 50, 194); } #actualites .layout-content .content_container .views-element-container .view-rows-wrapper .views-row .node-type-actualite .content-wrapper-actu .field_field_sous_titre { diff --git a/web/themes/custom/quartiers_de_demain/src/assets/scss/pages/actualites.scss b/web/themes/custom/quartiers_de_demain/src/assets/scss/pages/actualites.scss index dba506a..52db948 100644 --- a/web/themes/custom/quartiers_de_demain/src/assets/scss/pages/actualites.scss +++ b/web/themes/custom/quartiers_de_demain/src/assets/scss/pages/actualites.scss @@ -233,9 +233,10 @@ h2{ font-size: 1.2rem; font-family: 'gilroy-medium'; + color: $blue_QDD; } a{ - color: $blue_QDD; + // color: $blue_QDD; // pointer-events: none; // cursor: default; } diff --git a/web/themes/custom/quartiers_de_demain/src/assets/scss/partials/actu-caroussel-home.scss b/web/themes/custom/quartiers_de_demain/src/assets/scss/partials/actu-caroussel-home.scss index b0f13dc..f062214 100644 --- a/web/themes/custom/quartiers_de_demain/src/assets/scss/partials/actu-caroussel-home.scss +++ b/web/themes/custom/quartiers_de_demain/src/assets/scss/partials/actu-caroussel-home.scss @@ -206,17 +206,19 @@ .field_title{ order: 5; line-height: 1rem; - a{ - color: $blue_QDD; - font-size: 1.2rem; - // pointer-events: none; - // cursor: default; - } h2{ margin-top: 0.5rem; margin-bottom: 0; padding-left: 0; font-family: 'gilroy-medium'; + color: $blue_QDD; + font-size: 1.2rem; + } + a{ + // color: $blue_QDD; + // font-size: 1.2rem; + // pointer-events: none; + // cursor: default; } } .field_field_sous_titre{ @@ -265,8 +267,6 @@ } } - - } } .toggle-actualite { diff --git a/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig b/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig index af8c27c..88d39b7 100644 --- a/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig +++ b/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig @@ -88,8 +88,17 @@ {% endif %} - +
{{ content }}
+ {# {% block content %} + {{content.field_images}} +
+ {{content.field_type_d_actualite}} + {{content.field_date}} +
+ {{content.body}} + {{content.field_liens}} + {% endblock %} #} diff --git a/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig.backup b/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig.backup new file mode 100644 index 0000000..af8c27c --- /dev/null +++ b/web/themes/custom/quartiers_de_demain/templates/node--actualite--teaser.html.twig.backup @@ -0,0 +1,95 @@ +{# +/** + * @file + * Default theme implementation to display a node. + * + * Available variables: + * - node: The node entity with limited access to object properties and methods. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. + * - label: (optional) The title of the node. + * - content: All node items. Use {{ content }} to print them all, + * or print a subset such as {{ content.field_example }}. Use + * {{ content|without('field_example') }} to temporarily suppress the printing + * of a given child element. + * - author_picture: The node author user entity, rendered using the "compact" + * view mode. + * - metadata: Metadata for this node. + * - date: (optional) Themed creation date field. + * - author_name: (optional) Themed author name field. + * - url: Direct URL of the current node. + * - display_submitted: Whether submission information should be displayed. + * - attributes: HTML attributes for the containing element. + * The attributes.class element may contain one or more of the following + * classes: + * - node: The current template type (also known as a "theming hook"). + * - node--type-[type]: The current node type. For example, if the node is an + * "Article" it would result in "node--type-article". Note that the machine + * name will often be in a short form of the human readable label. + * - node--view-mode-[view_mode]: The View Mode of the node; for example, a + * teaser would result in: "node--view-mode-teaser", and + * full: "node--view-mode-full". + * The following are controlled through the node publishing options. + * - node--promoted: Appears on nodes promoted to the front page. + * - node--sticky: Appears on nodes ordered above other non-sticky nodes in + * teaser listings. + * - node--unpublished: Appears on unpublished nodes visible only to site + * admins. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - content_attributes: Same as attributes, except applied to the main + * content tag that appears in the template. + * - author_attributes: Same as attributes, except applied to the author of + * the node tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * - view_mode: View mode; for example, "teaser" or "full". + * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'. + * - page: Flag for the full page state. Will be true if view_mode is 'full'. + * - readmore: Flag for more state. Will be true if the teaser content of the + * node cannot hold the main body content. + * - logged_in: Flag for authenticated user status. Will be true when the + * current user is a logged-in member. + * - is_admin: Flag for admin user status. Will be true when the current user + * is an administrator. + * + * @see template_preprocess_node() + * + * @ingroup themeable + */ +#} + + + {{ title_prefix }} + {% if label and not page %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + + {% if display_submitted %} +
+ {{ author_picture }} + + {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %} + {{ metadata }} + +
+ {% endif %} + + + {{ content }} + + +