Merge branch 'sponsors'

This commit is contained in:
Oliver Davies 2019-05-30 20:25:07 +01:00
commit 3a7fe0a70d
28 changed files with 377 additions and 11 deletions

2
.gitignore vendored
View file

@ -3,4 +3,4 @@
/output_*/
/source/dist/
/vendor/
/.phpunit.result.cache
/*.cache

View file

@ -2,6 +2,8 @@
use App\Schedule\SculpinScheduleBundle;
use App\Speakers\SculpinSpeakersBundle;
use App\Sponsors\SculpinSponsorsBundle;
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
use Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel;
class SculpinKernel extends AbstractKernel
@ -11,6 +13,8 @@ class SculpinKernel extends AbstractKernel
return [
SculpinScheduleBundle::class,
SculpinSpeakersBundle::class,
SculpinSponsorsBundle::class,
SculpinTwigMarkdownBundle::class,
];
}
}
}

View file

@ -73,6 +73,46 @@ tickets:
available: true
url: '%eventbrite.url%'
sponsorship_levels:
- gold
- silver
- bronze
sponsors:
gold:
- name: Acquia
description: |
We provide the worlds most ambitious brands with technology that allows them to embrace innovation and create customer moments that matter. At Acquia, we believe in the power of community — giving our customers the freedom to build tomorrow on their terms.
Acquia is helping some of the worlds leading brands succeed, including Twitter, Mercedes Benz, Warner Music Group, and Stanford University. More than 4,000 organizations are using Acquias solutions for content, community and commerce.
logo: acquia.png
url: https://www.acquia.com
confirmed: true
- name: Microserve
description: ~
logo: microserve.png
url: https://microserve.io
confirmed: true
- name: Proctor + Stevenson
description: ~
logo: proctors.jpg
url: https://proctors.co.uk
confirmed: true
silver:
- name: Drupalize.me
logo: drupalize-me.png
url: https://drupalize.me
confirmed: false
bronze:
- name: Manifesto
logo: tpx-manifesto.svg
url: https://manifesto.co.uk
confirmed: true
twitter:
url: https://twitter.com/drupalcampbris
user: DrupalCampBris

View file

@ -12,6 +12,7 @@
"require": {
"php": "^7.1",
"josephlavin/tap": "^1.0",
"opdavies/sculpin-twig-markdown-bundle": "^0.1.1",
"sculpin/sculpin": "^3",
"tightenco/collect": "^5.8"
},
@ -34,12 +35,14 @@
"autoload": {
"psr-4": {
"App\\Speakers\\": "src/Speakers/src",
"App\\Schedule\\": "src/Schedule/src"
"App\\Schedule\\": "src/Schedule/src",
"App\\Sponsors\\": "src/Sponsors/src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\Speakers\\": "src/Speakers/tests"
"App\\Tests\\Speakers\\": "src/Speakers/tests",
"App\\Tests\\Sponsors\\": "src/Sponsors/tests"
}
},
"config": {

46
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9778a3f48980cbd2767f204f6c02b650",
"content-hash": "4ee50eae7effe12398906b86d306461f",
"packages": [
{
"name": "dflydev/ant-path-matcher",
@ -584,6 +584,50 @@
],
"time": "2019-01-26T17:03:58+00:00"
},
{
"name": "opdavies/sculpin-twig-markdown-bundle",
"version": "0.1.1",
"source": {
"type": "git",
"url": "https://github.com/opdavies/sculpin-twig-markdown-bundle.git",
"reference": "8927ec4707eada3ad9ca8817eb9daeb1d91ae50b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opdavies/sculpin-twig-markdown-bundle/zipball/8927ec4707eada3ad9ca8817eb9daeb1d91ae50b",
"reference": "8927ec4707eada3ad9ca8817eb9daeb1d91ae50b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"sculpin/sculpin": "@stable"
},
"type": "library",
"autoload": {
"psr-4": {
"Opdavies\\Sculpin\\Bundle\\TwigMarkdownBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Davies",
"email": "oliver@oliverdavies.uk",
"homepage": "https://www.oliverdavies.uk"
}
],
"keywords": [
"markdown",
"sculpin",
"twig"
],
"time": "2017-03-18T10:39:19+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",

View file

@ -9,6 +9,7 @@
<testsuites>
<testsuite name="Bundles">
<directory suffix="Test.php">src/Speakers/tests</directory>
<directory suffix="Test.php">src/Sponsors/tests</directory>
</testsuite>
</testsuites>
</phpunit>
</phpunit>

View file

@ -0,0 +1,7 @@
.markup {
@apply leading-relaxed;
p:first-child {
@apply mt-0
}
}

View file

@ -23,6 +23,12 @@
active: page.url == '/schedule' or page.layout == 'session',
enabled: true,
},
{
title: 'Sponsors',
href: '/sponsors',
active: page.url == '/sponsors',
enabled: true,
},
{
title: 'Sponsor us',
href: '/sponsor-us',
@ -30,7 +36,6 @@
enabled: now|date('U') < site['date'],
}
] %}
<nav role="navigation" aria-labelledby="block-dcb2017-main-menu-menu" id="block-dcb2017-main-menu" class="block block-menu navigation menu--main">
<h2 class="visually-hidden" id="block-dcb2017-main-menu-menu">Main navigation</h2>
<ul class="tw-list-reset tw-flex tw-flex-wrap tw-justify-center tw--ml-8">

View file

@ -0,0 +1,26 @@
<section class="tw-text-center tw-max-w-5xl md:tw-w-full tw-mx-auto tw-p-8">
<h2 class="tw-font-bold tw-text-4xl tw-mb-8">Our Sponsors</h2>
{% for level in sponsorshipLevels %}
{% set sponsors = getSponsors(sponsorData, level) %}
{% if sponsors %}
<section class="tw-block tw-max-w-3xl tw-mx-auto">
<h3 class="tw-visuallyhidden">{{ level|capitalize }} Sponsors</h3>
<ul class="tw-list-reset tw-flex tw-flex-wrap tw-items-center tw-justify-center tw--mx-4">
{% for sponsor in sponsors %}
<li class="tw-mb-6 {{ level == 'gold' ? 'tw-w-3/5 md:tw-w-1/3' : 'tw-w-1/2 md:tw-w-1/4' }}">
<div class="tw-px-4 tw-mb-4">
<img src="/images/sponsors/{{ sponsor.logo }}" alt="{{ sponsor.name }} logo" class="tw-inline-block tw-max-w-full">
</div>
</li>
{% endfor %}
</ul>
</section>
{% endif %}
{% endfor %}
<footer class="tw-mt-4">
<a class="tw-button tw-w-auto tw-py-2 tw-text-base tw-bg-green-600 hocus:tw-bg-pink-600" href="/sponsors">See all sponsors</a>
</footer>
</section>

View file

@ -0,0 +1,25 @@
<div class="tw-mb-4">
<h3 class="tw-mb-5">{{ name }}</h3>
<div class="tw-flex tw-flex-col-reverse md:tw-flex-row-reverse tw--mx-4">
<div class="tw-flex-1 tw-px-4">
{% if description %}
<div>
{{ description|markdown }}
</div>
{% endif %}
{% if url %}
<a href="{{ url }}" class="tw-button tw-inline-block tw-w-auto tw-bg-purple-600 hocus:tw-bg-green-600 tw-text-base tw-px-4 tw-py-2 tw-mx-0 tw-mt-2">
Visit <span class="tw-visuallyhidden">{{ name }}s</span> website
</a>
{% endif %}
</div>
{% if logo %}
<div class="tw-flex-none tw-px-4 tw-mb-3 md:tw-mb-0 tw-w-full md:tw-w-1/4">
<img src="/images/sponsors/{{ logo }}" alt="{{ name }} logo" class="tw-block tw-w-48 md:tw-w-auto tw-max-w-full">
</div>
{% endif %}
</div>
</div>

View file

@ -0,0 +1,9 @@
<div class="tw-flex tw-flex-col tw-items-center tw-justify-center">
<div>
<img src="/images/sponsors/{{ logo }}" alt="{{ name }} logo" class="tw-max-w-full tw-w-full">
</div>
<div class="tw-mt-1">
<a href="{{ url }}">{{ name }}</a>
</div>
</div>

View file

@ -15,8 +15,10 @@
{% block content_botton %}{% endblock %}
{% if page.update_text %}
{% include 'update-text' %}
{% include 'update-text' %}
{% endif %}
{% block content_bottom %}{% endblock %}
</div>
<div>

1
source/_redirects Normal file
View file

@ -0,0 +1 @@
/sponsorship /sponsor-us

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View file

@ -0,0 +1 @@
<svg viewBox="0 0 673 134" xmlns="http://www.w3.org/2000/svg"><title>Manifesto logo</title><g fill="none" fill-rule="evenodd" transform=""><path d="m106.5255 118.8477-45.203-45.203 45.203-45.203z" fill="#ff5e4d"></path><path d="m89.7435-.0004v45.203l22.602-22.601z" fill="#000a4a"></path><path d="m75.7611 133.295 22.603-22.602-22.603-22.601z" fill="#ffe000"></path><path d="m17.0923 37.9397v-23.81h9.014v-6.463h-26.106v6.463h9.014v23.81zm11.394 0h7.994v-11.82h6.42c3.401 0 6.065-.836 7.993-2.509 1.928-1.672 2.892-3.911 2.892-6.718 0-2.834-.95-5.08-2.849-6.739-1.9-1.658-4.578-2.487-8.036-2.487h-14.414zm7.994-17.773v-6.462h5.357c1.558 0 2.7.276 3.423.829.722.552 1.084 1.368 1.084 2.445 0 2.125-1.503 3.188-4.507 3.188zm46.897-12.5h-9.269l-6.675 9.184-6.548-9.184h-9.226l11.267 14.966-11.522 15.307h9.269l6.803-9.439 6.76 9.439h9.311l-11.565-15.307z" fill="#1d1d1b"></path><path d="m151.923 117.727h520.283v-19.202h-520.283z" fill="#575756"></path><g fill="#1d1d1b"><g transform="translate(151 17.295)"><path d="m52.9087 1.1681-18.951 38.148-19.04-38.148h-13.995v70.53h14.209v-41.099l14.03 26.738h9.61l13.923-26.738v41.099h14.209v-70.53zm133.744 0v43.188l-28.881-43.188h-12.675v70.53h14.208v-43.291l28.881 43.291h12.676v-70.53zm27.116 70.53h14.209v-70.53h-14.209zm75.091-58.257v-12.273h-47.975v70.53h14.209v-28.636h28.756v-12.273h-28.756v-17.348zm56.282 0v-12.273h-47.974v70.53h47.974v-12.272h-33.765v-17.158h28.756v-12.273h-28.756v-16.554zm64.894-12.273v12.273h19.022v58.257h14.227v-58.257h19.022v-12.273zm103.847 7.129c-5.099-4.954-11.357-7.733-19.647-7.733s-14.636 2.779-19.735 7.733c-7.363 7.129-7.167 15.949-7.167 28.136s-.196 21.008 7.167 28.137c5.099 4.954 11.445 7.715 19.735 7.715s14.548-2.761 19.647-7.715c7.363-7.129 7.273-15.95 7.273-28.137s.09-21.007-7.273-28.136zm-10.537 47.952c-2.032 2.279-5.205 3.764-9.11 3.764-3.886 0-7.166-1.485-9.216-3.764-2.764-2.969-3.477-6.248-3.477-19.816 0-13.585.713-16.847 3.477-19.816 2.05-2.279 5.33-3.78 9.216-3.78 3.905 0 7.078 1.501 9.11 3.78 2.764 2.969 3.584 6.231 3.584 19.816 0 13.568-.82 16.847-3.584 19.816z"></path><path d="m405.1992 50.9008c0-6.243-1.738-11.398-5.623-14.966-3.066-2.774-7.259-4.559-13.913-5.449l-8.6-1.19c-2.97-.397-5.325-1.488-6.758-2.775-1.535-1.388-2.15-3.271-2.15-5.054 0-4.856 3.686-8.921 11.263-8.921 4.812 0 10.34.595 14.944 4.857l8.997-8.617c-6.236-5.839-13.497-8.216-23.531-8.216-15.761 0-25.372 8.81-25.372 21.392 0 5.947 1.738 10.505 5.214 13.875 3.272 3.072 7.871 4.956 14.116 5.846l8.806 1.19c3.378.495 5.016 1.189 6.45 2.478 1.537 1.386 2.253 3.468 2.253 5.947 0 5.648-4.505 8.72-12.9 8.72-6.759 0-13-1.486-17.601-5.946l-9.203 8.915c7.159 7.029 15.542 9.304 26.599 9.304 15.252 0 27.009-7.719 27.009-21.39"></path></g><path d="m262.5266 18.4631h-11.142l-26.51 70.53h14.832l5.527-15.621h23.568v-.466l5.491 16.087h14.851zm-13.193 43.361 7.987-22.561 7.702 22.561z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -48,4 +48,9 @@ use: [sessions, speakers]
sessions: data.sessions,
slots: site.schedule.slots,
} %}
{% include 'sponsors-block' with {
sponsorData: site.sponsors,
sponsorshipLevels: site.sponsorship_levels,
} %}
{% endblock %}

32
source/sponsors.html.twig Normal file
View file

@ -0,0 +1,32 @@
---
layout: page
title: Our Sponsors
---
<div>
<p>DrupalCamp Bristol would like to say a massive <strong>THANK YOU!</strong> to all of our incredible sponsors. Without your support, this event would never have been possible.</p>
<p>If you'd like to get involved with sponsorship, head over to our <a href="/sponsorship">Sponsorship</a> page. We'll be on the lookout for new sponsors up until the day of the event.</p>
</div>
<div class="tw--mb-20">
{% for level in site.sponsorship_levels %}
{% set sponsors = getSponsors(site.sponsors, level) %}
{% if sponsors %}
<section class="tw-block tw-mb-24">
<h2 class="tw-mb-6">{{ level ~ ' Sponsors'|capitalize }}</h2>
<div class="tw--mb-8 {{ level == 'gold' ? '' : 'tw-flex tw-flex-wrap tw--mx-2' }}">
{% for sponsor in sponsors %}
<article class="tw-mb-12 {{ level == 'gold' ? 'tw-w-full' : 'tw-w-1/2 md:tw-w-1/4 lg:tw-w-1/6 tw-px-2' }}">
{% set template = (level == 'gold') ? 'sponsors/full' : 'sponsors/teaser' %}
{% include template with {
description: sponsor.description,
logo: sponsor.logo,
name: sponsor.name,
url: sponsor.url,
} %}
</article>
{% endfor %}
</div>
</section>
{% endif %}
{% endfor %}
</div>

View file

@ -0,0 +1,4 @@
services:
App\Sponsors\TwigExtension\SponsorsExtension:
tags:
- { name: twig.extension }

View file

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

View file

@ -0,0 +1,33 @@
<?php
namespace App\Sponsors\Model;
class Sponsor
{
const LEVEL_GOLD = 'gold';
const LEVEL_SILVER = 'silver';
const LEVEL_BRONZE = 'bronze';
/** @var array */
private $data = [];
private function __construct(array $sponsorData)
{
$this->data = $sponsorData;
}
public static function create(array $sponsorData): self
{
return new static($sponsorData);
}
public function isConfirmed(): bool
{
return $this->data['confirmed'] ?? false;
}
public function getData(): array
{
return $this->data;
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace App\Sponsors;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class SculpinSponsorsBundle extends Bundle
{
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Sponsors\TwigExtension;
use App\Sponsors\Model\Sponsor;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class SponsorsExtension extends AbstractExtension
{
public function getName()
{
return 'app.sponsors';
}
public function getFunctions()
{
return [
new TwigFunction('getSponsors', [$this, 'getSponsors'])
];
}
public function getSponsors(array $sponsorData, string $level): array
{
return collect($sponsorData[$level])
->map(function ($sponsor) {
return Sponsor::create($sponsor);
})
->filter->isConfirmed()
->map->getData()
->values()
->toArray();
}
}

View file

@ -0,0 +1,54 @@
<?php
namespace App\Tests\Sponsors;
use App\Sponsors\Model\Sponsor;
use App\Sponsors\TwigExtension\SponsorsExtension;
use PHPUnit\Framework\TestCase;
class SponsorsTest extends TestCase
{
/** @var SponsorsExtension */
private $extension;
protected function setUp(): void
{
parent::setUp();
$this->extension = new SponsorsExtension();
}
/** @test */
public function get_sponsors_by_level()
{
$data = [
Sponsor::LEVEL_GOLD => [
['name' => 'Microserve', 'confirmed' => true],
],
Sponsor::LEVEL_SILVER => [
['name' => 'Drupalize.me', 'confirmed' => true],
],
];
$sponsors = $this->extension->getSponsors($data, Sponsor::LEVEL_SILVER);
$this->assertCount(1, $sponsors);
$this->assertSame('Drupalize.me', $sponsors[0]['name']);
}
/** @test */
public function only_confirmed_sponsors_are_returned()
{
$data = [
Sponsor::LEVEL_GOLD => [
['name' => 'Acquia', 'confirmed' => false],
['name' => 'Microserve', 'confirmed' => true],
],
];
$sponsors = $this->extension->getSponsors($data, Sponsor::LEVEL_GOLD);
$this->assertCount(1, $sponsors);
$this->assertSame('Microserve', $sponsors[0]['name']);
}
}

View file

@ -15,10 +15,11 @@ module.exports = {
}
},
variants: {
backgroundColor: [...variants.backgroundColor, 'hocus'],
borderColor: [...variants.textColor, 'hocus', 'group-hocus'],
fontStyle: [...variants.fontStyle, 'hocus'],
textColor: [...variants.textColor, 'hocus'],
textDecoration: [...variants.textColor, 'hocus', 'group-hocus'],
fontStyle: [...variants.fontStyle, 'hocus']
textDecoration: [...variants.textColor, 'hocus', 'group-hocus']
},
corePlugins: {
preflight: false
@ -27,6 +28,7 @@ module.exports = {
require('tailwindcss-interaction-variants')(),
require('tailwindcss-list-reset')(),
require('tailwindcss-spaced-items')({ values: spacing }),
require('tailwindcss-transitions')()
require('tailwindcss-transitions')(),
require('tailwindcss-visuallyhidden')()
]
}

View file

@ -6699,6 +6699,11 @@ tailwindcss-transitions@^2.0.0:
dependencies:
lodash "^4.17.11"
tailwindcss-visuallyhidden@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/tailwindcss-visuallyhidden/-/tailwindcss-visuallyhidden-1.0.2.tgz#cdf178208282d1787e72186df2cf9d1286347667"
integrity sha512-Hk3Do4x9nAz43CGzcxXqdAhsQs+bE6tUhlcHWBvLC4F8WjqbiGIcp1jPPHmXBAv41D8kFIH0UZyLGw490upsKg==
tailwindcss@^1.0.0-beta.4:
version "1.0.0-beta.8"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-1.0.0-beta.8.tgz#62c04d4bb342933b45164735b0334119651cd733"