Skip to content

Commit

Permalink
Sponsors - Change requests for using the new plugin
Browse files Browse the repository at this point in the history
These are necessary changes to include to make the new sponsor Grav plugin working fine with this theme.

We are introducing:

- New sponsors.html.twig which the plugin will serve the data to
- We include this partial on the frontpage (base.html.twig)
- We use internally the slick-slider https://kenwheeler.github.io/slick/ to show the sponsors in a slider/carousel
  • Loading branch information
Andreas Sander committed Sep 9, 2019
1 parent d78b8c5 commit f8eeef1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion css/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ html {

/** Header **/

header {
body > header {
background-color: hsl(199, 100%, 42%);
font-size: 112%;
font-weight: 700;
Expand Down Expand Up @@ -221,6 +221,7 @@ footer .nav-horizontal li {
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
max-width: 100%;
}

.layout-container aside:not(:empty) + main {
Expand Down
27 changes: 27 additions & 0 deletions css/slick-slider-custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.slick-initialized .slick-track {
display: flex;
align-items: center;
}

.slick-slide img {
max-width: 100%;
margin: 0 auto;
max-height: 300px;
}

.slick-prev,
.slick-next {
z-index: 1;
}

.slick-prev {
left: 5px;
}

.slick-next {
right: 5px;
}

.slick-slide {
padding: 0 5px;
}
12 changes: 11 additions & 1 deletion templates/partials/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
{% do assets.addCss('theme://css/lato-latin-fonts.css', 70) %}
{% do assets.addCss('theme://css/font-awesome.css', 60) %}
{% do assets.addCss('theme://css/content.css', 50) %}
{% do assets.addCss('//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick.css') %}
{% do assets.addCss('//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick-theme.css') %}
{% do assets.addCss('theme://css/slick-slider-custom.css') %}
{% endblock %}
{{ assets.css() }}

{% block javascripts %}
{% do assets.addJs('jquery', 100) %}
{% do assets.addJs('//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick.min.js', {'group': 'bottom'}) %}
{% endblock %}
{{ assets.js() }}
{% endblock head%}
Expand All @@ -49,7 +53,13 @@
{% block body %}
<div class="body wrapper padding layout-container">
<aside>{% block aside %}{% endblock %}</aside>
<main>{% block content %}{% endblock %}</main>
<main>
{% block content %}{% endblock %}
{% if page.home %}
{# Zeige die Sponsoren auf der Startseite nach dem Hauptinhalt #}
{{ sponsoren() }}
{% endif %}
</main>
</div>
{% endblock %}

Expand Down
14 changes: 14 additions & 0 deletions templates/partials/sponsors.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<section>
<header><h2>CoderDojo Deutschland e.V. wird unterstützt von…</h2></header>
<div data-sponsor-slider data-slick='{"slidesToShow": 3, "slidesToScroll": 1, "autoplay": true}'>
{% for key, sponsor in sponsors %}
<a href="{{sponsor.url}}" target="_blank" rel="noopener nofollow"><img src="{{ sponsor.image }}" alt="{{sponsor.label}} logo" /></a>
{% endfor %}
</div>
</section>

<script type="text/javascript">
$(document).ready(function(){
$('[data-sponsor-slider]').slick();
});
</script>

0 comments on commit f8eeef1

Please sign in to comment.