From 1e3ec45cae8db8568c85ecab762dca58d908b6ff Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:11:15 +0100 Subject: [PATCH 01/16] Static schedule --- app/config/sculpin_site.yml | 53 +++++++++++++++++++++++++++++ source/_includes/schedule.html.twig | 14 ++++++++ source/index.html.twig | 4 +++ 3 files changed, 71 insertions(+) create mode 100644 source/_includes/schedule.html.twig diff --git a/app/config/sculpin_site.yml b/app/config/sculpin_site.yml index cf82487..7133d8b 100644 --- a/app/config/sculpin_site.yml +++ b/app/config/sculpin_site.yml @@ -12,6 +12,59 @@ eventbrite: papercall: url: https://www.papercall.io/drupalcamp-bristol-2019 +schedule: + slots: + - time: 8:30 am + speaker: Registration and refreshments + + - time: 9:00 am + speaker: Welcome + + - time: 9:10 am + speaker: Dan McNamara + + - time: 10:00 am + speaker: TBA + + - time: 10:30 am + speaker: Refreshments + + - time: 10:50 am + speaker: TBA + + - time: 11:40 am + speaker: TBA + + - time: 12:10 pm + speaker: Lunch + + - time: 1:10 pm + speaker: TBA + + - time: 2:00 pm + speaker: TBA + + - time: 2:15 pm + speaker: TBA + + - time: 2:30 pm + speaker: Refreshments + + - time: 2:50 pm + speaker: TBC + + - time: 3:05 pm + speaker: TBC + + - time: 3:20 pm + speaker: Matt Haworth + + - time: 4:10 pm + speaker: Closing remarks + + - time: 4:40 pm + speaker: Drinks reception + tickets: available: true url: '%eventbrite.url%' diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig new file mode 100644 index 0000000..175a0fc --- /dev/null +++ b/source/_includes/schedule.html.twig @@ -0,0 +1,14 @@ +
+
+

The Schedule

+ +
    + {% for slot in slots %} +
  • + {{ slot.speaker }} + {{ slot.time }} +
  • + {% endfor %} +
+
+
diff --git a/source/index.html.twig b/source/index.html.twig index 9d63c52..5794dba 100644 --- a/source/index.html.twig +++ b/source/index.html.twig @@ -43,4 +43,8 @@ use: [speakers] {% include 'front-speakers' with { speakers: data.speakers, } %} + + {% include 'schedule' with { + slots: site.schedule.slots, + } %} {% endblock %} From ae9406d0cd8598f2f93d6bc657310a0f2796bf76 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:14:40 +0100 Subject: [PATCH 02/16] Update and enable Schedule menu item --- source/_includes/nav.html.twig | 5 +++-- source/_includes/schedule.html.twig | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/_includes/nav.html.twig b/source/_includes/nav.html.twig index 033b779..bbeddb6 100644 --- a/source/_includes/nav.html.twig +++ b/source/_includes/nav.html.twig @@ -1,4 +1,5 @@ {% set links = [ +<<<<<<< HEAD { title: 'Tickets', href: site['tickets']['url'], @@ -19,9 +20,9 @@ }, { title: 'Schedule', - href: '/schedule', + href: '/#schedule', active: page.url == '/schedule' or page.layout in ['session', 'speaker'], - enabled: false, + enabled: true, }, { title: 'Sponsor us', diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 175a0fc..71f71b0 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -1,4 +1,4 @@ -
+

The Schedule

From ff44b489b27a1478f91bd6d27e71dd4c0ba417de Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:24:10 +0100 Subject: [PATCH 03/16] Add padding, just in case --- source/_includes/schedule.html.twig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 71f71b0..169dcfb 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -4,9 +4,11 @@
    {% for slot in slots %} -
  • - {{ slot.speaker }} - {{ slot.time }} +
  • + + {{ slot.speaker }} + {{ slot.time }} +
  • {% endfor %}
From 9bdb48e13bc5b48b755840f2180bf9f040b01c5d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:25:15 +0100 Subject: [PATCH 04/16] Reduce padding on mobile --- source/_includes/schedule.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 169dcfb..dfc7e87 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -4,7 +4,7 @@
    {% for slot in slots %} -
  • +
  • {{ slot.speaker }} {{ slot.time }} From 4462516b410a3b8e51edfe03ebe416d52f878bf6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:29:49 +0100 Subject: [PATCH 05/16] Mobile tweaks --- source/_includes/schedule.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index dfc7e87..78349b6 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -5,8 +5,8 @@
      {% for slot in slots %}
    • - - {{ slot.speaker }} + + {{ slot.speaker }} {{ slot.time }}
    • From 12c9048a3bdfb53cae97122594339027177b3fb2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 17:41:10 +0100 Subject: [PATCH 06/16] Increase title size --- source/_includes/schedule.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 78349b6..826f732 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -1,6 +1,6 @@
      -

      The Schedule

      +

      The Schedule

        {% for slot in slots %} From 809961237fba8cf81ebc0491f2627c86a5e006f5 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 20:03:01 +0100 Subject: [PATCH 07/16] Delete old schedule page --- source/schedule.html.twig | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 source/schedule.html.twig diff --git a/source/schedule.html.twig b/source/schedule.html.twig deleted file mode 100644 index 66b419a..0000000 --- a/source/schedule.html.twig +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: page -title: Schedule -use: - - sessions ---- - From 25fe073f8835c0845429a61aeb60707837d6c038 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 21 May 2019 22:14:04 +0100 Subject: [PATCH 08/16] Adjust active nav links --- source/_includes/nav.html.twig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/_includes/nav.html.twig b/source/_includes/nav.html.twig index bbeddb6..67c40c1 100644 --- a/source/_includes/nav.html.twig +++ b/source/_includes/nav.html.twig @@ -1,5 +1,4 @@ {% set links = [ -<<<<<<< HEAD { title: 'Tickets', href: site['tickets']['url'], @@ -15,13 +14,13 @@ { title: 'Speakers', href: '/#speakers', - active: page.layout in ['session', 'speaker'], + active: page.layout == 'speaker', enabled: true, }, { title: 'Schedule', href: '/#schedule', - active: page.url == '/schedule' or page.layout in ['session', 'speaker'], + active: page.url == '/schedule' or page.layout == 'session', enabled: true, }, { From 12ede023c7a6eb859cbc0df9a76493570b6dad39 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 22 May 2019 18:11:55 +0100 Subject: [PATCH 09/16] Spaces --- source/_includes/schedule.html.twig | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 826f732..1454e19 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -1,16 +1,16 @@
        -
        -

        The Schedule

        +
        +

        The Schedule

        -
          - {% for slot in slots %} -
        • - - {{ slot.speaker }} - {{ slot.time }} - -
        • - {% endfor %} -
        -
        +
          + {% for slot in slots %} +
        • + + {{ slot.speaker }} + {{ slot.time }} + +
        • + {% endfor %} +
        +
        From ac4af4dbd7d9d8764bd7028cf75579823049962b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 22 May 2019 20:12:34 +0100 Subject: [PATCH 10/16] Change speaker key to label --- app/config/sculpin_site.yml | 34 ++++++++++++++--------------- source/_includes/schedule.html.twig | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/config/sculpin_site.yml b/app/config/sculpin_site.yml index 7133d8b..0671568 100644 --- a/app/config/sculpin_site.yml +++ b/app/config/sculpin_site.yml @@ -15,55 +15,55 @@ papercall: schedule: slots: - time: 8:30 am - speaker: Registration and refreshments + label: Registration and refreshments - time: 9:00 am - speaker: Welcome + label: Welcome - time: 9:10 am - speaker: Dan McNamara + label: Dan McNamara - time: 10:00 am - speaker: TBA + label: TBA - time: 10:30 am - speaker: Refreshments + label: Refreshments - time: 10:50 am - speaker: TBA + label: TBA - time: 11:40 am - speaker: TBA + label: TBA - time: 12:10 pm - speaker: Lunch + label: Lunch - time: 1:10 pm - speaker: TBA + label: TBA - time: 2:00 pm - speaker: TBA + label: TBA - time: 2:15 pm - speaker: TBA + label: TBA - time: 2:30 pm - speaker: Refreshments + label: Refreshments - time: 2:50 pm - speaker: TBC + label: TBC - time: 3:05 pm - speaker: TBC + label: TBC - time: 3:20 pm - speaker: Matt Haworth + label: Matt Haworth - time: 4:10 pm - speaker: Closing remarks + label: Closing remarks - time: 4:40 pm - speaker: Drinks reception + label: Drinks reception tickets: available: true diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 1454e19..10a020c 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -6,7 +6,7 @@ {% for slot in slots %}
      • - {{ slot.speaker }} + {{ slot.label }} {{ slot.time }}
      • From d100b421641299c7652aefb09e5258d4efebd1e7 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 22 May 2019 21:25:05 +0100 Subject: [PATCH 11/16] Split onto multiple lines --- .../src/TwigExtension/SpeakersExtension.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Speakers/src/TwigExtension/SpeakersExtension.php b/src/Speakers/src/TwigExtension/SpeakersExtension.php index 066ae16..b513de5 100644 --- a/src/Speakers/src/TwigExtension/SpeakersExtension.php +++ b/src/Speakers/src/TwigExtension/SpeakersExtension.php @@ -28,9 +28,12 @@ class SpeakersExtension extends AbstractExtension */ public function getSessionSpeakers($session, array $speakers): array { - return collect($speakers)->filter(function ($speaker) use ($session): bool { - return collect($session['speakers'])->contains($speaker['title']); - })->values()->toArray(); + return collect($speakers) + ->filter(function ($speaker) use ($session): bool { + return collect($session['speakers'])->contains($speaker['title']); + }) + ->values() + ->toArray(); } /** @@ -43,8 +46,11 @@ class SpeakersExtension extends AbstractExtension */ public function getSpeakerSessions($speaker, array $sessions): array { - return collect($sessions)->filter(function ($session) use ($speaker): bool { - return collect($session['speakers'])->contains($speaker['title']); - })->values()->toArray(); + return collect($sessions) + ->filter(function ($session) use ($speaker): bool { + return collect($session['speakers'])->contains($speaker['title']); + }) + ->values() + ->toArray(); } } From 9ed1314762c6b8cdfcfda8811538833c78fbe902 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 23 May 2019 01:04:10 +0100 Subject: [PATCH 12/16] Pass sessions into the schedule partial --- source/index.html.twig | 3 ++- src/Schedule/services.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/Schedule/services.yml diff --git a/source/index.html.twig b/source/index.html.twig index 5794dba..f23d84f 100644 --- a/source/index.html.twig +++ b/source/index.html.twig @@ -3,7 +3,7 @@ layout: default twitter: url: https://twitter.com/drupalcampbris update_text: Early bird tickets are now available! -use: [speakers] +use: [sessions, speakers] --- {% block content %}
        @@ -45,6 +45,7 @@ use: [speakers] } %} {% include 'schedule' with { + sessions: data.sessions, slots: site.schedule.slots, } %} {% endblock %} diff --git a/src/Schedule/services.yml b/src/Schedule/services.yml new file mode 100644 index 0000000..f7d98d9 --- /dev/null +++ b/src/Schedule/services.yml @@ -0,0 +1,4 @@ +services: + App\Schedule\TwigExtension\ScheduleExtension: + tags: + - { name: twig.extension } From 52f909da6d1b49f46364e3f4442f7af92bc5a402 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 23 May 2019 01:05:29 +0100 Subject: [PATCH 13/16] Add Schedule bundle --- app/SculpinKernel.php | 2 + composer.json | 3 +- .../SculpinScheduleExtension.php | 17 +++++++++ src/Schedule/src/Model/Session.php | 30 +++++++++++++++ src/Schedule/src/SculpinScheduleBundle.php | 9 +++++ .../src/TwigExtension/ScheduleExtension.php | 29 ++++++++++++++ src/Schedule/tests/ScheduleTest.php | 38 +++++++++++++++++++ 7 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 src/Schedule/src/DependencyInjection/SculpinScheduleExtension.php create mode 100644 src/Schedule/src/Model/Session.php create mode 100644 src/Schedule/src/SculpinScheduleBundle.php create mode 100644 src/Schedule/src/TwigExtension/ScheduleExtension.php create mode 100644 src/Schedule/tests/ScheduleTest.php diff --git a/app/SculpinKernel.php b/app/SculpinKernel.php index 250870c..090ba84 100644 --- a/app/SculpinKernel.php +++ b/app/SculpinKernel.php @@ -1,5 +1,6 @@ load('services.yml'); + } +} diff --git a/src/Schedule/src/Model/Session.php b/src/Schedule/src/Model/Session.php new file mode 100644 index 0000000..ecce4d1 --- /dev/null +++ b/src/Schedule/src/Model/Session.php @@ -0,0 +1,30 @@ +data = $data; + } + + public function getSlot(): int + { + return (int) $this->data['slot']; + } + + public function getTitle(): string + { + return $this->data['title']; + } + + public function getSpeakers(): Collection + { + return collect($this->data['speakers']); + } +} diff --git a/src/Schedule/src/SculpinScheduleBundle.php b/src/Schedule/src/SculpinScheduleBundle.php new file mode 100644 index 0000000..d3c7aae --- /dev/null +++ b/src/Schedule/src/SculpinScheduleBundle.php @@ -0,0 +1,9 @@ +map(function ($session): ?Session { + return new Session($session); + })->first(function (?Session $session) use ($slotId): bool { + return $session->getSlot() == $slotId; + }); + } +} diff --git a/src/Schedule/tests/ScheduleTest.php b/src/Schedule/tests/ScheduleTest.php new file mode 100644 index 0000000..3cda432 --- /dev/null +++ b/src/Schedule/tests/ScheduleTest.php @@ -0,0 +1,38 @@ +extension = new ScheduleExtension(); + } + + /** @test */ + public function get_a_session_for_a_slot() + { + $sessions = [ + ['title' => 'The Real State of Drupal', 'slot' => 4], + ['title' => 'Using Ansible for automation', 'slot' => 1], + ['title' => 'Introduction to Views', 'slot' => 3], + ['title' => 'Doing Good with Drupal', 'slot' => 2], + ]; + + $session = $this->extension->getSessionInSlot(3, $sessions); + + $this->assertInstanceOf(Session::class, $session); + $this->assertSame('Introduction to Views', $session->getTitle()); + } +} \ No newline at end of file From 9c67027ffb6a2109dfcb90ee0be1ff460ada1c99 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 23 May 2019 01:05:39 +0100 Subject: [PATCH 14/16] Assign IDs to slots --- app/config/sculpin_site.yml | 61 +++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/app/config/sculpin_site.yml b/app/config/sculpin_site.yml index 0671568..c31f383 100644 --- a/app/config/sculpin_site.yml +++ b/app/config/sculpin_site.yml @@ -14,55 +14,62 @@ papercall: schedule: slots: - - time: 8:30 am + - id: 1 + time: 8:30 am label: Registration and refreshments - - time: 9:00 am + - id: 2 + time: 9:00 am label: Welcome - - time: 9:10 am - label: Dan McNamara + - id: 3 + time: 9:10 am - - time: 10:00 am - label: TBA + - id: 4 + time: 10:00 am - - time: 10:30 am + - id: 5 + time: 10:30 am label: Refreshments - - time: 10:50 am - label: TBA + - id: 6 + time: 10:50 am - - time: 11:40 am - label: TBA + - id: 7 + time: 11:40 am - - time: 12:10 pm + - id: 8 + time: 12:10 pm label: Lunch - - time: 1:10 pm - label: TBA + - id: 9 + time: 1:10 pm - - time: 2:00 pm - label: TBA + - id: 10 + time: 2:00 pm - - time: 2:15 pm - label: TBA + - id: 11 + time: 2:15 pm - - time: 2:30 pm + - id: 12 + time: 2:30 pm label: Refreshments - - time: 2:50 pm - label: TBC + - id: 13 + time: 2:50 pm - - time: 3:05 pm - label: TBC + - id: 14 + time: 3:05 pm - - time: 3:20 pm - label: Matt Haworth + - id: 15 + time: 3:20 pm - - time: 4:10 pm + - id: 16 + time: 4:10 pm label: Closing remarks - - time: 4:40 pm + - id: 17 + time: 4:40 pm label: Drinks reception tickets: From 2dce6d172ad6359f14e83bfc80f6e55176c997a8 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 23 May 2019 01:05:56 +0100 Subject: [PATCH 15/16] Assign slots to sessions --- source/_sessions/doing-good-with-drupal.md | 1 + source/_sessions/real-state-of-drupal.md | 1 + 2 files changed, 2 insertions(+) diff --git a/source/_sessions/doing-good-with-drupal.md b/source/_sessions/doing-good-with-drupal.md index c7b994e..521c70d 100644 --- a/source/_sessions/doing-good-with-drupal.md +++ b/source/_sessions/doing-good-with-drupal.md @@ -1,6 +1,7 @@ --- title: Doing good with Drupal speakers: [Matt Haworth] +slot: 15 use: [speakers] --- More and more charities and campaigners are choosing Drupal to create websites that raise funds, find supporters and deliver content and services to those who need it most. diff --git a/source/_sessions/real-state-of-drupal.md b/source/_sessions/real-state-of-drupal.md index de5758e..0213b37 100644 --- a/source/_sessions/real-state-of-drupal.md +++ b/source/_sessions/real-state-of-drupal.md @@ -1,5 +1,6 @@ --- title: The Real State of Drupal +slot: 3 speakers: [Dan McNamara] use: [speakers] --- From e27d299940554a0d5b9ddc38bd4fcdf07882f68e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 23 May 2019 01:06:46 +0100 Subject: [PATCH 16/16] Use sessionInSlot function --- source/_includes/schedule.html.twig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/_includes/schedule.html.twig b/source/_includes/schedule.html.twig index 10a020c..e69f6c6 100644 --- a/source/_includes/schedule.html.twig +++ b/source/_includes/schedule.html.twig @@ -4,9 +4,15 @@
          {% for slot in slots %} + {% set session = sessionInSlot(slot.id, sessions) %}
        • - {{ slot.label }} + + {{ session.title|default(slot.label)|default('TBA') }} + {% if session.speakers %} + {{ session.speakers|join(', ') }} + {% endif %} + {{ slot.time }}