Skip to content

Commit fe29268

Browse files
authored
Merge pull request #533 from itk-dev/532-på-høringslisten-vises-ikke-høringsfrist
532 på høringslisten vises ikke høringsfrist
2 parents 64dd0ee + 267dcd9 commit fe29268

3 files changed

Lines changed: 35 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [4.11.0] - 2025-07-01
1010

11+
* [PR-533](https://github.com/itk-dev/deltag.aarhus.dk/pull/533)
12+
Show deadline date on hearing teaser instead of startdate - Closes issues #532
1113
* [PR-531](https://github.com/itk-dev/deltag.aarhus.dk/pull/531)
1214
Added custom toolbar visibility logic (replacing [Toolbar
1315
Visibility](https://www.drupal.org/project/toolbar_visibility))

web/modules/custom/hoeringsportal_data/src/Helper/HearingHelper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,15 @@ public function getStartDate(NodeInterface $node): ?int {
183183
return $node->field_start_date->date->getTimestamp();
184184
}
185185

186+
/**
187+
* Get deadline date.
188+
*/
189+
public function getDeadlineDate(NodeInterface $node): ?int {
190+
if (!$this->isHearing($node)) {
191+
return NULL;
192+
}
193+
194+
return $node->field_reply_deadline->date->getTimestamp();
195+
}
196+
186197
}

web/themes/custom/hoeringsportal/templates/content/node--hearing--teaser.html.twig

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,26 @@
88
{# Set how many replies there is to this hearing #}
99
{% set repliesCount = hearing_helper.getNumberOfReplies(node) %}
1010

11-
{# Set date for next meeting #}
11+
{# Set startdate for hearing #}
1212
{% set startdate = hearing_helper.getStartDate(node) %}
1313

14+
{# Set deadlinedate for hearing #}
15+
{% set deadlinedate = hearing_helper.getDeadlineDate(node) %}
16+
17+
{# Set is deadlinepassed #}
18+
{% set deadlinepassed = hearing_helper.isDeadlinePassed(node) %}
19+
1420
{# Show a date splash on the card #}
1521
{% block card_date %}
1622
{# If we have a date then show a date splash on the card #}
17-
{% if (startdate) %}
23+
{% if (content_state in ['upcoming', 'active']) %}
1824
{# Show the date #}
19-
<div class="fw-semibold">{{ startdate|format_date('hoeringsportal_day_only') }}</div>
20-
<div class="small">{{ startdate|format_date('hoeringsportal_month_short') }}</div>
25+
<div class="fw-semibold">{{ deadlinedate|format_date('hoeringsportal_day_only') }}</div>
26+
<div class="small">{{ deadlinedate|format_date('hoeringsportal_month_short') }}</div>
27+
{% elseif (content_state in ['finished']) %}
28+
<div><strong>{{ 'Ended'|t }}</strong></div>
29+
{% elseif (content_state in ['canceled']) %}
30+
<div>{{ 'Canceled'|t }}</div>
2131
{% endif %}
2232
{% endblock %}
2333

@@ -29,28 +39,22 @@
2939
{# Collect data for information lines on card #}
3040
{% set items =
3141
[
32-
{icon: 'fa-calendar-day', value: startdate|format_date('hoeringsportal_date_long')|capitalize},
42+
{icon: 'fa-calendar-day', value: deadlinepassed ? 'Hearing has ended'|t : deadlinedate|format_date('hoeringsportal_date_long')|capitalize},
3343
{icon: 'fa-comments', value: repliesCount ~ ' ' ~ 'replies'|t},
3444
{icon: 'fa-location-dot', value: content.field_area}
3545
]
3646
%}
3747

3848
{# Show card information #}
3949
{% block card_type_information %}
40-
4150
{# Show details for next Hearing #}
42-
{% if (content_state in ['upcoming', 'active']) %}
43-
{% for item in items %}
44-
<div class="d-flex gap-3 justify-items-center {% if not loop.last %} border-bottom {% endif %}">
45-
<i class="fa-solid fa-fw fa-lg {{ item.icon }} text-hearing"></i>
46-
<p class="small">{{ item.value }}</p>
47-
</div>
48-
{% endfor %}
49-
50-
{# Show text for finished Hearing #}
51-
{% elseif (content_state == 'finished') %}
52-
<p>{{ 'Hearing has ended'|t }}</p>
53-
51+
{% if (content_state in ['upcoming', 'active', 'finished']) %}
52+
{% for item in items %}
53+
<div class="d-flex gap-3 justify-items-center {% if not loop.last %} border-bottom {% endif %}">
54+
<i class="fa-solid fa-fw fa-lg {{ item.icon }} text-hearing"></i>
55+
<p class="small">{{ item.value }}</p>
56+
</div>
57+
{% endfor %}
5458
{# Show text for canceled Hearing #}
5559
{% elseif (content_state == 'canceled') %}
5660
<p>{{ 'Hearing has been canceled'|t }}</p>

0 commit comments

Comments
 (0)