-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #844 from City-of-Helsinki/UHF-11235
UHF-11235: Events near you page
- Loading branch information
Showing
15 changed files
with
288 additions
and
12 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
conf/cmi/block.block.hdbt_subtheme_helsinkinearyoueventsheroblock.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
uuid: e100646b-2af9-4b0d-ae6e-d2b74498f2fc | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- helfi_etusivu | ||
- system | ||
theme: | ||
- hdbt_subtheme | ||
id: hdbt_subtheme_helsinkinearyoueventsheroblock | ||
theme: hdbt_subtheme | ||
region: before_content | ||
weight: 0 | ||
provider: null | ||
plugin: helsinki_near_you_events_hero_block | ||
settings: | ||
id: helsinki_near_you_events_hero_block | ||
label: 'Helsinki near you events hero block' | ||
label_display: '0' | ||
provider: helfi_etusivu | ||
visibility: | ||
request_path: | ||
id: request_path | ||
negate: false | ||
pages: "/helsinki-near-you/events\r\n/helsinki-lahellasi/tapahtumat\r\n/helsingfors-nara-dig/utbildningar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouEventsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\helfi_etusivu\Controller; | ||
|
||
use Drupal\Core\Controller\ControllerBase; | ||
use Drupal\helfi_react_search\LinkedEvents; | ||
|
||
/** | ||
* Events near you landing page controller. | ||
*/ | ||
class HelsinkiNearYouEventsController extends ControllerBase { | ||
|
||
/** | ||
* Constructs a new instance. | ||
*/ | ||
public function __construct(protected readonly LinkedEvents $linkedEvents) { | ||
} | ||
|
||
/** | ||
* Returns a renderable array. | ||
*/ | ||
public function content() : array { | ||
$events_url = $this->linkedEvents->getEventsRequest(); | ||
|
||
return [ | ||
'#attached' => [ | ||
'drupalSettings' => [ | ||
'helfi_events' => [ | ||
'baseUrl' => LinkedEvents::BASE_URL, | ||
'data' => [ | ||
'helfi-coordinates-based-event-list' => [ | ||
'events_api_url' => $events_url, | ||
'field_event_count' => 10, | ||
'field_event_location' => TRUE, | ||
'field_event_time' => TRUE, | ||
'field_free_events' => TRUE, | ||
'field_remote_events' => TRUE, | ||
'places' => $this->linkedEvents->getPlacesList($events_url), | ||
'hideHeading' => TRUE, | ||
'useFullLocationFilter' => TRUE, | ||
'useFullTopicsFilter' => TRUE, | ||
'useLocationSearch' => TRUE, | ||
], | ||
], | ||
'seeAllButtonOverride' => $this->t( | ||
'Search for more events on the Events website', | ||
[], | ||
['context' => 'Helsinki near you events search'] | ||
), | ||
'useExperimentalGhosts' => TRUE, | ||
], | ||
], | ||
], | ||
'#theme' => 'helsinki_near_you_events', | ||
'#title' => $this->t('Events near you', [], ['context' => 'Helsinki near you']), | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
public/modules/custom/helfi_etusivu/src/Plugin/Block/HelsinkiNearYouEventsHeroBlock.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\helfi_etusivu\Plugin\Block; | ||
|
||
use Drupal\Core\Block\Attribute\Block; | ||
use Drupal\Core\Block\BlockBase; | ||
use Drupal\Core\StringTranslation\TranslatableMarkup; | ||
|
||
/** | ||
* Provides a 'HelsinkiNearYouEventsHeroBlock' block. | ||
*/ | ||
#[Block( | ||
id: "helsinki_near_you_events_hero_block", | ||
admin_label: new TranslatableMarkup("Helsinki near you events hero block"), | ||
)] | ||
final class HelsinkiNearYouEventsHeroBlock extends BlockBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build() : array { | ||
$build['helsinki_near_you_hero_block'] = [ | ||
'#theme' => 'helsinki_near_you_events_hero_block', | ||
'#hero_title' => $this->t('Events near you', [], ['context' => 'Helsinki near you']), | ||
'#hero_description' => $this->t('Find events in your neighbourhood that interest you.', [], ['context' => 'Helsinki near you events search']), | ||
]; | ||
return $build; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
public/modules/custom/helfi_etusivu/templates/helsinki-near-you-events-hero-block.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% embed '@hdbt/component/hero.twig' with { | ||
design: 'with-helsinki-near-you', | ||
title: hero_title, | ||
description: hero_description, | ||
} %} | ||
{% endembed %} |
31 changes: 31 additions & 0 deletions
31
public/modules/custom/helfi_etusivu/templates/helsinki-near-you-events.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<article> | ||
<div class="components components--computed components--helsinki-near-you-events"> | ||
{% embed "@hdbt/misc/component.twig" with | ||
{ | ||
component_classes: [ | ||
'component--react-search', | ||
'component--event-list', | ||
'component--full-width', | ||
], | ||
component_title: 'Find events near you'|t({}, {'context': 'Helsinki near you events search'}), | ||
component_description: 'Browse events near you or search for events by theme, location or date.'|t({}, {'context': 'Helsinki near you events search'}), | ||
} | ||
%} | ||
{% block component_content %} | ||
{# Hook React app to this div #} | ||
{{ attach_library('hdbt/event-list') }} | ||
<div | ||
id="helfi-events-search" | ||
data-paragraph-id="helfi-coordinates-based-event-list" | ||
> | ||
</div> | ||
{# Indicate JS not enabled #} | ||
<noscript> | ||
<div class="event-list__javascript-disabled"> | ||
{{ 'You must enable JavaScript in your browser for event list to work'|t }} | ||
</div> | ||
</noscript> | ||
{% endblock %} | ||
{% endembed %} | ||
</div> | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters