Skip to content

Commit 081d217

Browse files
authored
Merge pull request #539 from itk-dev/hotfix/5227-public-meeting-summary
5227: Public meeting summary
2 parents fade049 + f4db483 commit 081d217

5 files changed

Lines changed: 33 additions & 17 deletions

File tree

CHANGELOG.md

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

77
## [Unreleased]
88

9+
* [PR-539](https://github.com/itk-dev/deltag.aarhus.dk/pull/539)
10+
Fixed public meeting summary view
911
* [PR-537](https://github.com/itk-dev/deltag.aarhus.dk/pull/537)
1012
5209: Cleaned up public meeting summary view
1113
* [PR-538](https://github.com/itk-dev/deltag.aarhus.dk/pull/538)

web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function load() {
5555
'field_contact' => 'Contact info',
5656
'field_content_state' => 'active',
5757
'field_email_address' => 'a@a.dk',
58-
'field_first_meeting_time' => date('Y-m-d', 1283166912),
5958
'field_media_document' => [[$this->getReference('media_library:Fil:MTM')]],
6059
'field_media_image_single' => [
6160
['target_id' => $this->getReference('media:Large1')->id()],
@@ -89,6 +88,14 @@ public function load() {
8988
$this->addReference('public_meeting:fixture-1', $node);
9089
$node->save();
9190

91+
// Create a copy in the future.
92+
$node = $node->createDuplicate();
93+
$node->setTitle('Future public meeting with manual signup');
94+
$node->set('field_registration_deadline', (new \DateTimeImmutable('today + 12 hours + 4 years'))->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT));
95+
$node->set('field_last_meeting_time', (new \DateTimeImmutable('today + 19 hours + 4 years'))->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT));
96+
$node->set('field_last_meeting_time_end', (new \DateTimeImmutable('today + 21 hours + 4 years'))->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT));
97+
$node->save();
98+
9299
// A public meeting that has signup with Pretix.
93100
$node = $node->createDuplicate();
94101
$node->setTitle('Public meeting with pretix signup');

web/modules/custom/hoeringsportal_content_blocks/templates/hoeringsportal-meeting-warning.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<div class="bg-danger p-3">
1212
<div class="container">
1313
{% if config.content_state is same as('finished') %}
14-
<span class="text-light"><strong>{{ 'Note!'|t }}</strong>{{ 'This public meeting has been held.'|t }}</span>
14+
<span class="text-light"><strong>{{ 'Note!'|t }}</strong> {{ 'This public meeting has been held.'|t }}</span>
1515
{% endif %}
1616
{% if config.content_state is same as('cancelled') %}
17-
<span class="text-light"><strong>{{ 'Note!'|t }}</strong>{{ 'This public meeting has been cancelled.'|t }}</span>
17+
<span class="text-light"><strong>{{ 'Note!'|t }}</strong> {{ 'This public meeting has been cancelled.'|t }}</span>
1818
{% endif %}
1919
</div>
2020
</div>

web/modules/custom/hoeringsportal_public_meeting/src/Helper/PublicMeetingHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ public function getPublicMeetingContext(NodeInterface $node): ?array {
344344
$upcoming = array_values(array_filter($dates, static fn(PretixDate $date) => $date->get('time_from')->getValue() > $now));
345345

346346
return array_filter([
347+
'is_pretix' => $this->hasPretixSignUp($node),
347348
'previous' => $previous,
348349
'current' => $current,
349350
'next' => $next,

web/modules/custom/hoeringsportal_public_meeting/templates/hoeringsportal-public-meeting-summary.html.twig

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*/
1111
#}
1212

13+
{% if public_meeting_context.is_pretix|default(false) %}
14+
1315
{# Define `variables` to match the one used in field--field-pretix-dates.html.twig #}
1416
{# Use current date if set. Otherwise the first upcoming date. #}
1517
{% set variables = public_meeting_context.current|default(public_meeting_context.upcoming|first) %}
@@ -26,20 +28,6 @@
2628
{% set is_current = variables.uuid == public_meeting_context.current.uuid %}
2729
{% set is_next = variables.uuid == public_meeting_context.next.uuid %}
2830
{% set is_first_upcoming = variables.uuid == public_meeting_context.upcoming[0].uuid %}
29-
30-
{# {{ dump({
31-
meeting_cancelled,
32-
meeting_has_been_held,
33-
registration_deadline_passed,
34-
sign_up_url,
35-
availability,
36-
is_previous,
37-
is_current,
38-
is_next,
39-
is_first_upcoming,
40-
41-
variables,
42-
}) }} #}
4331
{% endif %}
4432

4533
{% if public_meeting_context.current %}
@@ -105,3 +93,21 @@
10593
<h3 class="mt-3">{{ 'This event has multiple dates'|t }}</h3>
10694
<a href="#pretix_signup_list" class="btn btn-sm bg-primary text-white rounded py-1 px-3 mb-3">{{ 'View the list'|t }}</a>
10795
{% endif %}
96+
97+
{% else %}
98+
99+
{# Non-pretix meeting #}
100+
{% if node.field_last_meeting_time[0] is defined %}
101+
<h5 class="mt-3">{{ 'Date'|t }}</h5>
102+
{{ node.field_last_meeting_time[0].date|date('U')|format_date('hoeringsportal_date_long') }}
103+
104+
<h5 class="mt-3">{{ 'Time'|t }}</h5>
105+
{{ node.field_last_meeting_time[0].date|date('U')|format_date('hoeringsportal_time') }}{% if node.field_last_meeting_time_end[0].date is defined %} - {{ node.field_last_meeting_time_end[0].date|date('U')|format_date('hoeringsportal_time') }}{% endif %}
106+
{% endif %}
107+
108+
{% if signup_deadline.value|default(false) %}
109+
<h5 class="mt-3">{{ 'Last signup date'|t }}</h5>
110+
{{ signup_deadline.value|date('U')|format_date('hoeringsportal_date_long') }}
111+
{% endif %}
112+
113+
{% endif %}

0 commit comments

Comments
 (0)