Skip to content

Commit 029af67

Browse files
authored
Merge pull request #804 from City-of-Helsinki/UHF-9568
UHF-9568: Changed search views to use reusable template
2 parents 1e03e6e + ac33515 commit 029af67

File tree

8 files changed

+62
-382
lines changed

8 files changed

+62
-382
lines changed

public/themes/custom/hdbt_subtheme/dist/css/styles.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/themes/custom/hdbt_subtheme/src/scss/06_components/paragraphs/_unit-search-variants.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.unit-search--high-school .views--unit-search .views-exposed-form,
2-
.unit-search--vocational-school .views--unit-search .views-exposed-form {
1+
.unit-search--high-school .unit-search__content .views-exposed-form,
2+
.unit-search--vocational-school .unit-search__content .views-exposed-form {
33
@include breakpoint($breakpoint-m) {
44
align-items: flex-end;
55
column-gap: $spacing-and-half;
@@ -35,7 +35,7 @@
3535
}
3636
}
3737

38-
.unit-search--high-school .views--unit-search .views-exposed-form {
38+
.unit-search--high-school .unit-search__content .views-exposed-form {
3939
@include breakpoint($breakpoint-m) {
4040
grid-template-areas:
4141
'filter filter'
@@ -45,7 +45,7 @@
4545
}
4646
}
4747

48-
.unit-search--vocational-school .views--unit-search .views-exposed-form {
48+
.unit-search--vocational-school .unit-search__content .views-exposed-form {
4949
@include breakpoint($breakpoint-m) {
5050
grid-template-areas:
5151
'filter .'
@@ -147,7 +147,7 @@
147147

148148
// If there is sidebar on the basic page and the high school search is on the
149149
// upper content of the site the filters can't fit so they need to be adjusted.
150-
.has-sidebar .components--upper .unit-search--high-school .views--unit-search .views-exposed-form {
150+
.has-sidebar .components--upper .unit-search--high-school .unit-search__content .views-exposed-form {
151151
@include breakpoint($breakpoint-l) {
152152
margin-left: 0;
153153
}

public/themes/custom/hdbt_subtheme/templates/views/views-view--after-school-activity-search.html.twig

Lines changed: 12 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,19 @@
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-
'views',
36-
'views--unit-search',
37-
'views--unit-search--large-volume',
38-
'views--unit-search--after-school-activity-search',
39-
dom_id ? 'js-view-dom-id-' ~ dom_id,
40-
'unit-search__content'
41-
]
42-
%}
43-
<div{{attributes.addClass(classes)}}>
44-
{{ title_prefix }}
45-
{{ title }}
46-
{{ title_suffix }}
477

48-
{{ exposed }}
49-
{{ attachment_before }}
50-
51-
<div class="unit-search__results">
52-
<h3 class="unit-search__count-container">
53-
{%- if total_rows -%}
54-
{{ total_rows }} {% trans with {'context': 'After-school activity search count'}%}activity location{% plural total_rows %}activity locations{% endtrans %}
55-
{%- else -%}
56-
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
57-
{%- endif -%}
58-
</h3>
59-
60-
{% if header %}
61-
{{ header }}
62-
{% endif %}
63-
64-
{{ rows }}
65-
66-
{%- if empty -%}
67-
<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' with {
9+
modifier_class: [
10+
'views--unit-search--large-volume',
11+
]
12+
}%}
13+
{% block count_container%}
14+
{%- if total_rows -%}
15+
{{ total_rows }} {% trans with {'context': 'After-school activity search count'}%}activity location{% plural total_rows %}activity locations{% endtrans %}
16+
{%- else -%}
17+
{{ 'No results'|t({}, {'context' : 'Unit search no results title'}) }}
6818
{%- endif -%}
69-
70-
{{ pager }}
71-
</div>
72-
73-
{{ attachment_after }}
74-
{{ more }}
75-
76-
{% if footer %}
77-
<footer>
78-
{{ footer }}
79-
</footer>
80-
{% endif %}
81-
82-
{{ feed_icons }}
83-
</div>
19+
{% endblock count_container %}
20+
{% endembed %}

0 commit comments

Comments
 (0)