refactor: Remove the sortable_date for talks
Automatically calculate the sortable date for a talk using the event dates. This means that the `sortable_date` in the YAML front matter can be removed. Fixes #4
This commit is contained in:
parent
42e0ae1297
commit
efbd099515
|
@ -8,7 +8,7 @@ use:
|
|||
|
||||
<div class="mt-10">
|
||||
<div class="space-y-8">
|
||||
{% for talk in data.talks|sort((a,b) => a.sortable_date < b.sortable_date) %}
|
||||
{% for talk in data.talks|sort((a, b) => get_last_event_date_for_talk(a) < get_last_event_date_for_talk(b)) %}
|
||||
<article>
|
||||
<h2>
|
||||
<a class="text-blue-primary dark:text-blue-400" href="{{ talk.url }}">
|
||||
|
|
|
@ -6,7 +6,6 @@ events:
|
|||
name: South Wales Drupal user group (SWDUG)
|
||||
location: Cardiff, UK
|
||||
date: 2014-08-19
|
||||
sortable_date: 2014-08-19
|
||||
---
|
||||
|
||||
An impromptu talk about what the Drupal Association is, and what work I’ve been doing since I joined the Association staff.
|
||||
|
|
|
@ -17,5 +17,4 @@ events:
|
|||
url: https://2020.drupalcamp.nyc/training/automated-testing-and-test-driven-development-drupal-8
|
||||
date: 2020-11-14
|
||||
online: true
|
||||
sortable_date: 2020-11-14
|
||||
---
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
url: https://www.meetup.com/PHP-South-Wales/events/275625320
|
||||
date: 2021-01-28
|
||||
online: true
|
||||
sortable_date: 2021-01-28
|
||||
---
|
||||
|
||||
I've recently used [rst2pdf](https://rst2pdf.org) for building presentation slides. This short talk will show some examples of how I built and presented a slide deck using reStructuredText and rst2pdf.
|
||||
|
|
|
@ -30,7 +30,6 @@ events:
|
|||
location: Manchester, UK
|
||||
url: ~
|
||||
is_online: true
|
||||
sortable_date: 2021-09-07
|
||||
---
|
||||
|
||||
[Sculpin][0] is a static site generator written in PHP. It converts Markdown files, Twig templates and standard HTML into a static HTML site that can be easily deployed.
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://www.drupalbristol.org.uk
|
||||
date: 2018-07-25
|
||||
sortable_date: 2018-07-25
|
||||
---
|
||||
|
||||
A short notice talk on configuration management in Drupal 8, and things I’ve learned working on my current Drupal 8 project.
|
||||
|
|
|
@ -13,7 +13,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: http://umbristol.co.uk
|
||||
date: 2015-08-25
|
||||
sortable_date: 2015-08-25
|
||||
---
|
||||
|
||||
As part of their [CMS Dance-Off][1], I was selected to speak about Drupal alongside other speakers representing Umbraco, Sitecore and Episerver.
|
||||
|
|
|
@ -12,7 +12,6 @@ events:
|
|||
location: Cardiff, UK
|
||||
url: https://blueconf.co.uk
|
||||
date: 2019-06-07
|
||||
sortable_date: 2019-06-07
|
||||
---
|
||||
|
||||
Decoupled or headless Drupal has been a trend for a number of years, with modules like RESTful Web Services available for Drupal 7 to expose data, and Drupal 8 becoming more API-first with JSON:API module now included as part of core. This makes it easier for third party systems or alternative front-end applications to consume and work with the data provided by Drupal.
|
||||
|
|
|
@ -21,7 +21,6 @@ events:
|
|||
-
|
||||
name: Drupal Somerset
|
||||
date: 2017-10-26
|
||||
sortable_date: 2017-10-26
|
||||
---
|
||||
|
||||
You’ve built your website, and now you just need to deploy it. There are various ways that this could be done - from (S)FTP, to SCP and rsync, to running commands like “git pull” and “composer install” directly on the server (not recommended).
|
||||
|
|
|
@ -89,7 +89,6 @@ events:
|
|||
location: New York, USA
|
||||
url: https://ti.to/drupalnyc/lunch-learn-2021-06-15
|
||||
is_online: true
|
||||
sortable_date: 2021-06-15
|
||||
---
|
||||
|
||||
Great! You’ve built your website, and now you just need to deploy it. There are various ways that this could be done - from (S)FTP, to SCP and rsync, to running commands like `git pull` and `composer install` directly on the server which is not ideal.
|
||||
|
|
|
@ -36,7 +36,6 @@ events:
|
|||
time: '09:00 - 09:45'
|
||||
url: http://conference.phpnw.org.uk/phpnw17
|
||||
joindin: https://joind.in/talk/4e35d
|
||||
sortable_date: 2017-10-01
|
||||
---
|
||||
|
||||
You’ve built your application, and now you just need to deploy it. There are various ways that this could be done – from (S)FTP, to SCP and rsync, to running commands like “git pull” and “composer install” directly on the server (not recommended).
|
||||
|
|
|
@ -24,7 +24,6 @@ events:
|
|||
name: DrupalCamp London 2016
|
||||
location: London, UK
|
||||
date: 2016-03-05
|
||||
sortable_date: 2016-03-05
|
||||
---
|
||||
|
||||
New to object-orientated PHP, Symfony or YAML, and want to get started building modules in Drupal 8? This is the session for you!
|
||||
|
|
|
@ -25,7 +25,6 @@ events:
|
|||
url: http://drupalcamp.london
|
||||
date: 2019-03-03
|
||||
time: '12:05 - 12:50'
|
||||
sortable_date: 2019-03-03
|
||||
---
|
||||
|
||||
A overview and demo of some of the open source projects that I’ve been working on lately that are based on information from the Drupal.org API, including a PHP library for the API itself as well as some Drupal 8 modules that use it.
|
||||
|
|
|
@ -13,7 +13,6 @@ events:
|
|||
url: http://2016.phpsouthcoast.co.uk
|
||||
date: 2016-06-11
|
||||
joindin: https://joind.in/talk/41d0f
|
||||
sortable_date: 2016-06-11
|
||||
---
|
||||
|
||||
[Drupal 8][0] was (finally) released on November 19th 2015, after almost 4 years of work and code commits by over 3,200 different contributors. Whilst it’s pretty much the same as the Drupal that we know and, hopefully, love, a lot has changed behind the scenes and under the hood!
|
||||
|
|
|
@ -17,7 +17,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://phpsw.uk
|
||||
date: 2015-04-08
|
||||
sortable_date: 2015-04-08
|
||||
---
|
||||
|
||||
This was a ten minute lightning talk, designed to highlight the major changes
|
||||
|
|
|
@ -6,7 +6,6 @@ events:
|
|||
name: South Wales Drupal user group (SWDUG)
|
||||
location: Cardiff, UK
|
||||
date: 2013-07-10
|
||||
sortable_date: 2013-07-10
|
||||
---
|
||||
|
||||
A review and demonstration of some of the recent single sign-on work that I did using Drupal’s LDAP module.
|
||||
|
|
|
@ -22,7 +22,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://www.drupalbristol.org.uk
|
||||
date: 2016-04-02
|
||||
sortable_date: 2016-04-02
|
||||
---
|
||||
|
||||
An short talk about the [Drupal VM Generator][1] project.
|
||||
|
|
|
@ -11,7 +11,6 @@ events:
|
|||
name: DrupalCamp Bristol 2016
|
||||
location: Bristol, UK
|
||||
date: 2016-07-23
|
||||
sortable_date: 2016-07-23
|
||||
---
|
||||
|
||||
_TL;DR - Come and learn about Symfony Console, with examples from a real-world
|
||||
|
|
|
@ -15,7 +15,6 @@ events:
|
|||
name: DrupalCamp London 2015
|
||||
location: London, UK
|
||||
date: 2015-02-28
|
||||
sortable_date: 2015-02-28
|
||||
---
|
||||
|
||||
A retrospective of the Drupal Association’s work in 2014 and a look forward to what we’ll be working on in 2015.
|
||||
|
|
|
@ -11,7 +11,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://www.drupalbristol.org.uk
|
||||
date: 2014-08-19
|
||||
sortable_date: 2014-08-19
|
||||
---
|
||||
|
||||
An introduction to Drush Make and how to use it to build reusable custom installation profiles or entire websites.
|
||||
|
|
|
@ -30,7 +30,6 @@ events:
|
|||
date: 2017-03-04
|
||||
time: '12:05 - 12:50'
|
||||
location: London, UK
|
||||
sortable_date: 2017-03-04
|
||||
---
|
||||
|
||||
If you’ve moved a site from Drupal 6 to 7, the chances are that you’ve either used the upgrade path to update your old site in-place, or you built a new site from scratch and used the Migrate module from contrib to migrate your data from the old database.
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
name: DrupalCamp London 2014
|
||||
location: London, UK
|
||||
date: 2014-03-01
|
||||
sortable_date: 2014-03-01
|
||||
---
|
||||
|
||||
An introduction to the Git Flow branching model and the git-flow plugin, and how I’ve used them to manage a Drupal development project.
|
||||
|
|
|
@ -22,7 +22,6 @@ events:
|
|||
time: '14:40 - 15:40'
|
||||
url: https://www.phpconference.co.uk
|
||||
joindin: https://joind.in/talk/650ab
|
||||
sortable_date: 2018-02-16
|
||||
---
|
||||
|
||||
One of the main outcomes of Drupal 8 was “getting off the island” with third-party code included in core and adopting modern best practices from the wider PHP ecosystem - including [Composer][1], PHP’s dependency manager.
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://phpsw.uk
|
||||
date: 2017-02-08
|
||||
sortable_date: 2017-02-08
|
||||
---
|
||||
|
||||
A crash course of why and how to get involved with open source.
|
||||
|
|
|
@ -16,7 +16,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://phpsw.uk
|
||||
date: 2016-11-09
|
||||
sortable_date: 2016-11-09
|
||||
---
|
||||
|
||||
Building a Drupal application? You no longer need to download archives to add new modules or update core, or deal with Drupal specific tools to manage your codebase.
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
location: Bristol, UK
|
||||
url: https://www.drupalbristol.org.uk
|
||||
date: 2019-03-27
|
||||
sortable_date: 2019-03-27
|
||||
---
|
||||
|
||||
From the [DrupalCamp London website](https://drupalcamp.london/session/out-box-initiative-update):
|
||||
|
|
|
@ -10,7 +10,6 @@ events:
|
|||
location: Cardiff, UK
|
||||
url: http://unifieddiff.co.uk
|
||||
date: 2012-09-05
|
||||
sortable_date: 2012-09-05
|
||||
---
|
||||
|
||||
My very first talk, where I talk about Drupal, what it is and what it can do.
|
||||
|
|
|
@ -83,7 +83,6 @@ events:
|
|||
date: 2021-02-09
|
||||
url: https://www.meetup.com/nashvillephp/events/kzkdwryccdbmb
|
||||
online: true
|
||||
sortable_date: 2021-02-09
|
||||
meta:
|
||||
og:
|
||||
title: Taking Flight with Tailwind CSS
|
||||
|
|
|
@ -63,7 +63,6 @@ events:
|
|||
date: 2020-12-08
|
||||
url: https://events.drupal.org/europe2020/sessions/tdd-test-driven-drupal
|
||||
online: true
|
||||
sortable_date: 2020-12-08
|
||||
---
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -13,7 +13,6 @@ events:
|
|||
location: Sunderland, UK
|
||||
url: http://drupalcampnorth.org
|
||||
date: 2015-07-25
|
||||
sortable_date: 2015-07-25
|
||||
---
|
||||
|
||||
[Sculpin][1] is a static site generator written in PHP, and based on [Symfony components][2]. It uses [YAML][3] and [Twig][4], which makes it very appealing to Drupal people wanting to learn these in preparation for Drupal 8.
|
||||
|
|
|
@ -14,7 +14,6 @@ events:
|
|||
location: Swansea, UK
|
||||
url: https://www.meetup.com/Swansea-Software-Development-Meetup
|
||||
date: 2019-01-28
|
||||
sortable_date: 2019-01-28
|
||||
---
|
||||
|
||||
An introduction to PHP, presented to the Swansea Software Development Community (SSDC) meetup.
|
||||
|
|
|
@ -26,7 +26,6 @@ events:
|
|||
url: https://midwestphp.org/talks/7C0m4I87vq72cDoXvsHFRp/Upgrading_your_site_to_Drupal_9
|
||||
date: 2021-04-22
|
||||
online: true
|
||||
sortable_date: 2021-04-22
|
||||
---
|
||||
|
||||
For most Drupal Developers and users, the idea of moving a project from one major version of Drupal to another can be daunting, with modules and themes having to being changed significantly or rebuilt completely, and data being migrated from the old site to the new one.
|
||||
|
|
|
@ -22,7 +22,6 @@ events:
|
|||
location: Cardiff, UK
|
||||
url: https://www.phpsouthwales.uk
|
||||
date: 2018-08-28
|
||||
sortable_date: 2018-08-28
|
||||
---
|
||||
|
||||
Laravel's Illuminate Collections are a powerful object-orientated way of interacting with PHP arrays, but did you know that they can be used outside of Laravel, in any PHP project?
|
||||
|
|
|
@ -26,7 +26,6 @@ events:
|
|||
url: https://www.phpnw.org.uk
|
||||
date: 2021-02-02
|
||||
online: true
|
||||
sortable_date: 2021-02-02
|
||||
---
|
||||
|
||||
[Workspace](https://github.com/my127/workspace) is an open source tool developed by [Inviqa](https://inviqa.com), as a way to create custom commands for your project environments, and an alternative to a bash script or a Makefile.
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace App\TwigExtension;
|
||||
|
||||
use App\Collection\TalkCollection;
|
||||
use Illuminate\Support\Collection;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
|
@ -13,10 +14,18 @@ final class TalkExtension extends AbstractExtension
|
|||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('get_last_event_date_for_talk', [$this, 'getLastEventDate']),
|
||||
new TwigFunction('get_past_talk_count', [$this, 'getPastTalkCount']),
|
||||
];
|
||||
}
|
||||
|
||||
public function getLastEventDate($talk): ?string
|
||||
{
|
||||
$events = new Collection($talk['events']);
|
||||
|
||||
return $events->pluck('date')->sort()->last();
|
||||
}
|
||||
|
||||
public function getPastTalkCount(iterable $talks = []): int
|
||||
{
|
||||
return $this->getEventsFromTalks($talks)->count();
|
||||
|
|
|
@ -107,4 +107,24 @@ final class TalkExtensionTest extends TestCase
|
|||
|
||||
$this->assertSame(1, $this->subject->getPastTalkCount($talks));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function should_get_the_last_event_date_for_a_talk(): void
|
||||
{
|
||||
$talkA = [
|
||||
'events' => [
|
||||
['date' => '2015-10-14'],
|
||||
['date' => '2021-09-07'],
|
||||
['date' => '2021-08-19'],
|
||||
],
|
||||
];
|
||||
|
||||
$talkB = [
|
||||
'events' => [],
|
||||
];
|
||||
|
||||
$this->assertSame('2021-09-07', $this->subject->getLastEventDate($talkA));
|
||||
|
||||
$this->assertNull($this->subject->getLastEventDate($talkB));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue