From 107142ec31caaab0103a5fb677f1dc6d63fa85bb Mon Sep 17 00:00:00 2001 From: orakili Date: Sun, 8 Dec 2024 23:26:09 +0000 Subject: [PATCH] chore: uninstall reliefweb_dsr and remove usage in custom modules and themes Refs: RW-1142 --- config/core.extension.yml | 1 - config/reliefweb_dsr.settings.yml | 6 - .../reliefweb_entities/src/Entity/Country.php | 15 --- .../src/ReliefwebSubscriptionsMailer.php | 8 -- .../common_design_subtheme.libraries.yml | 5 - .../components/rw-dsr/README.md | 4 - .../components/rw-dsr/rw-dsr.css | 115 ------------------ ...liefweb-digital-situation-report.html.twig | 6 - 8 files changed, 160 deletions(-) delete mode 100644 config/reliefweb_dsr.settings.yml delete mode 100644 html/themes/custom/common_design_subtheme/components/rw-dsr/README.md delete mode 100644 html/themes/custom/common_design_subtheme/components/rw-dsr/rw-dsr.css delete mode 100644 html/themes/custom/common_design_subtheme/templates/rw-modules/reliefweb_dsr/reliefweb-digital-situation-report.html.twig diff --git a/config/core.extension.yml b/config/core.extension.yml index 8ca649768..de823f20c 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -77,7 +77,6 @@ module: reliefweb_bookmarks: 0 reliefweb_contact: 0 reliefweb_disaster_map: 0 - reliefweb_dsr: 0 reliefweb_entities: 0 reliefweb_fields: 0 reliefweb_files: 0 diff --git a/config/reliefweb_dsr.settings.yml b/config/reliefweb_dsr.settings.yml deleted file mode 100644 index c6f0a6802..000000000 --- a/config/reliefweb_dsr.settings.yml +++ /dev/null @@ -1,6 +0,0 @@ -ctf_cda_access_token: null -ctf_dsr_url: null -ocha_dsr_url: 'https://reports.unocha.org' -cache_lifetime: 300 -last_update_skip: 30 -show_illustration: true diff --git a/html/modules/custom/reliefweb_entities/src/Entity/Country.php b/html/modules/custom/reliefweb_entities/src/Entity/Country.php index 69a96cf7a..1500b308c 100644 --- a/html/modules/custom/reliefweb_entities/src/Entity/Country.php +++ b/html/modules/custom/reliefweb_entities/src/Entity/Country.php @@ -57,7 +57,6 @@ public function getPageContent() { */ public function getPageSections() { $sections = []; - $sections['digital-sitrep'] = $this->getDigitalSitrepSection(); $queries = []; @@ -121,20 +120,6 @@ public function getPageTableOfContents() { ]; } - /** - * Get the Digital Situation Report for the country. - * - * @return array - * Render array for the Digital Situation Report section. - */ - protected function getDigitalSitrepSection() { - $client = \Drupal::service('reliefweb_dsr.client'); - $iso3 = $this->field_iso3->value; - $ongoing = $this->getModerationStatus() === 'ongoing'; - - return $client->getDigitalSitrepBuild($iso3, $ongoing); - } - /** * {@inheritdoc} */ diff --git a/html/modules/custom/reliefweb_subscriptions/src/ReliefwebSubscriptionsMailer.php b/html/modules/custom/reliefweb_subscriptions/src/ReliefwebSubscriptionsMailer.php index 37773001a..8e276232f 100644 --- a/html/modules/custom/reliefweb_subscriptions/src/ReliefwebSubscriptionsMailer.php +++ b/html/modules/custom/reliefweb_subscriptions/src/ReliefwebSubscriptionsMailer.php @@ -1156,14 +1156,6 @@ protected function generateEmailContentOchaSitrep(array $subscription, array $da ], ], ]; - // Add link to Digital sitrep if there is one. - $dsr_url = $this->config('reliefweb_dsr')->get('ocha_dsr_url'); - if (!empty($dsr_url) && isset($data['origin']) && strpos($data['origin'], $dsr_url) === 0) { - array_unshift($prefooter_parts, [ - 'text' => 'Digital Situation Report for ' . $country_name, - 'link' => $data['origin'], - ]); - } $variables['#prefooter'] = $this->prepareFooterLinks($prefooter_parts, $subscription); return $variables; diff --git a/html/themes/custom/common_design_subtheme/common_design_subtheme.libraries.yml b/html/themes/custom/common_design_subtheme/common_design_subtheme.libraries.yml index 18eb9167f..a399b6f5b 100644 --- a/html/themes/custom/common_design_subtheme/common_design_subtheme.libraries.yml +++ b/html/themes/custom/common_design_subtheme/common_design_subtheme.libraries.yml @@ -171,11 +171,6 @@ rw-document: theme: components/rw-document/rw-document.css: {} -rw-dsr: - css: - theme: - components/rw-dsr/rw-dsr.css: {} - rw-entity-meta: css: theme: diff --git a/html/themes/custom/common_design_subtheme/components/rw-dsr/README.md b/html/themes/custom/common_design_subtheme/components/rw-dsr/README.md deleted file mode 100644 index a5b4d3647..000000000 --- a/html/themes/custom/common_design_subtheme/components/rw-dsr/README.md +++ /dev/null @@ -1,4 +0,0 @@ -ReliefWeb DSR -============= - -This component provides rules for the Digital Situation Report block on country pages. diff --git a/html/themes/custom/common_design_subtheme/components/rw-dsr/rw-dsr.css b/html/themes/custom/common_design_subtheme/components/rw-dsr/rw-dsr.css deleted file mode 100644 index 149fa7578..000000000 --- a/html/themes/custom/common_design_subtheme/components/rw-dsr/rw-dsr.css +++ /dev/null @@ -1,115 +0,0 @@ -/* OCHA digital sitrep */ -.rw-dsr .rw-dsr__title { - margin-bottom: 24px; -} -.rw-dsr .rw-dsr__title small { - white-space: nowrap; - font-weight: normal; -} -.rw-dsr .rw-dsr__title span.rw-dsr__ocha { - position: relative; - display: inline-block; - /* Width of the logo below. */ - width: 80px; - /* Space between the logo and the rest of the title. */ - margin-right: 8px; - /* Better default when the logo cannot be loaded. */ - text-align: center; - letter-spacing: 0.5px; - /* h3 styles */ - font-size: 20px; - font-weight: bold; - /* Better vertical alignment. */ - line-height: 1; -} -.rw-dsr .rw-dsr__title span.rw-dsr__ocha:after { - position: absolute; - top: 50%; - left: 0; - overflow: hidden; - width: 80px; - height: 20px; - /* 1px more that 1/2 the height for better alignment with the rest of the - * digital sitrep title as the font size is 18px. */ - margin-top: -11px; - content: ""; - /* The logo has a white background and will be display above the text. */ - background: url("../../img/logos/ocha-logo-sprite.png") 0 -57px no-repeat; - background: rgba(0, 0, 0, 0) url("../../img/logos/ocha-logo-sprite.svg") 0 -57px no-repeat; -} -.rw-dsr ul { - padding-left: 18px; -} -.rw-dsr li { - margin-bottom: 16px; - line-height: 1.5; -} -.rw-dsr figure { - display: none; - max-width: 540px; - margin: 0; -} -.rw-dsr figure img { - display: block; - width: 100%; -} -.rw-dsr figure figcaption { - margin-top: 4px; - font-size: 15px; - font-style: italic; -} -.rw-dsr .view-more { - margin-top: 12px; -} -.rw-dsr .view-more a { - margin-right: 0; - padding-right: 0; - text-decoration: none; - font-weight: bold; - font-style: normal; -} -.rw-dsr .rw-dsr__title + .view-more, -.rw-dsr .rw-dsr__title + .view-more a { - margin-top: 0; - text-align: left; -} - -@media screen and (min-width: 768px) { - .rw-dsr { - display: flex; - flex-wrap: wrap; - align-items: start; - justify-content: space-between; - } - .rw-dsr > .rw-dsr__title, - .rw-dsr > footer { - width: 100%; - } - .rw-dsr--with-illustration > ul, - .rw-dsr--with-illustration > figure { - display: block; - width: 48%; - /* Ensure the top of the highlights is aligned with the illustration. - * - * @todo currently the top margin of the highlights (ul) comes from the - * browser user agent styling (ex: margin-block-start: 1em;). Setting it - * to 0 here means the spacing between the title section and the highlights - * differs when there is an illustration or not which is not consistent. - * So it would be better to have a fixed margin (0 or something else) - * regardless of the presence of the illustration. This margin should be - * consistent with the other sections on the page the DSR one is displayed - * for a more homogeneous experience. See RW-55. */ - margin-top: 0; - } -} - -/* Ugly hack for IE8 to hide the text due bad handling of z-index. */ -@media \0screen { - .rw-dsr .rw-dsr__title span.rw-dsr__ocha { - overflow: hidden; - margin-top: -4px; - padding-left: 80px; - vertical-align: middle; - white-space: nowrap; - } -} diff --git a/html/themes/custom/common_design_subtheme/templates/rw-modules/reliefweb_dsr/reliefweb-digital-situation-report.html.twig b/html/themes/custom/common_design_subtheme/templates/rw-modules/reliefweb_dsr/reliefweb-digital-situation-report.html.twig deleted file mode 100644 index 98f1da5f1..000000000 --- a/html/themes/custom/common_design_subtheme/templates/rw-modules/reliefweb_dsr/reliefweb-digital-situation-report.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% set title_attributes = title_attributes.addClass('cd-block-title') %} - -{{ attach_library('common_design/cd-block-title') }} -{{ attach_library('common_design_subtheme/rw-dsr') }} - -{% include '@reliefweb_dsr/reliefweb-digital-situation-report.html.twig' %}