From 22b70033c5b3fb1c762d9e44cf73b2888e6fc8ec Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 18:06:31 +0000 Subject: [PATCH 01/30] Stub out new tests --- .../TwigExtension/FormatTalksTest.php | 177 ------------------ .../TwigExtension/TalksExtensionTest.php | 48 +++++ 2 files changed, 48 insertions(+), 177 deletions(-) delete mode 100644 tests/TalksBundle/TwigExtension/FormatTalksTest.php create mode 100644 tests/TalksBundle/TwigExtension/TalksExtensionTest.php diff --git a/tests/TalksBundle/TwigExtension/FormatTalksTest.php b/tests/TalksBundle/TwigExtension/FormatTalksTest.php deleted file mode 100644 index f4c1baae..00000000 --- a/tests/TalksBundle/TwigExtension/FormatTalksTest.php +++ /dev/null @@ -1,177 +0,0 @@ -extension = new TalksExtension(); - } - - /** @test */ - public function format_events() - { - $event_data = [ - 'event-a' => [ - 'name' => 'Event A', - 'location' => 'Somewhere', - 'website' => 'http://event-a.com', - ], - 'event-b' => [ - 'name' => 'Event B', - 'location' => 'Somewhere else', - 'website' => 'http://event-b.com', - ], - ]; - - $talks = [ - [ - 'title' => 'Talk A', - 'events' => [ - ['event' => 'event-a', 'date' => strtotime('2018-01-01'), 'time' => '09:00'], - ['event' => 'event-b', 'date' => strtotime('2018-01-30'), 'time' => '12:00'], - ], - ], - [ - 'title' => 'Talk B', - 'events' => [ - ['event' => 'event-b', 'date' => strtotime('2018-01-31'), 'time' => '17:00'], - ], - ], - ]; - - $results = $this->extension->format($talks, $event_data); - - $this->assertCount(3, $results); - - tap($results->first(), function ($result) { - $this->assertArrayHasKey('event', $result); - $this->assertArrayHasKey('talk', $result); - - $this->assertEquals([ - 'date' => '1514764800', - 'event' => 'event-a', - 'location' => 'Somewhere', - 'name' => 'Event A', - 'time' => '09:00', - 'website' => 'http://event-a.com', - ], $result['event']); - - $this->assertEquals('Talk A', $result['talk']['title']); - }); - - tap($results->get(1), function ($result) { - $this->assertArrayHasKey('event', $result); - $this->assertArrayHasKey('talk', $result); - - $this->assertEquals([ - 'date' => 1517270400, - 'event' => 'event-b', - 'location' => 'Somewhere else', - 'name' => 'Event B', - 'time' => '12:00', - 'website' => 'http://event-b.com', - ], $result['event']); - - $this->assertEquals('Talk A', $result['talk']['title']); - }); - - tap($results[2], function ($result) { - $this->assertEquals('Talk B', $result['talk']['title']); - }); - } - - /** @test */ - public function get_all_events() - { - $eventA = ['date' => (new DateTime('+1 week'))->getTimestamp()]; - $eventB = ['date' => (new DateTime('-2 weeks'))->getTimestamp()]; - $eventC = ['date' => (new DateTime('today'))->getTimestamp()]; - - $talks = [ - ['events' => [$eventA, $eventB]], - ['events' => [$eventC]], - ]; - - $results = $this->extension->getAll($talks); - - $this->assertCount(3, $results); - - // Earliest events should be returned first. - $this->assertEquals( - [$eventB['date'], $eventC['date'], $eventA['date']], - $this->extractDates($results) - ); - } - - /** @test */ - public function get_upcoming_events() - { - $eventA = ['date' => (new DateTime('+1 week'))->getTimestamp()]; - $eventB = ['date' => (new DateTime('-2 weeks'))->getTimestamp()]; - $eventC = ['date' => (new DateTime('today'))->getTimestamp()]; - $eventD = ['date' => (new DateTime('+1 day'))->getTimestamp()]; - $eventE = ['date' => (new DateTime('+2 weeks'))->getTimestamp()]; - - $talks = [ - ['events' => [$eventA, $eventC]], - ['events' => [$eventB, $eventE]], - ]; - - $results = $this->extension->getUpcoming($talks); - - $this->assertCount(3, $results); - - // Earliest events should be returned first. - $this->assertEquals( - [$eventC['date'], $eventA['date'], $eventE['date']], - $this->extractDates($results) - ); - } - - /** @test */ - public function get_past_events() - { - $eventA = ['date' => (new DateTime('+1 week'))->getTimestamp()]; - $eventB = ['date' => (new DateTime('-2 weeks'))->getTimestamp()]; - $eventC = ['date' => (new DateTime('today'))->getTimestamp()]; - $eventD = ['date' => (new DateTime('+1 day'))->getTimestamp()]; - $eventE = ['date' => (new DateTime('-2 days'))->getTimestamp()]; - $eventF = ['date' => (new DateTime('-2 months'))->getTimestamp()]; - - $talks = [ - ['events' => [$eventD]], - ['events' => [$eventA, $eventB, $eventC]], - ['events' => [$eventF]], - ]; - - $results = $this->extension->getPast($talks); - - $this->assertCount(2, $results); - - // Latest events should be returned first. - $this->assertEquals( - [$eventB['date'], $eventF['date']], - $this->extractDates($results) - ); - } - - private function extractDates(Collection $results) - { - return $results->pluck('event.date')->all(); - } -} diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php new file mode 100644 index 00000000..e86bd23d --- /dev/null +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -0,0 +1,48 @@ +extension = new TalksExtension(); + } + + /** @test */ + public function talks_given_multiple_times_are_only_returned_once() + { + $this->markTestIncomplete(); + } + + /** @test */ + public function talks_are_ordered_by_the_most_recent_event_date() + { + $this->markTestIncomplete(); + } + + /** @test */ + public function only_past_events_can_be_retrieved() + { + $this->markTestIncomplete(); + } + + /** @test */ + public function only_future_events_can_be_retrieved() + { + $this->markTestIncomplete(); + } +} From 18e6d2e32f5df18e911b55e0da67d820520fd982 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 20:27:50 +0000 Subject: [PATCH 02/30] Ensure that talks given multiple times are only returned once --- .../TwigExtension/TalksExtension.php | 22 ++++++++++--------- .../TwigExtension/TalksExtensionTest.php | 17 +++++++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 1d1e290f..7f180649 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -9,6 +9,8 @@ use Twig_SimpleFunction; class TalksExtension extends Twig_Extension { + const DATE_FORMAT = 'Y-m-d'; + /** * @var string The current date. */ @@ -34,17 +36,17 @@ class TalksExtension extends Twig_Extension ]; } - /** - * Get all upcoming and previous talks. - * - * @param ProxySourceCollection|array $talks All talk nodes. - * @param array $eventData Shared event data. - * - * @return Collection A sorted collection of talks. - */ - public function getAll($talks, array $eventData = []) + /** + * Get all upcoming and previous talks. + * + * @param ProxySourceCollection|array $talks All talk nodes. + * @param array $eventData Shared event data. + * + * @return Collection A sorted collection of talks. + */ + public function getAll($talks, array $eventData = []): Collection { - return $this->format($talks, $eventData)->sortBy('event.date'); + return collect($talks); } /** diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index e86bd23d..4318c936 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -25,7 +25,22 @@ class TalksExtensionTest extends TestCase /** @test */ public function talks_given_multiple_times_are_only_returned_once() { - $this->markTestIncomplete(); + $talkA = [ + 'title' => 'Talk A', + 'events' => [ + ['event' => 'event_a', 'date' => (new DateTime('-1 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_b', 'date' => (new DateTime('+1 days'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $talkB = [ + 'title' => 'Talk B', + 'events' => [ + ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $this->assertCount(2, $this->extension->getAll([$talkA, $talkB])); } /** @test */ From 303162e65dfdd8f4f2000b6f0fde821a6ca37687 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 20:38:58 +0000 Subject: [PATCH 03/30] Ensure that talks are sorted by the nearest event date --- .../TwigExtension/TalksExtension.php | 4 ++- .../TwigExtension/TalksExtensionTest.php | 27 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 7f180649..aca95b9b 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -46,7 +46,9 @@ class TalksExtension extends Twig_Extension */ public function getAll($talks, array $eventData = []): Collection { - return collect($talks); + return collect($talks)->sortBy(function ($talk) { + return collect($talk['events'])->pluck('date')->sort()->last(); + }); } /** diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index 4318c936..46b49983 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -46,7 +46,32 @@ class TalksExtensionTest extends TestCase /** @test */ public function talks_are_ordered_by_the_most_recent_event_date() { - $this->markTestIncomplete(); + $talkA = [ + 'title' => 'Talk A', + 'events' => [ + ['event' => 'event_a', 'date' => (new DateTime('-5 days'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $talkB = [ + 'title' => 'Talk B', + 'events' => [ + ['event' => 'event_a', 'date' => (new DateTime('-20 days'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $talkC = [ + 'title' => 'Talk C', + 'events' => [ + ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_b', 'date' => (new DateTime('-10 days'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $unorderedTalks = [$talkC, $talkA, $talkB]; + $orderedTalks = $this->extension->getAll($unorderedTalks); + + $this->assertEquals([$talkC, $talkA, $talkB], $orderedTalks->toArray()); } /** @test */ From a48d7489428cf6ce3ced4f697c1b24a9e9dad4aa Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 21:27:03 +0000 Subject: [PATCH 04/30] Ensure that only past events can be retrieved --- .../TwigExtension/TalksExtension.php | 8 +++---- .../TwigExtension/TalksExtensionTest.php | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index aca95b9b..ea381eb9 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -78,11 +78,9 @@ class TalksExtension extends Twig_Extension */ public function getPast($talks, array $eventData = []) { - return $this->format($talks, $eventData) - ->filter(function ($talk) { - return $talk['event']['date'] < $this->today; - }) - ->sortByDesc('event.date'); + return $this->getAll($talks)->filter(function ($talk) { + return collect($talk['events'])->pluck('date')->sort()->last() < $this->today; + }); } /** diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index 46b49983..557160ec 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -75,9 +75,26 @@ class TalksExtensionTest extends TestCase } /** @test */ - public function only_past_events_can_be_retrieved() + public function only_past_talks_can_be_retrieved() { - $this->markTestIncomplete(); + $pastTalk = [ + 'title' => 'Past talk', + 'events' => [ + 'date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT), + ] + ]; + + $futureTalk = [ + 'title' => 'Future talk', + 'events' => [ + ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $result = $this->extension->getPast([$pastTalk, $futureTalk]); + + $this->assertCount(1, $result); + $this->assertSame($pastTalk, $result->first()); } /** @test */ From 306082d17b1a8110c6f61720ad8d0c17c42b5d7f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 21:30:29 +0000 Subject: [PATCH 05/30] Stub another test --- tests/TalksBundle/TwigExtension/TalksExtensionTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index 557160ec..eb07025e 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -102,4 +102,10 @@ class TalksExtensionTest extends TestCase { $this->markTestIncomplete(); } + + /** @test */ + public function if_a_talk_is_both_upcoming_and_past_then_it_is_only_shown_as_upcoming() + { + $this->markTestIncomplete(); + } } From fddaa56ed20ca27a33604221e8d8a93925c0ddbb Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 21:44:21 +0000 Subject: [PATCH 06/30] Ensure that only future events can be retrieved --- .../TwigExtension/TalksExtension.php | 10 +++---- .../TwigExtension/TalksExtensionTest.php | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index ea381eb9..0bdee6dd 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -61,11 +61,9 @@ class TalksExtension extends Twig_Extension */ public function getUpcoming($talks, array $eventData = []) { - return $this->format($talks, $eventData) - ->filter(function ($talk) { - return $talk['event']['date'] >= $this->today; - }) - ->sortBy('event.date'); + return $this->getAll($talks)->filter(function ($talk) { + return collect($talk['events'])->pluck('date')->sort()->last() >= $this->today; + })->values(); } /** @@ -80,7 +78,7 @@ class TalksExtension extends Twig_Extension { return $this->getAll($talks)->filter(function ($talk) { return collect($talk['events'])->pluck('date')->sort()->last() < $this->today; - }); + })->values(); } /** diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index eb07025e..a1aece41 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -98,9 +98,33 @@ class TalksExtensionTest extends TestCase } /** @test */ - public function only_future_events_can_be_retrieved() + public function only_current_and_future_talks_can_be_retrieved() { - $this->markTestIncomplete(); + $pastTalk = [ + 'title' => 'Past talk', + 'events' => [ + 'date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT), + ] + ]; + + $todayTalk = [ + 'title' => 'A talk that it happening today', + 'events' => [ + ['date' => (new DateTime('now'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $futureTalk = [ + 'title' => 'Future talk', + 'events' => [ + ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $result = $this->extension->getUpcoming([$pastTalk, $todayTalk, $futureTalk]); + + $this->assertCount(2, $result); + $this->assertSame([$todayTalk, $futureTalk], $result->toArray()); } /** @test */ From 2334edf69280bc33157f4cc33d21e3982ffa9631 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 21:55:37 +0000 Subject: [PATCH 07/30] Refactor, ensure each event is an array --- src/TalksBundle/TwigExtension/TalksExtension.php | 16 +++++++++++----- .../TwigExtension/TalksExtensionTest.php | 10 +++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 0bdee6dd..8d82eee5 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -47,7 +47,7 @@ class TalksExtension extends Twig_Extension public function getAll($talks, array $eventData = []): Collection { return collect($talks)->sortBy(function ($talk) { - return collect($talk['events'])->pluck('date')->sort()->last(); + return $this->getLastDate($talk); }); } @@ -59,10 +59,10 @@ class TalksExtension extends Twig_Extension * * @return Collection A sorted collection of talks. */ - public function getUpcoming($talks, array $eventData = []) + public function getUpcoming($talks, array $eventData = []): Collection { return $this->getAll($talks)->filter(function ($talk) { - return collect($talk['events'])->pluck('date')->sort()->last() >= $this->today; + return $this->getLastDate($talk) >= $this->today; })->values(); } @@ -74,10 +74,10 @@ class TalksExtension extends Twig_Extension * * @return Collection A sorted collection of talks. */ - public function getPast($talks, array $eventData = []) + public function getPast($talks, array $eventData = []): Collection { return $this->getAll($talks)->filter(function ($talk) { - return collect($talk['events'])->pluck('date')->sort()->last() < $this->today; + return $this->getLastDate($talk) < $this->today; })->values(); } @@ -99,6 +99,7 @@ class TalksExtension extends Twig_Extension // event data (e.g. event name and website). return collect($talk['events']) ->map(function ($event) use ($talk, $eventData) { + $event = collect($event); $event = $event->merge($eventData->get($event->get('event')))->all(); @@ -114,4 +115,9 @@ class TalksExtension extends Twig_Extension { return 'talks'; } + + private function getLastDate($talk): string + { + return (string) collect($talk['events'])->pluck('date')->sort()->last(); + } } diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index a1aece41..36a29708 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -80,14 +80,14 @@ class TalksExtensionTest extends TestCase $pastTalk = [ 'title' => 'Past talk', 'events' => [ - 'date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT), + ['date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT)], ] ]; $futureTalk = [ 'title' => 'Future talk', 'events' => [ - ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], ], ]; @@ -103,21 +103,21 @@ class TalksExtensionTest extends TestCase $pastTalk = [ 'title' => 'Past talk', 'events' => [ - 'date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT), + ['date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT)], ] ]; $todayTalk = [ 'title' => 'A talk that it happening today', 'events' => [ - ['date' => (new DateTime('now'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('now'))->format(TalksExtension::DATE_FORMAT)], ], ]; $futureTalk = [ 'title' => 'Future talk', 'events' => [ - ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], ], ]; From dac38aec7dbbb71c82edfc55a8f2963d11065252 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 22:04:53 +0000 Subject: [PATCH 08/30] Ensure that upcoming events are not returned as past --- .../TalksBundle/TwigExtension/TalksExtensionTest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index 36a29708..d6d8c32a 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -130,6 +130,15 @@ class TalksExtensionTest extends TestCase /** @test */ public function if_a_talk_is_both_upcoming_and_past_then_it_is_only_shown_as_upcoming() { - $this->markTestIncomplete(); + $talk = [ + 'title' => 'An upcoming talk that has been given before', + 'events' => [ + ['date' => (new DateTime('-1 week'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('+1 week'))->format(TalksExtension::DATE_FORMAT)], + ], + ]; + + $this->assertCount(1, $this->extension->getUpcoming([$talk])); + $this->assertEmpty($this->extension->getPast([$talk])); } } From 99fb8cfc4eb7d52832d810ab53f417b264bb1849 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 23:09:39 +0000 Subject: [PATCH 09/30] Remove format method --- .../TwigExtension/TalksExtension.php | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 8d82eee5..476d8a56 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -81,33 +81,6 @@ class TalksExtension extends Twig_Extension })->values(); } - /** - * Format the talk data into the required format. - * - * @param ProxySourceCollection|array $talks All talk nodes. - * @param array $eventData Shared event data. - * - * @return Collection The combined event and talk data. - */ - public function format($talks, array $eventData) - { - $eventData = collect($eventData); - - return collect($talks)->flatMap(function ($talk) use ($eventData) { - // Build an associative array with the talk, as well as the - // specified event data (e.g. date and time) as well as the shared - // event data (e.g. event name and website). - return collect($talk['events']) - ->map(function ($event) use ($talk, $eventData) { - - $event = collect($event); - $event = $event->merge($eventData->get($event->get('event')))->all(); - - return compact('event', 'talk'); - }); - }); - } - /** * {@inheritdoc} */ From 8c28c4bb1662f85b44d8d192550fe0db1ef088ea Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 23:11:08 +0000 Subject: [PATCH 10/30] No more need for eventData --- src/TalksBundle/TwigExtension/TalksExtension.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 476d8a56..885b9dcf 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -40,11 +40,10 @@ class TalksExtension extends Twig_Extension * Get all upcoming and previous talks. * * @param ProxySourceCollection|array $talks All talk nodes. - * @param array $eventData Shared event data. * * @return Collection A sorted collection of talks. */ - public function getAll($talks, array $eventData = []): Collection + public function getAll($talks): Collection { return collect($talks)->sortBy(function ($talk) { return $this->getLastDate($talk); @@ -55,11 +54,10 @@ class TalksExtension extends Twig_Extension * Get all upcoming talks. * * @param ProxySourceCollection|array $talks All talk nodes. - * @param array $eventData Shared event data. * * @return Collection A sorted collection of talks. */ - public function getUpcoming($talks, array $eventData = []): Collection + public function getUpcoming($talks): Collection { return $this->getAll($talks)->filter(function ($talk) { return $this->getLastDate($talk) >= $this->today; @@ -70,11 +68,10 @@ class TalksExtension extends Twig_Extension * Get all past talks. * * @param ProxySourceCollection|array $talks All talk nodes. - * @param array $eventData Shared event data. * * @return Collection A sorted collection of talks. */ - public function getPast($talks, array $eventData = []): Collection + public function getPast($talks): Collection { return $this->getAll($talks)->filter(function ($talk) { return $this->getLastDate($talk) < $this->today; From 1ae848ae5153af2b30fa28773ce916936673520c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 18 Jan 2019 23:18:08 +0000 Subject: [PATCH 11/30] wip --- source/talks.html.twig | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index a134d6c4..031a7c12 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -28,29 +28,31 @@ talks: date: 2018-09-05 --- {% block content %} -
-

I regularly speak at conferences and user groups about a range of subjects including PHP, Drupal, automated testing, Git and systems administration.

-
+
+
+

Upcoming Talks

-
-

Upcoming Talks

+
+ {% for talk in getUpcomingTalks(page.talks|merge(data.talks)) %} +
+

{{ talk.title }}

+
+ {% else %} +

sdf

+ {% endfor %} +
+
- {% set upcoming_talks = getUpcomingTalks(data.talks|merge(page.talks), site.events) %} - {% if not upcoming_talks.empty %} - {% include "talks/table" with { - talks: upcoming_talks, - upcoming: true, - } %} - {% else %} -

Nothing scheduled at the moment.

- {% endif %} -
+
+

Previous Talks

-
-

Previous Talks

- - {% include "talks/table" with { - talks: getPastTalks(data.talks|merge(page.talks), site.events) - } %} +
+ {% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %} +
+

{{ talk.title }}

+
+ {% endfor %} +
+
{% endblock %} From 6ef729d1d4fb2236bbb231f4843e13d853741630 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 19 Jan 2019 00:07:58 +0000 Subject: [PATCH 12/30] Link talks to talk pages --- source/talks.html.twig | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index 031a7c12..4dae6617 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -35,7 +35,13 @@ talks:
{% for talk in getUpcomingTalks(page.talks|merge(data.talks)) %}
-

{{ talk.title }}

+

+ {% if talk.url %} + {{ talk.title }} + {% else %} + {{ talk.title }} + {% endif %} +

{% else %}

sdf

@@ -49,7 +55,13 @@ talks:
{% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %}
-

{{ talk.title }}

+

+ {% if talk.url %} + {{ talk.title }} + {% else %} + {{ talk.title }} + {% endif %} +

{% endfor %}
From 0d5efc492a174a6308a6c1ec46748b12a763a546 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 19 Jan 2019 00:08:06 +0000 Subject: [PATCH 13/30] Delete location --- data/events.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/data/events.yml b/data/events.yml index 55fdc2ed..f63263d9 100644 --- a/data/events.yml +++ b/data/events.yml @@ -59,7 +59,6 @@ events: nomad_php: name: Nomad PHP - location: Online url: https://nomadphp.com nwdug: From d7958cc7621782650afeae97cfd5423223d8cff2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 19 Jan 2019 00:08:20 +0000 Subject: [PATCH 14/30] Change presented at list --- source/_partials/talk/events.html.twig | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/_partials/talk/events.html.twig b/source/_partials/talk/events.html.twig index 741b804b..3a1b611a 100644 --- a/source/_partials/talk/events.html.twig +++ b/source/_partials/talk/events.html.twig @@ -1,11 +1,21 @@ -{% set talks = getAllTalks([page], site.events) %} -{% if talks is not empty %} +{% if page.events %}
-

Events

+

Presented at

- {% include "talks/table" with { - talks: talks|reverse, - talk_page: true - } %} +
    + {% for event in page.events %} +
  • + {% set eventData = site.events[event.event] %} + {% if eventData.url %} + {{ eventData.name }} + {% else %} + {{ eventData.name }} + {% endif %} + {% if eventData.location %} + in {{ eventData.location }} + {% endif %} +
  • + {% endfor %} +
{% endif %} From 0a9a12f0dafea13bd7233a9e3013c404bfec8b3e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 28 Jan 2019 22:04:33 +0000 Subject: [PATCH 15/30] Add excerpts --- source/_talks/deploying-php-ansible-ansistrano.md | 1 + source/_talks/drupal-vm-generator.md | 1 + source/_talks/drush-make-drupalbristol.md | 1 + source/_talks/git-flow.md | 1 + source/_talks/it-all-started-with-a-patch.md | 1 + source/_talks/so-what-is-this-drupal-thing.md | 1 + source/_talks/taking-flight-with-tailwind-css.md | 1 + source/_talks/using-laravel-collections-outside-laravel.md | 1 + source/talks.html.twig | 5 +++++ 9 files changed, 13 insertions(+) diff --git a/source/_talks/deploying-php-ansible-ansistrano.md b/source/_talks/deploying-php-ansible-ansistrano.md index f87fb104..52452c9f 100644 --- a/source/_talks/deploying-php-ansible-ansistrano.md +++ b/source/_talks/deploying-php-ansible-ansistrano.md @@ -1,5 +1,6 @@ --- title: Deploying PHP applications with Ansible, Ansible Vault and Ansistrano +excerpt: How to use Ansible and Ansistrano to perform robust, secure deployments of your PHP applications. speakerdeck: id: c11fe635ed8f4741b35bf3ebe53e8323 ratio: "1.77777777777778" diff --git a/source/_talks/drupal-vm-generator.md b/source/_talks/drupal-vm-generator.md index 493bbf85..b68fd659 100644 --- a/source/_talks/drupal-vm-generator.md +++ b/source/_talks/drupal-vm-generator.md @@ -1,5 +1,6 @@ --- title: Drupal VM Generator +excerpt: Announcing the Drupal VM Generator CLI tool. type: Lightning talk code: https://github.com/opdavies/drupal-vm-generator tags: [drupal-vm, drupal-vm-generator, meetup, symfony] diff --git a/source/_talks/drush-make-drupalbristol.md b/source/_talks/drush-make-drupalbristol.md index 63e6a8b3..7be2ad94 100644 --- a/source/_talks/drush-make-drupalbristol.md +++ b/source/_talks/drush-make-drupalbristol.md @@ -1,5 +1,6 @@ --- title: drush make drupalbristol +excerpt: How to Drush Make to build your Drupal websites. speakerdeck: id: 42605700f102013198de5a5f6f23ab67 ratio: '1.29456384323641' diff --git a/source/_talks/git-flow.md b/source/_talks/git-flow.md index 775480a0..b3a70dc2 100644 --- a/source/_talks/git-flow.md +++ b/source/_talks/git-flow.md @@ -1,5 +1,6 @@ --- title: Never Commit to Master - An Introduction to Git Flow +excerpt: An introduction to and demonstation of the Git Flow braching model. speakerdeck: id: 201559e0f103013198dd5a5f6f23ab67 ratio: '1.29456384323641' diff --git a/source/_talks/it-all-started-with-a-patch.md b/source/_talks/it-all-started-with-a-patch.md index 6f095a84..8db72fd2 100644 --- a/source/_talks/it-all-started-with-a-patch.md +++ b/source/_talks/it-all-started-with-a-patch.md @@ -1,5 +1,6 @@ --- title: It All Started With A Patch +excerpt: A lightning talk on how and why to get involved with open source. type: Lightning talk tags: [meetup, phpsw, open-source] speakerdeck: diff --git a/source/_talks/so-what-is-this-drupal-thing.md b/source/_talks/so-what-is-this-drupal-thing.md index 27089d3e..5a5987cc 100644 --- a/source/_talks/so-what-is-this-drupal-thing.md +++ b/source/_talks/so-what-is-this-drupal-thing.md @@ -1,5 +1,6 @@ --- title: So, what is this Drupal thing? +excerpt: My first talk, where I talk about Drupal, what it is and what it can do. vimeo: id: 49827006 tags: [meetup, drupal, unified-diff] diff --git a/source/_talks/taking-flight-with-tailwind-css.md b/source/_talks/taking-flight-with-tailwind-css.md index 1419e51e..4b1e4634 100644 --- a/source/_talks/taking-flight-with-tailwind-css.md +++ b/source/_talks/taking-flight-with-tailwind-css.md @@ -1,5 +1,6 @@ --- title: Taking Flight with Tailwind CSS +excerpt: An introduction to the utility-first approach to writing CSS with a focus on the Tailwind CSS framework. type: Lightning talk speakerdeck: id: 10ca51f23560443d83b898a92929b4b3 diff --git a/source/_talks/using-laravel-collections-outside-laravel.md b/source/_talks/using-laravel-collections-outside-laravel.md index 516137f5..bec9b2b1 100644 --- a/source/_talks/using-laravel-collections-outside-laravel.md +++ b/source/_talks/using-laravel-collections-outside-laravel.md @@ -1,5 +1,6 @@ --- title: Using Laravel Collections... Outside Laravel +excerpt: How to include and use Laravel’s Illuminate Collections in your non-Laravel PHP projects. speakerdeck: id: 76f1718a75a74940b0b028aac8b9f78b ratio: '1.77777777777778' diff --git a/source/talks.html.twig b/source/talks.html.twig index 4dae6617..a32a2573 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -6,21 +6,26 @@ meta: use: [talks] talks: - title: 'Drupal and the LDAP module' + excerpt: A review and demonstration of some of the recent single sign-on work that I did using Drupal’s LDAP module. events: - event: swdug date: 2013-07-10 + - title: 'About the Drupal Association' + excerpt: An impromptu talk about what the Drupal Association is, and what work I’ve been doing since I joined the Association staff. events: - event: swdug date: 2014-08-19 - title: 'Automated testing with Drupal 8 and PHPUnit' + excerpt: A workshop that I gave to teach others about automated testing in Drupal 8. type: Workshop events: - event: drupal_bristol date: 2018-06-27 - title: 'Episode #175 - Automated Testing' + excerpt: I joined the Talking Drupal team to discuss automated testing. type: Podcast url: http://talkingdrupal.com/175 events: From 17a1738d753122ed79e89556dc5507ad445c4c63 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 28 Jan 2019 22:05:12 +0000 Subject: [PATCH 16/30] Update talks template --- source/talks.html.twig | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index a32a2573..32035aa5 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -35,18 +35,22 @@ talks: {% block content %}
-

Upcoming Talks

+

Upcoming Talks

-
+
{% for talk in getUpcomingTalks(page.talks|merge(data.talks)) %} -
-

+
+

{% if talk.url %} - {{ talk.title }} + {{ talk.title }} {% else %} {{ talk.title }} {% endif %}

+ +
+

{{ talk.excerpt }}

+
{% else %}

sdf

@@ -55,18 +59,22 @@ talks:

-

Previous Talks

+

Previous Talks

-
+
{% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %} -
-

+
+

{% if talk.url %} - {{ talk.title }} + {{ talk.title }} {% else %} {{ talk.title }} {% endif %}

+ +
+

{{ talk.excerpt }}

+
{% endfor %}

From 561b356fbcb04aaeae3934a21c27f7a2deabebe0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 28 Jan 2019 23:06:30 +0000 Subject: [PATCH 17/30] Spaces --- source/talks.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/talks.html.twig b/source/talks.html.twig index 32035aa5..bf496bdf 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -8,8 +8,13 @@ talks: - title: 'Drupal and the LDAP module' excerpt: A review and demonstration of some of the recent single sign-on work that I did using Drupal’s LDAP module. events: +<<<<<<< HEAD - event: swdug date: 2013-07-10 +======= + - event: swdug + date: '2013-07-10' +>>>>>>> Spaces - title: 'About the Drupal Association' excerpt: An impromptu talk about what the Drupal Association is, and what work I’ve been doing since I joined the Association staff. From 12af2a2ac54a8193002a3f3d6a9e73bbb21718b2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 28 Jan 2019 23:08:53 +0000 Subject: [PATCH 18/30] Update excerpts --- source/_talks/drupal-8-php-libraries-drupalorg-api.md | 1 + source/_talks/tdd-test-driven-drupal.md | 1 + source/_talks/things-you-should-know-about-php.md | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/_talks/drupal-8-php-libraries-drupalorg-api.md b/source/_talks/drupal-8-php-libraries-drupalorg-api.md index 66868c76..5e0d7609 100644 --- a/source/_talks/drupal-8-php-libraries-drupalorg-api.md +++ b/source/_talks/drupal-8-php-libraries-drupalorg-api.md @@ -1,5 +1,6 @@ --- title: Having Fun with Drupal 8, PHP libraries and the Drupal.org API +excerpt: A crash course in developing PHP packages and Drupal 8 modules, based on the Drupal.org API. speakerdeck: id: 6e42ae9620bb4e91b3955f8c30d66934 ratio: '1.77777777777778' diff --git a/source/_talks/tdd-test-driven-drupal.md b/source/_talks/tdd-test-driven-drupal.md index ddf4d67b..3b3e7e84 100644 --- a/source/_talks/tdd-test-driven-drupal.md +++ b/source/_talks/tdd-test-driven-drupal.md @@ -1,5 +1,6 @@ --- title: TDD - Test Driven Drupal +excerpt: How to write automated tests for Drupal, and how to create a new Drupal module using test driven development. speakerdeck: id: 088cb18033064f5cb18d1079795294a1 ratio: '1.77777777777778' diff --git a/source/_talks/things-you-should-know-about-php.md b/source/_talks/things-you-should-know-about-php.md index e7317342..6b77a464 100644 --- a/source/_talks/things-you-should-know-about-php.md +++ b/source/_talks/things-you-should-know-about-php.md @@ -1,5 +1,6 @@ --- title: Things you should know about PHP +excerpt: An introduction to PHP, presented to the Swansea Software Development Community (SSDC) meetup. speakerdeck: id: fe360f1030f34bdb9eb14cdab907bb3c ratio: '1.37081659973226' @@ -14,4 +15,4 @@ events: - event: ssdc date: 2019-01-28 --- -An introduction to PHP, presented to the Swansea Software Development Community (SSDC). +An introduction to PHP, presented to the Swansea Software Development Community (SSDC) meetup. From 8c3b9db2f3dd76bc18ac4e2cc1ccd9e9ccfa7e8a Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 06:55:08 +0000 Subject: [PATCH 19/30] Fix conflict --- source/talks.html.twig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index bf496bdf..32035aa5 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -8,13 +8,8 @@ talks: - title: 'Drupal and the LDAP module' excerpt: A review and demonstration of some of the recent single sign-on work that I did using Drupal’s LDAP module. events: -<<<<<<< HEAD - event: swdug date: 2013-07-10 -======= - - event: swdug - date: '2013-07-10' ->>>>>>> Spaces - title: 'About the Drupal Association' excerpt: An impromptu talk about what the Drupal Association is, and what work I’ve been doing since I joined the Association staff. From 0c8c2f8eb7888bc43863bdbebb207ebfe9131993 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 06:55:18 +0000 Subject: [PATCH 20/30] Fix tests, use timestamp --- .../TwigExtension/TalksExtension.php | 2 -- .../TwigExtension/TalksExtensionTest.php | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/TalksBundle/TwigExtension/TalksExtension.php b/src/TalksBundle/TwigExtension/TalksExtension.php index 885b9dcf..cd848d0a 100644 --- a/src/TalksBundle/TwigExtension/TalksExtension.php +++ b/src/TalksBundle/TwigExtension/TalksExtension.php @@ -9,8 +9,6 @@ use Twig_SimpleFunction; class TalksExtension extends Twig_Extension { - const DATE_FORMAT = 'Y-m-d'; - /** * @var string The current date. */ diff --git a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php index d6d8c32a..90d1c276 100644 --- a/tests/TalksBundle/TwigExtension/TalksExtensionTest.php +++ b/tests/TalksBundle/TwigExtension/TalksExtensionTest.php @@ -28,15 +28,15 @@ class TalksExtensionTest extends TestCase $talkA = [ 'title' => 'Talk A', 'events' => [ - ['event' => 'event_a', 'date' => (new DateTime('-1 days'))->format(TalksExtension::DATE_FORMAT)], - ['event' => 'event_b', 'date' => (new DateTime('+1 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_a', 'date' => (new DateTime('-1 days'))->getTimestamp()], + ['event' => 'event_b', 'date' => (new DateTime('+1 days'))->getTimestamp()], ], ]; $talkB = [ 'title' => 'Talk B', 'events' => [ - ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->getTimestamp()], ], ]; @@ -49,22 +49,22 @@ class TalksExtensionTest extends TestCase $talkA = [ 'title' => 'Talk A', 'events' => [ - ['event' => 'event_a', 'date' => (new DateTime('-5 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_a', 'date' => (new DateTime('-5 days'))->getTimestamp()], ], ]; $talkB = [ 'title' => 'Talk B', 'events' => [ - ['event' => 'event_a', 'date' => (new DateTime('-20 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_a', 'date' => (new DateTime('-20 days'))->getTimestamp()], ], ]; $talkC = [ 'title' => 'Talk C', 'events' => [ - ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->format(TalksExtension::DATE_FORMAT)], - ['event' => 'event_b', 'date' => (new DateTime('-10 days'))->format(TalksExtension::DATE_FORMAT)], + ['event' => 'event_a', 'date' => (new DateTime('-3 days'))->getTimestamp()], + ['event' => 'event_b', 'date' => (new DateTime('-10 days'))->getTimestamp()], ], ]; @@ -80,14 +80,14 @@ class TalksExtensionTest extends TestCase $pastTalk = [ 'title' => 'Past talk', 'events' => [ - ['date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('-1 day'))->getTimestamp()], ] ]; $futureTalk = [ 'title' => 'Future talk', 'events' => [ - ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('+1 day'))->getTimestamp()], ], ]; @@ -103,21 +103,21 @@ class TalksExtensionTest extends TestCase $pastTalk = [ 'title' => 'Past talk', 'events' => [ - ['date' => (new DateTime('-1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('-1 day'))->getTimestamp()], ] ]; $todayTalk = [ 'title' => 'A talk that it happening today', 'events' => [ - ['date' => (new DateTime('now'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('now'))->getTimestamp()], ], ]; $futureTalk = [ 'title' => 'Future talk', 'events' => [ - ['date' => (new DateTime('+1 day'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('+1 day'))->getTimestamp()], ], ]; @@ -133,8 +133,8 @@ class TalksExtensionTest extends TestCase $talk = [ 'title' => 'An upcoming talk that has been given before', 'events' => [ - ['date' => (new DateTime('-1 week'))->format(TalksExtension::DATE_FORMAT)], - ['date' => (new DateTime('+1 week'))->format(TalksExtension::DATE_FORMAT)], + ['date' => (new DateTime('-1 week'))->getTimestamp()], + ['date' => (new DateTime('+1 week'))->getTimestamp()], ], ]; From b0623376ec3cbe59a97a60385bd5016347be699d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 06:59:14 +0000 Subject: [PATCH 21/30] Add link to talk --- source/talks.html.twig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index 32035aa5..070b0d27 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -63,7 +63,7 @@ talks:
{% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %} -
+

{% if talk.url %} {{ talk.title }} @@ -75,7 +75,16 @@ talks:

{{ talk.excerpt }}

-

+ + {% if talk.url %} + + {% endif %} + {% endfor %}
From 57f47644eb227382dce90f64bb2760888ed6c6e7 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 07:01:40 +0000 Subject: [PATCH 22/30] Add a talk partial --- source/_partials/talks/talk.html.twig | 22 ++++++++++++++++ source/talks.html.twig | 37 ++------------------------- 2 files changed, 24 insertions(+), 35 deletions(-) create mode 100644 source/_partials/talks/talk.html.twig diff --git a/source/_partials/talks/talk.html.twig b/source/_partials/talks/talk.html.twig new file mode 100644 index 00000000..0a622ade --- /dev/null +++ b/source/_partials/talks/talk.html.twig @@ -0,0 +1,22 @@ + diff --git a/source/talks.html.twig b/source/talks.html.twig index 070b0d27..a16f7baf 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -39,19 +39,7 @@ talks:
{% for talk in getUpcomingTalks(page.talks|merge(data.talks)) %} -
-

- {% if talk.url %} - {{ talk.title }} - {% else %} - {{ talk.title }} - {% endif %} -

- -
-

{{ talk.excerpt }}

-
-
+ {% include 'talks/talk' %} {% else %}

sdf

{% endfor %} @@ -63,28 +51,7 @@ talks:
{% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %} - + {% include 'talks/talk' %} {% endfor %}
From 34cd73955a5e791f5577ad296f2cfaea4efaba08 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 07:01:49 +0000 Subject: [PATCH 23/30] Change spacing --- source/talks.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/talks.html.twig b/source/talks.html.twig index a16f7baf..41da484f 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -37,7 +37,7 @@ talks:

Upcoming Talks

-
+
{% for talk in getUpcomingTalks(page.talks|merge(data.talks)) %} {% include 'talks/talk' %} {% else %} @@ -49,7 +49,7 @@ talks:

Previous Talks

-
+
{% for talk in getPastTalks(page.talks|merge(data.talks))|reverse %} {% include 'talks/talk' %} {% endfor %} From c3dbce53bb61d9bbaab45726d37db54fc6ca031c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 13 Feb 2019 13:45:23 +0000 Subject: [PATCH 24/30] Add hover and focus state colours --- source/_partials/talks/talk.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_partials/talks/talk.html.twig b/source/_partials/talks/talk.html.twig index 0a622ade..bb37fbe1 100644 --- a/source/_partials/talks/talk.html.twig +++ b/source/_partials/talks/talk.html.twig @@ -13,7 +13,7 @@ {% if talk.url %}