diff --git a/composer.json b/composer.json index ca3e1d08da07a33a211f28596135adf9e839df1b..31b33108ba85e04f00a9f610476f13f3768c0fd4 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "drupal/core": "^8.9 || ^9.1", "drupal/ui_patterns": "^1.0", "drupal/ui_patterns_settings": "^1.0", - "openeuropa/oe_bootstrap_theme": "0.17092021819" + "openeuropa/oe_bootstrap_theme": "0.210920211501" }, "require-dev": { "composer/installers": "^1.11", diff --git a/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEcLogoBlock.php b/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEcLogoBlock.php index 9b56857f7deb6db326e055078daddd2e87ccc72a..57e74bc5bbe8cd021ec786465e037990d6d63be9 100644 --- a/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEcLogoBlock.php +++ b/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEcLogoBlock.php @@ -83,7 +83,8 @@ class CorporateEcLogoBlock extends BlockBase implements ContainerFactoryPluginIn $build = [ '#theme' => 'image', '#uri' => $logo_path . '/logo-ec--' . $language . '.svg', - '#width' => '290px', + '#width' => '240px', + '#height' => '60px', '#alt' => $title, '#title' => $title, ]; diff --git a/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEuLogoBlock.php b/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEuLogoBlock.php index abf0534fc6d50261f46b3b79300c09998d825d68..13bd674297472ca464d220709ec7212f930925d8 100644 --- a/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEuLogoBlock.php +++ b/modules/oe_whitelabel_helper/src/Plugin/Block/CorporateEuLogoBlock.php @@ -83,7 +83,8 @@ class CorporateEuLogoBlock extends BlockBase implements ContainerFactoryPluginIn $image = [ '#theme' => 'image', '#uri' => $logo_path . '/logo-eu--' . $language . '.svg', - '#width' => '290px', + '#width' => '240px', + '#height' => '60px', '#alt' => $title, '#title' => $title, ]; diff --git a/oe_whitelabel.info.yml b/oe_whitelabel.info.yml index 0fe587586a5e088b76357fbb2bb29558b7fba92c..c1213ce6b323d8367877a3b41428faf417ed38a4 100644 --- a/oe_whitelabel.info.yml +++ b/oe_whitelabel.info.yml @@ -19,14 +19,13 @@ ckeditor_stylesheets: regions: navbar_branding: Navbar branding - navbar_left: Navbar left navbar_right: Navbar right header_top: Header top header_left: Header left header_right: Header right header: Header - sidebar_left: Sidebar left - sidebar_right: Sidebar right + sidebar_left: Sidebar + content_top: Content top content: Content page_bottom: Page bottom footer: Footer diff --git a/templates/overrides/search/block--showcase-exposed-sort-form.html.twig b/templates/overrides/navigation/block--languageswitcherinterfacetext.html.twig similarity index 72% rename from templates/overrides/search/block--showcase-exposed-sort-form.html.twig rename to templates/overrides/navigation/block--languageswitcherinterfacetext.html.twig index 818655b3cb874df0f1722e893ecf141ee3d919c9..a59ef48ca620cdd4316ab1b00f2f080c8927590f 100644 --- a/templates/overrides/search/block--showcase-exposed-sort-form.html.twig +++ b/templates/overrides/navigation/block--languageswitcherinterfacetext.html.twig @@ -1,7 +1,7 @@ {# /** * @file - * Theme override to display a block. + * Default theme implementation to display a block. * * Available variables: * - plugin_id: The ID of the block implementation. @@ -23,26 +23,10 @@ * displayed after the main title tag that appears in the template. * * @see template_preprocess_block() + * + * @ingroup themeable */ #} - -{% - set classes = [ - 'block', - 'block-' ~ configuration.provider|clean_class, - 'block-' ~ plugin_id|clean_class, - 'mb-3', - 'clearfix', - ] -%} - -<div{{ attributes.addClass(classes) }}> - {{ title_prefix }} - {% if label %} - <h2{{ title_attributes }}>{{ label }}</h2> - {% endif %} - {{ title_suffix }} - {% block content %} - {{ content|without('text') }} - {% endblock %} -</div> +{% block content %} + {{ content }} +{% endblock %} diff --git a/templates/overrides/navigation/block--oe-authentication-login_block.html.twig b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig index a38878e8b88b54fbfb69d0c66276c21e797f1092..ab6894963ac6ce6c1d28f440452e54ed06822368 100644 --- a/templates/overrides/navigation/block--oe-authentication-login_block.html.twig +++ b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig @@ -7,17 +7,15 @@ {% set extra_attributes = create_attribute() %} {% set extra_attributes = extra_attributes.addClass('nav-link') %} -<ul class="nav oe-authentication"> - <li class="nav-item"> - {{ pattern('link', { - label: content['#title']|render, - path: content['#url']|render, - icon: { - name: 'person-fill', - size: 's' - }, - icon_position: 'before', - attributes: extra_attributes - }) }} - </li> -</ul> +<li class="nav-item oe-authentication"> + {{ pattern('link', { + label: content['#title']|render, + path: content['#url']|render, + icon: { + name: 'person-fill', + size: 's' + }, + icon_position: 'before', + attributes: extra_attributes + }) }} +</li> diff --git a/templates/overrides/navigation/links--language-block.html.twig b/templates/overrides/navigation/links--language-block.html.twig index 0231b11a163ad9da9e1c1a89497272f0c80349d4..e8df20ade528b37c6443e40ca097582d4ad5d5a3 100644 --- a/templates/overrides/navigation/links--language-block.html.twig +++ b/templates/overrides/navigation/links--language-block.html.twig @@ -22,20 +22,18 @@ {% set extra_attributes = extra_attributes.setAttribute('data-bs-target', '#' ~ _language.link.target) %} {% set extra_attributes = extra_attributes.addClass('nav-link') %} -<ul class="nav"> - <li class="nav-item"> - {{ pattern('link', { - label: _language.link.label, - path: _language.link.href, - icon: { - name: 'chat-left-dots-fill', - size: 's' - }, - icon_position: 'before', - attributes: extra_attributes - }) }} - </li> -</ul> +<li class="nav-item language-switcher"> + {{ pattern('link', { + label: _language.link.label, + path: _language.link.href, + icon: { + name: 'chat-left-dots-fill', + size: 's' + }, + icon_position: 'before', + attributes: extra_attributes + }) }} +</li> {% include '@oe_whitelabel/patterns/modal/modal-language.html.twig' with _language.modal only %} diff --git a/templates/overrides/page/page.html.twig b/templates/overrides/page/page.html.twig index 7303a13fb9837798db67a5c436fce7a0d7614796..17aa1b53fba3108470db50fb2ce4fd18c9b58175 100644 --- a/templates/overrides/page/page.html.twig +++ b/templates/overrides/page/page.html.twig @@ -48,45 +48,40 @@ */ #} <div class="page"> - - {{ pattern('navbar', { - navbar_branding: page.navbar_branding ? page.navbar_branding : false, - navbar_left: page.navbar_left ? page.navbar_left : false, - navbar_right: page.navbar_right ? page.navbar_right : false, - style: 'light' - }) }} - {{ pattern('header_nav', { + navbar_branding: page.navbar_branding, + navbar_right: page.navbar_right, header_top: page.header_top, header_left: page.header_left, header_right: page.header_right }) }} - <main class="pt-5 pb-5"> + <main> {% if page.header %} - <header class="page__header mb-3"> - <div class="container"> - {{ page.header }} - </div> - </header> + <div class="container mt-2"> + {% else %} + <div class="container mt-5"> {% endif %} - - <div class="container"> <div class="row"> + {% if page.header %} + {{ page.header }} + {% endif %} + {% if page.sidebar_left %} <div class="col-md-3"> {{ page.sidebar_left }} </div> {% endif %} - {% if page.sidebar_right %} - <div class="container"> - {{ page.sidebar_right }} + {% if page.content or page.content_top %} + <div class="col-12 col-lg-9"> + {% if page.content_top %} + <div class="mb-3 clearfix"> + {{ page.content_top }} </div> - {% endif %} + <hr class="d-none d-md-block mb-4"> + {% endif %} - {% if page.content %} - <div class="page__content col-12 col-lg-9"> {{ page.content }} </div> {% endif %} diff --git a/templates/overrides/search/block--facets-form.html.twig b/templates/overrides/search/block--facets-form.html.twig index 645c62fc0231f3c7d1ac78dca3a972ff70e445cc..3e5c4ab43a0cd851b06b2c797721220a8df0967f 100644 --- a/templates/overrides/search/block--facets-form.html.twig +++ b/templates/overrides/search/block--facets-form.html.twig @@ -61,5 +61,6 @@ 'extra_classes_header': "p-lg-0", 'with_trigger': true, 'toggle_button_label': label, + 'icon_name': 'sliders' }) }} {% endblock %} diff --git a/templates/overrides/search/block--facets-summary-block.html.twig b/templates/overrides/search/block--facets-summary-block.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..4a064fdada9501603582d9b4b26915ade45fa364 --- /dev/null +++ b/templates/overrides/search/block--facets-summary-block.html.twig @@ -0,0 +1,50 @@ +{# +/** + * @file + * Default theme implementation to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * 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. + * + * @see template_preprocess_block() + * + * @ingroup themeable + */ +#} +{% set has_results_count = false %} +{% if content['#items'][0]['#theme'] is defined and content['#items'][0]['#theme'] == 'facets_summary_count' %} + {% set results_count = content['#items'][0]['#count'] %} + {% set has_results_count = true %} +{% endif %} + +{% block content %} + {% spaceless %} + {{ title_prefix }} + {% if label %} + <h4 class="mb-4"> + {{ label }} + {% if has_results_count %} + <span class="source-summary-count">({{ results_count }})</span> + {% endif %} + </h4> + {% endif %} + {{ title_suffix }} + {{ content }} + {% endspaceless %} +{% endblock %} diff --git a/templates/overrides/search/facets-summary-count.html.twig b/templates/overrides/search/facets-summary-count.html.twig index 7b8c284d1e19842c9c310c0dedfd011da19cdc61..e5fb7ca8919bc7ccec8ed14060c8d807336ce6d3 100644 --- a/templates/overrides/search/facets-summary-count.html.twig +++ b/templates/overrides/search/facets-summary-count.html.twig @@ -1,14 +1 @@ -{# -/** - * @file - * Default theme implementation to display source summary block total count. - * - * Available variables: - * - count: The total number of records retrieved. - */ -#} -<h4 class="mb-4"> - <span class="source-summary-count"> - {% trans %}Search result{% plural count %} Search results ({{ count }}){% endtrans %} - </span> -</h4> +{# Empty file, see block--facets-summary-block.html.twig #} diff --git a/templates/overrides/search/facets-summary-item-list.html.twig b/templates/overrides/search/facets-summary-item-list.html.twig index a2719a3c0495a4c01e128e7bf321af980bcdc217..a86fe2ee002c03de0220e7fff331388a98ab40eb 100755 --- a/templates/overrides/search/facets-summary-item-list.html.twig +++ b/templates/overrides/search/facets-summary-item-list.html.twig @@ -21,21 +21,10 @@ * @ingroup themeable */ #} -{% if context.list_style %} - {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %} -{% endif %} -{% if items or empty %} - {%- if title is not empty -%} - <h3>{{ title }}</h3> - {%- endif -%} - - {%- if items -%} - <{{ list_type }}{{ attributes }}> - {%- for item in items -%} - {{ item }} - {%- endfor -%} - </{{ list_type }}> - {%- else -%} - {{- empty -}} - {%- endif -%} -{%- endif %} +{%- if items -%} + {%- for item in items -%} + {{ item }} + {%- endfor -%} +{%- else -%} + {{- empty -}} +{%- endif -%} diff --git a/templates/overrides/search/pager.html.twig b/templates/overrides/search/pager.html.twig new file mode 100755 index 0000000000000000000000000000000000000000..aebfe1fff870fbfdc2dc459b162b058aef1084cf --- /dev/null +++ b/templates/overrides/search/pager.html.twig @@ -0,0 +1,27 @@ +{# +/** + * @file + * Template for a full pager. + */ +#} +{% if items %} + {% set previous = items.previous ? {'label': items.previous.text, 'path': items.previous.href } : {} %} + {% set next = items.next ? {'label': items.next.text, 'path': items.next.href } : {} %} + {% set pages = {} %} + {% for key, item in items.pages %} + {% set values = { 'label': key, 'path': item.href } %} + {% if current == key %} + {% set values = values|merge({ 'active': true }) %} + {% endif %} + {% set pages = pages|merge([values]) %} + {% endfor %} + {% block content %} + <hr class="mb-5"> + {{ pattern('pagination', { + items: pages, + alignment: 'center', + prev: previous, + next: next + }) }} + {% endblock %} +{% endif %} diff --git a/templates/overrides/search/views-mini-pager.html.twig b/templates/overrides/search/views-mini-pager.html.twig new file mode 100755 index 0000000000000000000000000000000000000000..c5600033eb1819819224a0c84a29308863a1cd88 --- /dev/null +++ b/templates/overrides/search/views-mini-pager.html.twig @@ -0,0 +1,21 @@ +{# +/** + * @file + * Template for a mini pager. + */ +#} +{% if items %} + {% set previous = items.previous ? {'label': items.previous.text, 'path': items.previous.href } : {} %} + {% set next = items.next ? {'label': items.next.text, 'path': items.next.href } : {} %} + {% set pages = {} %} + {% set pages = pages|merge([{ 'label': items.current, 'disabled': true }]) %} + {% block content %} + <hr class="mb-5"> + {{ pattern('pagination', { + items: pages, + alignment: 'center', + prev: previous, + next: next, + }) }} + {% endblock %} +{% endif %} diff --git a/templates/patterns/header_nav/header_nav.ui_patterns.yml b/templates/patterns/header_nav/header_nav.ui_patterns.yml index 1108f5c180342ba8d8f288e9b87ca6a0e9370585..5540f65deeae9fb3cedac27d4b4cb290bfe3dda5 100644 --- a/templates/patterns/header_nav/header_nav.ui_patterns.yml +++ b/templates/patterns/header_nav/header_nav.ui_patterns.yml @@ -2,6 +2,19 @@ header_nav: label: Header Navigation description: A navigation section for the header fields: + navbar_branding: + type: array + label: "Brand title" + description: "Your company, product, or project name." + preview: + - type: html_tag + tag: span + value: "Brand" + navbar_right: + type: array + label: Text + description: "Vertically centered strings of text." + preview: "Navbar text with an inline element" header_top: type: array label: 'Header Top' diff --git a/templates/patterns/header_nav/pattern-header_nav.html.twig b/templates/patterns/header_nav/pattern-header_nav.html.twig index 465691b70dbeeb720e205fded78c5e18be01e52f..f66e9e11cc7b1b16140537b789a47f5f5a04f8c2 100644 --- a/templates/patterns/header_nav/pattern-header_nav.html.twig +++ b/templates/patterns/header_nav/pattern-header_nav.html.twig @@ -1,28 +1,38 @@ -<nav class="oe-header__navbar navbar navbar-expand-lg navbar-dark"> +<header> <div class="container"> - <button - class="navbar-toggler" - type="button" - data-bs-toggle="collapse" - data-bs-target="#navbarNavDropdown" - aria-controls="navbarNavDropdown" - aria-expanded="false" - aria-label="Toggle navigation" - > - <span class="navbar-toggler-icon"></span> - </button> - <div class="collapse navbar-collapse" id="navbarNavDropdown"> - <div class="container"> - {{ header_top }} - <div class="row"> - <div class="col-9"> - {{ header_left }} - </div> - <div class="col-3"> - {{ header_right }} + <div class="oe-header"> + {{ navbar_branding }} + <ul class="nav"> + {{ navbar_right }} + </ul> + </div> + </div> + <nav class="oe-header__navbar navbar navbar-expand-lg navbar-dark"> + <div class="container"> + <button + class="navbar-toggler" + type="button" + data-bs-toggle="collapse" + data-bs-target="#navbarNavDropdown" + aria-controls="navbarNavDropdown" + aria-expanded="false" + aria-label="Toggle navigation" + > + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNavDropdown"> + <div class="container"> + {{ header_top }} + <div class="row"> + <div class="col-9"> + {{ header_left }} + </div> + <div class="col-3"> + {{ header_right }} + </div> </div> </div> </div> </div> - </div> -</nav> + </nav> +</header> diff --git a/tests/src/Kernel/MultilingualBlockTest.php b/tests/src/Kernel/MultilingualBlockTest.php index 656b518dc268d352183fbb070d5f383ac39a23b9..150ed5e78be7b62dccacc5c5dcef734c3664bdde 100644 --- a/tests/src/Kernel/MultilingualBlockTest.php +++ b/tests/src/Kernel/MultilingualBlockTest.php @@ -95,7 +95,7 @@ class MultilingualBlockTest extends KernelTestBase { $render = $this->container->get('renderer')->renderRoot($build); $crawler = new Crawler($render->__toString()); - $block = $crawler->filter('#block-languageswitcherinterfacetext'); + $block = $crawler->filter('li.language-switcher'); $this->assertCount(1, $block); $link = $crawler->filter('a.nav-link'); $this->assertSame('English', trim($link->text()));