Re-organise talks

This commit is contained in:
Oliver Davies 2017-10-28 00:31:21 +01:00
parent e0e93e4fe5
commit b60fb6038e
11 changed files with 192 additions and 12 deletions

View file

@ -1,5 +1,7 @@
<?php
use App\FormatTalks\FormatTalksBundle;
use App\FormatTalks\SculpinFormatTalksBundle;
use Opdavies\Sculpin\Bundle\ContentGeneratorBundle\SculpinContentGeneratorBundle;
use Opdavies\Sculpin\Bundle\GistEmbedBundle\SculpinGistEmbedBundle;
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
@ -19,6 +21,8 @@ class SculpinKernel extends AbstractKernel
SculpinContentGeneratorBundle::class,
SculpinGistEmbedBundle::class,
SculpinTwigMarkdownBundle::class,
SculpinFormatTalksBundle::class,
];
}
}

View file

@ -87,11 +87,3 @@ events:
name: 'unified.diff'
location: Cardiff, UK
website: http://unifieddiff.co.uk
# - event: swdug
# date: '2013-07-10'
# talk_title: Drupal and the LDAP Module
# - event: swdug
# date: '2014-08-19'
# talk_title: About the Drupal Association

View file

@ -11,12 +11,25 @@
"opdavies/sculpin-twig-markdown-bundle": "^0.1",
"php": "^5.5|^7.0",
"sculpin/sculpin": "^2.1@dev",
"tsphethean/sculpin-related-posts-bundle": "~0.1.0"
"tsphethean/sculpin-related-posts-bundle": "~0.1.0",
"wikimedia/composer-merge-plugin": "^1.4"
},
"require-dev": {
"opdavies/sculpin-content-generator-bundle": "@stable"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\FormatTalks\\": "src/format-talks-bundle/src"
}
},
"extra": {
"merge-plugin": {
"include": [
"src/*/composer.json"
]
}
}
}

98
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "a0f8f8519a18431f6596a4a342fd66fe",
"content-hash": "ae2c2cbaa6243333432aa088b4edb5c3",
"packages": [
{
"name": "composer/ca-bundle",
@ -2419,6 +2419,53 @@
"homepage": "https://symfony.com",
"time": "2017-06-01T20:52:29+00:00"
},
{
"name": "tightenco/collect",
"version": "v5.4.33",
"source": {
"type": "git",
"url": "https://github.com/tightenco/collect.git",
"reference": "73aa38b20d932f5e8f8ccf721e4c27f4304783d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tightenco/collect/zipball/73aa38b20d932f5e8f8ccf721e4c27f4304783d6",
"reference": "73aa38b20d932f5e8f8ccf721e4c27f4304783d6",
"shasum": ""
},
"require": {
"php": ">=5.6.4"
},
"require-dev": {
"mockery/mockery": "^0.9.7",
"phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
"files": [
"src/Illuminate/Support/helpers.php"
],
"psr-4": {
"Illuminate\\": "src/Illuminate"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"description": "Collect - Illuminate Collections as a separate package.",
"keywords": [
"collection",
"laravel"
],
"time": "2017-08-14T20:47:19+00:00"
},
{
"name": "tsphethean/sculpin-related-posts-bundle",
"version": "0.1.0",
@ -2769,6 +2816,55 @@
"string"
],
"time": "2017-05-11T10:04:12+00:00"
},
{
"name": "wikimedia/composer-merge-plugin",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/wikimedia/composer-merge-plugin.git",
"reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100",
"reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0",
"php": ">=5.3.2"
},
"require-dev": {
"composer/composer": "~1.0.0",
"jakub-onderka/php-parallel-lint": "~0.8",
"phpunit/phpunit": "~4.8|~5.0",
"squizlabs/php_codesniffer": "~2.1.0"
},
"type": "composer-plugin",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
},
"class": "Wikimedia\\Composer\\MergePlugin"
},
"autoload": {
"psr-4": {
"Wikimedia\\Composer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bryan Davis",
"email": "bd808@wikimedia.org"
}
],
"description": "Composer plugin to merge multiple composer.json files",
"time": "2017-04-25T02:31:25+00:00"
}
],
"packages-dev": [

View file

@ -8,6 +8,8 @@ use: [talks]
{% block content %}
<p>I regularly speak at conferences and user groups about a range of subjects including Drupal, Sculpin and Git. If you would like to me to speak at your group or conference, please <a href="{{ site.url }}/contact">get in touch</a>.</p>
<h2>Last 5 Talks</h2>
{% set talks = [] %}
{% for talk in data.talks %}
{% for event in talk.events %}
@ -18,7 +20,9 @@ use: [talks]
{% endfor %}
{% endfor %}
{% include "talks-table" %}
{% include "talks-table" with {
talks: talks|format_talks|slice(0,5)
} %}
<p>Upcoming talks can be found in the <a href="{{ site.url }}/talks/archive">talks archive</a>.</p>
{% endblock %}

View file

@ -24,6 +24,6 @@ talks:
{% endfor %}
{% endfor %}
{% include 'talks-table' %}
{% include 'talks-table' with { talks: talks|format_talks } %}
<p>Upcoming talks can be found on the <a href="{{ site.url }}/talks">talks page]</a>.</p>

View file

@ -0,0 +1,5 @@
services:
app.twig.format_talks:
class: 'App\FormatTalks\Twig\FormatTalksExtension'
tags:
- { name: twig.extension }

View file

@ -0,0 +1,5 @@
{
"require": {
"tightenco/collect": "^5.4"
}
}

View file

@ -0,0 +1,20 @@
<?php
namespace App\FormatTalks\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
class SculpinFormatTalksExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../Resources/config'));
$loader->load('services.yml');
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace App\FormatTalks;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class SculpinFormatTalksBundle extends Bundle {}

View file

@ -0,0 +1,34 @@
<?php
namespace App\FormatTalks\Twig;
use Twig_Extension;
use Twig_SimpleFilter;
class FormatTalksExtension extends Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getFilters()
{
return [
new Twig_SimpleFilter('format_talks', [$this, 'formatTalks']),
];
}
public function formatTalks($talks)
{
return collect($talks)
->sortBy('event.date')
->all();
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'format_talks';
}
}