Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/css/styles.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/scss/06_components/paragraphs/_unit-search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
padding-bottom: 55px; // Leave enough room between the last card and footer.
}

.views--unit-search {
.unit-search__content {
margin-top: $spacing-double;

.form-actions {
Expand Down
57 changes: 57 additions & 0 deletions templates/component/unit-search.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{%
set classes = [
'views',
'views--' ~ id|clean_class,
'views--' ~ display_id|clean_class,
dom_id ? 'js-view-dom-id-' ~ dom_id,
'unit-search__content'
]
%}

{% if modifier_class %}
{% set classes = classes|merge(modifier_class) %}
{% endif %}

<div{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{{ title }}
{{ title_suffix }}

{% if header %}
<header>
{{ header }}
</header>
{% endif %}

{{ exposed }}
{{ attachment_before }}

<div class="unit-search__results" data-id-number="{{ dom_id }}">
<h3 class="unit-search__count-container">
{% block count_container%}
{%- if total_rows -%}
{{ total_rows }} {% trans with {'context': 'Unit search count'} %}result{% plural total_rows %}results{% endtrans %}
{%- else -%}
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
{%- endif -%}
{% endblock %}
</h3>

{%- if empty -%}
<p>{{ 'No results were found for the criteria you entered. Try changing your search criteria.'|t({}, {'context' : 'Unit search no results text'}) }}</p>
{%- endif -%}

{{ rows }}
{{ pager }}
</div>
{{ attachment_after }}
{{ more }}

{% if footer %}
<footer>
{{ footer }}
</footer>
{% endif %}

{{ feed_icons }}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'views',
'views--service-list',
'views--service-list--search',
'views--unit-search',
'unit-search__content',
dom_id ? 'js-view-dom-id-' ~ dom_id,
]
%}
Expand Down
95 changes: 1 addition & 94 deletions templates/views/views-view--unit-search.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,7 @@
/**
* @file
* Theme override for main view template.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - css_name: A css-safe version of the view name.
* - css_class: The user-specified classes names, if any.
* - header: The optional header.
* - footer: The optional footer.
* - rows: The results of the view query, if any.
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
* - feed_icons: Optional feed icons to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the view title.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the view title.
* - attachment_before: An optional attachment view to be displayed before the
* view content.
* - attachment_after: An optional attachment view to be displayed after the
* view content.
* - dom_id: Unique id for every view being printed to give unique class for
* Javascript.
*
* @see template_preprocess_views_view()
*/
#}
{%
set classes = [
'views',
'views--' ~ id|clean_class,
'views--' ~ display_id|clean_class,
dom_id ? 'js-view-dom-id-' ~ dom_id,
'unit-search__content'
]
%}

{% if results_term_singular is not empty %}
{% set results_term_singular_value = results_term_singular %}
{% else %}
{% set results_term_singular_value = ' ' ~ 'result'|t({}, {'context' : 'Unit search count singular'}) %}
{% endif %}

{% if results_term_plural is not empty %}
{% set results_term_plural_value = results_term_plural %}
{% else %}
{% set results_term_plural_value = ' ' ~ 'results'|t({}, {'context' : 'Unit search count plural'}) %}
{% endif %}

<div{{attributes.addClass(classes)}}>
{{ title_prefix }}
{{ title }}
{{ title_suffix }}

{% if header %}
<header>
{{ header }}
</header>
{% endif %}

{{ exposed }}
{{ attachment_before }}

<div class="unit-search__results" data-id-number="{{ dom_id }}">
<h3 class="unit-search__count-container">
{%- if total_rows -%}
{{ total_rows }}
{% if total_rows == '1' %}
{{ results_term_singular_value }}
{% else %}
{{ results_term_plural_value }}
{% endif %}
{%- else -%}
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
{%- endif -%}
</h3>

{%- if empty -%}
<p>{{ 'No results were found for the criteria you entered. Try changing your search criteria.'|t({}, {'context' : 'Unit search no results text'}) }}</p>
{%- endif -%}

{{ rows }}

{{ pager }}
</div>
{{ attachment_after }}
{{ more }}

{% if footer %}
<footer>
{{ footer }}
</footer>
{% endif %}

{{ feed_icons }}
</div>
{% include '@hdbt/component/unit-search.twig' %}
6 changes: 6 additions & 0 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,12 @@ msgctxt "Unit search count plural"
msgid "results"
msgstr "tulosta"

msgctxt "Unit search count"
msgid "result"
msgid_plural "results"
msgstr[0] "tulos"
msgstr[1] "tulosta"

msgctxt "Unit search no results title"
msgid "No results"
msgstr "Ei hakutuloksia"
Expand Down
6 changes: 6 additions & 0 deletions translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,12 @@ msgctxt "Unit search count plural"
msgid "results"
msgstr "resultat"

msgctxt "Unit search count"
msgid "result"
msgid_plural "results"
msgstr[0] "resultat"
msgstr[1] "resultat"

msgctxt "Unit search no results title"
msgid "No results"
msgstr "Inga sökresultat"
Expand Down
Loading