diff --git a/components/card/card-highlighting-search-results.html.twig b/components/card/card-highlighting-search-results.html.twig new file mode 100644 index 00000000..0fe40aef --- /dev/null +++ b/components/card/card-highlighting-search-results.html.twig @@ -0,0 +1,119 @@ +{# +/** + * @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 + */ +#} +{% apply spaceless %} + {# Set defaults #} + {% set _card_variant = card_variant|default('petrol') %} + + {% set classes = [ + 'node', + 'article-wrapper', + 'node--type-' ~ node.bundle|clean_class, + node.isPromoted() ? 'node--promoted', + node.isSticky() ? 'node--sticky', + not node.isPublished() ? 'node--unpublished', + view_mode ? 'node--view-mode-' ~ view_mode|clean_class, + ] %} + <article{{ attributes.addClass(classes) }}> + <header> + {% if title_prefix %} + <small class="text-{{ _card_variant }}"> + {{ title_prefix }} + </small> + {% endif %} + <h3{{ title_attributes.addClass(['h4', 'mb-2']) }}> + <a href="{{ url }}" title="{{ 'Read more about:'|t }} {{ label[0]['#context'].value }}" rel="bookmark"> + {{ label }} + {% if title_suffix %}<small class="d-block fw-normal lh-1 mt-1">{{ title_suffix }}</small>{% endif %} + </a> + </h3> + </header> + <section{{ content_attributes.addClass(['node__content', 'pt-2']) }}> + {% if content.field_copertina[0] is iterable %} + <div class="float-start me-3 mb-1"> + {{ content.field_copertina }} + </div> + {% endif %} + <div> + {{ content|without('field_copertina', 'field_argomenti') }} + </div> + <div class="pt-3"> + {{ content.field_argomenti }} + </div> + </section> + <footer class="mt-3" aria-label="Collegamenti per approfondire {{ label[0]['#context'].value }}"> + <a class="read-more text-{{ _card_variant }}" href="{{ url }}" title="{{ 'Read more about'|t }} {{ label[0]['#context'].value }}" rel="bookmark"> + <span class="text">{{ 'Read more'|t }}</span> + <span class="visually-hidden">{{ 'about'|t }} {{ label[0]['#context'].value }}</span> + {% include '@bi-bcl/icon/icon.html.twig' with {name: 'it-arrow-right'} %} + </a> + </footer> + </article> +{% endapply %} diff --git a/templates/field/field--view-mode-search-result--type-entity-reference--name-field-argomenti.html.twig b/templates/field/field--view-mode-search-result--type-entity-reference--name-field-argomenti.html.twig new file mode 100644 index 00000000..54d6632a --- /dev/null +++ b/templates/field/field--view-mode-search-result--type-entity-reference--name-field-argomenti.html.twig @@ -0,0 +1,6 @@ +{% include '@bi-field/field-reference--format-label--component-badge.html.twig' with { + background: 'petrol', + rounded_pill: true, + outline: true, + attributes: attributes.addClass('badges'), +} %} diff --git a/templates/node/_partial.field--type-date--name-dal-al.html.twig b/templates/node/_partial.field--type-date--name-dal-al.html.twig index 7f3b80c6..67a3de7c 100644 --- a/templates/node/_partial.field--type-date--name-dal-al.html.twig +++ b/templates/node/_partial.field--type-date--name-dal-al.html.twig @@ -2,6 +2,8 @@ {% set giorno_fine = content.field_data_fine[0]['#attributes']['datetime']|date('Y-m-d') %} {% if giorno_inizio == giorno_fine %} {{ content.field_data_inizio }} dalle {{ content.field_data_inizio[0]['#attributes']['datetime']|date('H:i') }} alle {{ content.field_data_fine[0]['#attributes']['datetime']|date('H:i') }} -{% else %} +{% elseif content.field_data_fine[0] is iterable %} dal {{ content.field_data_inizio }} al {{ content.field_data_fine }} +{% else %} + {{ content.field_data_inizio }} {% endif %} diff --git a/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-entity-reference--name-field-anno-scolastico.html.twig b/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-entity-reference--name-field-anno-scolastico.html.twig new file mode 100644 index 00000000..7941d019 --- /dev/null +++ b/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-entity-reference--name-field-anno-scolastico.html.twig @@ -0,0 +1 @@ +{% include '@skenografia/field/_field--raw.html.twig' %} diff --git a/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-integer--name-field-numero-circolare.html.twig b/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-integer--name-field-numero-circolare.html.twig new file mode 100644 index 00000000..7941d019 --- /dev/null +++ b/templates/node/circolare/field--view-mode-search-result--bundle-circolare--type-integer--name-field-numero-circolare.html.twig @@ -0,0 +1 @@ +{% include '@skenografia/field/_field--raw.html.twig' %} diff --git a/templates/node/circolare/node--type-circolare--view-mode-search-result.html.twig b/templates/node/circolare/node--type-circolare--view-mode-search-result.html.twig new file mode 100644 index 00000000..cf05638c --- /dev/null +++ b/templates/node/circolare/node--type-circolare--view-mode-search-result.html.twig @@ -0,0 +1,6 @@ +{% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'greendark', + title_prefix: 'Circolare ' ~ content.field_numero_circolare|render|striptags|trim ~ '-' ~ content.field_anno_scolastico|render|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_numero_circolare', 'field_anno_scolastico', 'field_abstract') +} %} diff --git a/templates/node/documento/node--type-documento--view-mode-search-result.html.twig b/templates/node/documento/node--type-documento--view-mode-search-result.html.twig new file mode 100644 index 00000000..524e8e10 --- /dev/null +++ b/templates/node/documento/node--type-documento--view-mode-search-result.html.twig @@ -0,0 +1,6 @@ +{% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'redbrown', + title_prefix: 'Documento Prot. ' ~ content.field_protocollo|render|striptags|trim ~ ' del ' ~ content.field_data_inizio|render|striptags|trim ~ ' - ' ~ content.field_tipologia_documento|render|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_protocollo', 'field_data_inizio', 'field_tipologia_documento','field_abstract') +} %} diff --git a/templates/node/evento/node--type-evento--view-mode-search-result.html.twig b/templates/node/evento/node--type-evento--view-mode-search-result.html.twig new file mode 100644 index 00000000..8194c274 --- /dev/null +++ b/templates/node/evento/node--type-evento--view-mode-search-result.html.twig @@ -0,0 +1,11 @@ +{% apply spaceless %} + {% set _dal_al %} + {% include '@skenografia/node/_partial.field--type-date--name-dal-al.html.twig' %} + {% endset %} + {% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'greendark', + title_prefix: 'Evento ' ~ _dal_al|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_data_inizio', 'field_data_fine','field_abstract') + } %} +{% endapply %} diff --git a/templates/node/finanziamento/node--type-finanziamento--view-mode-search-result.html.twig b/templates/node/finanziamento/node--type-finanziamento--view-mode-search-result.html.twig new file mode 100644 index 00000000..0c202fa0 --- /dev/null +++ b/templates/node/finanziamento/node--type-finanziamento--view-mode-search-result.html.twig @@ -0,0 +1,6 @@ +{% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'greendark', + title_prefix: 'Finanziamento ' ~ content.field_tipologia_finanziamento|render|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_tipologia_finanziamento', 'field_abstract') +} %} diff --git a/templates/node/node--search-result.html.twig b/templates/node/node--search-result.html.twig new file mode 100644 index 00000000..1c28a494 --- /dev/null +++ b/templates/node/node--search-result.html.twig @@ -0,0 +1,94 @@ +{# +/** + * @file + * Default theme implementation to card display a node. + * To activate this template you need to add a display named 'card'. + * + * 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 + */ +#} +{% apply spaceless %} + {% set node_variants_map = { + 'persona': 'redbrown', + 'luogo': 'redbrown', + 'documento': 'redbrown', + 'struttura-organizzativa': 'redbrown', + 'servizio': 'purplelight', + 'percorso-di-studio': 'purplelight', + 'article': 'greendark', + 'circolare': 'greendark', + 'evento': 'greendark', + 'finanziamento': 'greendark', + 'scheda-didattica': 'bluelectric', + 'progetto': 'bluelectric', + 'classe': 'bluelectric' + } %} + {% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: node_variants_map[node.bundle|clean_id] ?? 'petrol', + title_prefix: drupal_config('node.type.' ~ node.bundle, 'name'), + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_abstract') + } %} +{% endapply %} diff --git a/templates/node/progetto/node--type-progetto--view-mode-search-result.html.twig b/templates/node/progetto/node--type-progetto--view-mode-search-result.html.twig new file mode 100644 index 00000000..e4251523 --- /dev/null +++ b/templates/node/progetto/node--type-progetto--view-mode-search-result.html.twig @@ -0,0 +1,11 @@ +{% apply spaceless %} + {% set _dal_al %} + {% include '@skenografia/node/_partial.field--type-date--name-dal-al.html.twig' %} + {% endset %} + {% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'bluelectric', + title_prefix: 'Progetto - ' ~ _dal_al|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_data_inizio', 'field_data_fine','field_abstract') + } %} +{% endapply %} diff --git a/templates/node/servizio/node--type-servizio--view-mode-search-result.html.twig b/templates/node/servizio/node--type-servizio--view-mode-search-result.html.twig new file mode 100644 index 00000000..3dd99fad --- /dev/null +++ b/templates/node/servizio/node--type-servizio--view-mode-search-result.html.twig @@ -0,0 +1,6 @@ +{% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'purplelight', + title_prefix: 'Servizio per ' ~ content.field_tipologia_servizio|render|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_tipologia_servizio', 'field_abstract') +} %} diff --git a/templates/node/struttura_organizzativa/node--type-struttura_organizzativa--view-mode-search-result.html.twig b/templates/node/struttura_organizzativa/node--type-struttura_organizzativa--view-mode-search-result.html.twig new file mode 100644 index 00000000..ad162e64 --- /dev/null +++ b/templates/node/struttura_organizzativa/node--type-struttura_organizzativa--view-mode-search-result.html.twig @@ -0,0 +1,6 @@ +{% include '@skenografia_components/card/card-highlighting-search-results.html.twig' with { + card_variant: 'redbrown', + title_prefix: 'Struttura organizzativa - ' ~ content.field_tipologia_struttura|render|striptags|trim, + title_suffix: content.field_abstract|render|striptags|trim, + content: content|without('field_tipologia_struttura', 'field_abstract') +} %} diff --git a/templates/views/search/block--title--views-exposed-filter-block--risultati-ricerca-page-1.html.twig b/templates/views/search/block--title--views-exposed-filter-block--risultati-ricerca-page-1.html.twig new file mode 100644 index 00000000..1b34bc9f --- /dev/null +++ b/templates/views/search/block--title--views-exposed-filter-block--risultati-ricerca-page-1.html.twig @@ -0,0 +1,51 @@ +{# +/** + * @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 + */ +#} +{% apply spaceless %} + {% set id_block = 'it-' ~ attributes.id %} + {% set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'mt-5', + 'd-none', + 'd-lg-block' + ] %} + + <div{{ attributes.addClass(classes).setAttribute('id', id_block) }}> + {{ title_prefix }} + {% if label %} + <h2{{ title_attributes }}>{{ label }}</h2> + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + </div> +{% endapply %} diff --git a/templates/views/search/form-element--name--ftxt.html.twig b/templates/views/search/form-element--name--ftxt.html.twig index 51cb586c..87bcfaf2 100644 --- a/templates/views/search/form-element--name--ftxt.html.twig +++ b/templates/views/search/form-element--name--ftxt.html.twig @@ -80,7 +80,7 @@ {% include '@bi-bcl/icon/icon.html.twig' with { name: 'icon-search', size: 'lg', - color: 'bluelectric', + color: 'petrol', icon_classes: ['svg-search'] } %} </span> diff --git a/templates/views/search/input--submit--id--edit-submit-risultati-ricerca--3.html.twig b/templates/views/search/input--submit--id--edit-submit-risultati-ricerca--3.html.twig new file mode 100644 index 00000000..2b748423 --- /dev/null +++ b/templates/views/search/input--submit--id--edit-submit-risultati-ricerca--3.html.twig @@ -0,0 +1 @@ +{% include '@skenografia/views/search/input--submit--id--edit-submit-risultati-ricerca.html.twig' %} diff --git a/templates/views/search/input--submit--id--edit-submit-risultati-ricerca.html.twig b/templates/views/search/input--submit--id--edit-submit-risultati-ricerca.html.twig index a92a597b..69f08d0b 100644 --- a/templates/views/search/input--submit--id--edit-submit-risultati-ricerca.html.twig +++ b/templates/views/search/input--submit--id--edit-submit-risultati-ricerca.html.twig @@ -20,6 +20,17 @@ .setAttribute('type', 'submit') %} + <button{{ _attributes + .removeClass('btn-outline-bluelectric') + .addClass('btn-outline-primary') + .setAttribute('aria-label', 'Avvia la ricerca') + .setAttribute('data-element', 'search-submit') + .setAttribute('onclick', 'addHiddenValues(["tutti_i_valori"])') + }}> + Cerca in + <strong class="text-uppercase text-small-bold">tutto il sito</strong> + </button> + <button{{ _attributes .addClass('btn-outline-redbrown') .setAttribute('aria-label', 'Avvia la ricerca nella sezione scuola') @@ -59,17 +70,6 @@ <strong class="text-uppercase text-small-bold">Didattica</strong> </button> - <button{{ _attributes - .removeClass('btn-outline-bluelectric') - .addClass('btn-outline-primary') - .setAttribute('aria-label', 'Avvia la ricerca') - .setAttribute('data-element', 'search-submit') - .setAttribute('onclick', 'addHiddenValues(["tutti_i_valori"])') - }}> - Cerca in - <strong class="text-uppercase text-small-bold">tutto il sito</strong> - </button> - <input type="hidden" name="f[]" id="hidden-field" value=""> </div> {% endapply %} diff --git a/templates/views/search/page--risultati-ricerca.html.twig b/templates/views/search/page--risultati-ricerca.html.twig index 7341a580..3c8c3c2d 100644 --- a/templates/views/search/page--risultati-ricerca.html.twig +++ b/templates/views/search/page--risultati-ricerca.html.twig @@ -71,10 +71,10 @@ <section class="bg-gray-light mt-lg-5"> <div class="container"> <div class="row variable-gutters"> - <div class="col-lg-3 pt-5 bg-white bg-white-left affix-parent d-none d-lg-block"> + <div class="col-lg-3 bg-white bg-white-left affix-parent d-none d-lg-block"> <aside class="aside-list affix-top mb-5"> - <h2 class="visually-hidden">Filtri</h2> - <p class="visually-hidden">Di seguito una serie di filtri per affinare la tua ricerca.</p> + <h2 class="fw-semibold">Filtri</h2> + <p>Usa i seguenti filtri per affinare la tua ricerca.</p> {{ page.sidebar_first }} </aside> </div>