Skip to content

Commit 6ff1f6a

Browse files
authored
Merge pull request #1051 from City-of-Helsinki/UHF-9568
UHF-9568: Changed search views to use reusable template
2 parents 5e07e4f + c3bcbdf commit 6ff1f6a

File tree

1 file changed

+8
-73
lines changed

1 file changed

+8
-73
lines changed

public/themes/custom/hdbt_subtheme/templates/views/views-view--district-and-project-search.html.twig

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,15 @@
22
/**
33
* @file
44
* Theme override for main view template.
5-
*
6-
* Available variables:
7-
* - attributes: Remaining HTML attributes for the element.
8-
* - css_name: A CSS-safe version of the view name.
9-
* - css_class: The user-specified classes names, if any.
10-
* - header: The optional header.
11-
* - footer: The optional footer.
12-
* - rows: The results of the view query, if any.
13-
* - empty: The content to display if there are no rows.
14-
* - pager: The optional pager next/prev links to display.
15-
* - exposed: Exposed widget form/info to display.
16-
* - feed_icons: Optional feed icons to display.
17-
* - more: An optional link to the next page of results.
18-
* - title: Title of the view, only used when displaying in the admin preview.
19-
* - title_prefix: Additional output populated by modules, intended to be
20-
* displayed in front of the view title.
21-
* - title_suffix: Additional output populated by modules, intended to be
22-
* displayed after the view title.
23-
* - attachment_before: An optional attachment view to be displayed before the
24-
* view content.
25-
* - attachment_after: An optional attachment view to be displayed after the
26-
* view content.
27-
* - dom_id: Unique id for every view being printed to give unique class for
28-
* Javascript.
29-
*
30-
* @see template_preprocess_views_view()
315
*/
326
#}
33-
{%
34-
set classes = [
35-
css_name ? 'views--view-' ~ css_name,
36-
dom_id ? 'js-view-dom-id-' ~ dom_id,
37-
'unit-search__content',
38-
]
39-
%}
40-
<div{{ attributes.addClass(classes) }}>
41-
{{ title_prefix }}
42-
{{ title }}
43-
{{ title_suffix }}
447

45-
{% if header %}
46-
<header>
47-
{{ header }}
48-
</header>
49-
{% endif %}
50-
51-
{{ exposed }}
52-
{{ attachment_before }}
53-
54-
<div class="unit-search__results" data-id-number="{{ dom_id }}">
55-
<h3 class="unit-search__count-container">
56-
{%- if total_rows -%}
57-
{{ total_rows }} {% trans with {'context': 'District and project search fallback'}%}search result{% plural total_rows ?? 0 %}search results{% endtrans %}
58-
{%- else -%}
59-
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
60-
{%- endif -%}
61-
</h3>
62-
63-
{%- if empty -%}
64-
<p>{{ 'No results were found for the criteria you entered. Try changing your search criteria.'|t({}, {'context' : 'Unit search no results text'}) }}</p>
8+
{% embed '@hdbt/component/unit-search.twig'%}
9+
{% block count_container%}
10+
{%- if total_rows -%}
11+
{{ total_rows }} {% trans with {'context': 'District and project search fallback'}%}search result{% plural total_rows ?? 0 %}search results{% endtrans %}
12+
{%- else -%}
13+
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
6514
{%- endif -%}
66-
67-
{{ rows }}
68-
{{ pager }}
69-
</div>
70-
71-
{{ attachment_after }}
72-
{{ more }}
73-
74-
{% if footer %}
75-
<footer>
76-
{{ footer }}
77-
</footer>
78-
{% endif %}
79-
80-
{{ feed_icons }}
81-
</div>
15+
{% endblock count_container %}
16+
{% endembed %}

0 commit comments

Comments
 (0)