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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [4.11.0] - 2025-07-01

* [PR-533](https://github.com/itk-dev/deltag.aarhus.dk/pull/533)
Show deadline date on hearing teaser instead of startdate - Closes issues #532
* [PR-531](https://github.com/itk-dev/deltag.aarhus.dk/pull/531)
Added custom toolbar visibility logic (replacing [Toolbar
Visibility](https://www.drupal.org/project/toolbar_visibility))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,15 @@ public function getStartDate(NodeInterface $node): ?int {
return $node->field_start_date->date->getTimestamp();
}

/**
* Get deadline date.
*/
public function getDeadlineDate(NodeInterface $node): ?int {
if (!$this->isHearing($node)) {
return NULL;
}

return $node->field_reply_deadline->date->getTimestamp();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@
{# Set how many replies there is to this hearing #}
{% set repliesCount = hearing_helper.getNumberOfReplies(node) %}

{# Set date for next meeting #}
{# Set startdate for hearing #}
{% set startdate = hearing_helper.getStartDate(node) %}

{# Set deadlinedate for hearing #}
{% set deadlinedate = hearing_helper.getDeadlineDate(node) %}

{# Set is deadlinepassed #}
{% set deadlinepassed = hearing_helper.isDeadlinePassed(node) %}

{# Show a date splash on the card #}
{% block card_date %}
{# If we have a date then show a date splash on the card #}
{% if (startdate) %}
{% if (content_state in ['upcoming', 'active']) %}
{# Show the date #}
<div class="fw-semibold">{{ startdate|format_date('hoeringsportal_day_only') }}</div>
<div class="small">{{ startdate|format_date('hoeringsportal_month_short') }}</div>
<div class="fw-semibold">{{ deadlinedate|format_date('hoeringsportal_day_only') }}</div>
<div class="small">{{ deadlinedate|format_date('hoeringsportal_month_short') }}</div>
{% elseif (content_state in ['finished']) %}
<div><strong>{{ 'Ended'|t }}</strong></div>
{% elseif (content_state in ['canceled']) %}
<div>{{ 'Canceled'|t }}</div>
{% endif %}
{% endblock %}

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

{# Show card information #}
{% block card_type_information %}

{# Show details for next Hearing #}
{% if (content_state in ['upcoming', 'active']) %}
{% for item in items %}
<div class="d-flex gap-3 justify-items-center {% if not loop.last %} border-bottom {% endif %}">
<i class="fa-solid fa-fw fa-lg {{ item.icon }} text-hearing"></i>
<p class="small">{{ item.value }}</p>
</div>
{% endfor %}

{# Show text for finished Hearing #}
{% elseif (content_state == 'finished') %}
<p>{{ 'Hearing has ended'|t }}</p>

{% if (content_state in ['upcoming', 'active', 'finished']) %}
{% for item in items %}
<div class="d-flex gap-3 justify-items-center {% if not loop.last %} border-bottom {% endif %}">
<i class="fa-solid fa-fw fa-lg {{ item.icon }} text-hearing"></i>
<p class="small">{{ item.value }}</p>
</div>
{% endfor %}
{# Show text for canceled Hearing #}
{% elseif (content_state == 'canceled') %}
<p>{{ 'Hearing has been canceled'|t }}</p>
Expand Down