diff --git a/private/js/modules/plugins/timetable.js b/private/js/modules/plugins/timetable.js index bbdc82e..8ff1dba 100644 --- a/private/js/modules/plugins/timetable.js +++ b/private/js/modules/plugins/timetable.js @@ -1,4 +1,4 @@ -$(function() { +$(function () { var $body = $('body'); var $timetable = $('#timetable'); @@ -9,7 +9,7 @@ $(function() { $(window).scrollTop(0); window.timetable_can_scroll = false; - window.setTimeout(function() { + window.setTimeout(function () { window.timetable_can_scroll = true; }, 2500); @@ -39,17 +39,17 @@ $(function() { function init_timetable_items() { $timetable.attr('data-active', 1); - $timetable.find('.timetable__item').each(function() { + $timetable.find('.timetable__item').each(function () { $(this).addClass('reveal_container') }); - window.setTimeout(function() { + window.setTimeout(function () { $timetable.addClass('active'); - window.requestAnimationFrame(function() { - $timetable.find('.timetable__item').each(function() { + window.requestAnimationFrame(function () { + $timetable.find('.timetable__item').each(function () { var index = parseInt($(this).attr('data-id')); var elementWatcher = scrollMonitor.create(this); - elementWatcher.enterViewport(function() { + elementWatcher.enterViewport(function () { set_timetable_item(index); }); }); @@ -76,7 +76,7 @@ $(function() { var $timetable_progress = $('#timetable__clock__progress'); var timetable_clock_progress_max = parseFloat($timetable_progress.attr('stroke-dasharray')); - $body.on('click', '.timetable__next', function(event) { + $body.on('click', '.timetable__next', function (event) { event.preventDefault(); if (!activated) { $(window).scrollTop($(window).height()); @@ -146,4 +146,43 @@ $(function() { $timetable_progress.attr('stroke-dashoffset', timetable_clock_progress_max * Math.abs(total_progress - 1)); } } + + document.querySelector('.timetable__button a').addEventListener('click', function (event) { + event.preventDefault(); + var player; + var vimeo_id = document.querySelector('.timetable__button').getAttribute('data-video-vimeo-id'); + + var pswpElement = document.querySelectorAll('.pswp')[0], + gallery, + options, + items; + + options = { + showHideOpacity: true, + download: false, + fullscreenEl: false, + shareEl: false, + }; + + items = [ + { + html: '', + }, + ]; + + var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); + + gallery.listen('close', function () { + document.querySelector('#timetable').style.height = ''; + player.pause(); + }); + + gallery.init(); + + document.querySelector('#timetable').style.height = '100%'; + var iframe = document.querySelector('.pswp iframe'); + player = new Vimeo.Player(iframe); + player.play(); + }); + }); \ No newline at end of file diff --git a/private/scss/modules/plugins/_gallery.scss b/private/scss/modules/plugins/_gallery.scss index 77a5a53..5bf22e7 100644 --- a/private/scss/modules/plugins/_gallery.scss +++ b/private/scss/modules/plugins/_gallery.scss @@ -3,6 +3,25 @@ font-size: 0; } +.gallery__iframe { + width: 100%; + max-width: 90vh; + margin: auto; + position: relative; + top: 50%; + transform: translateY(-50%); +} + +.gallery__iframe__main { + width: 100%; + padding-bottom: 56.25%; + position: relative; +} + +.gallery__iframe__main iframe { + position: absolute; +} + .gallery__item { display: inline-block; vertical-align: top; diff --git a/private/scss/modules/plugins/_timetable.scss b/private/scss/modules/plugins/_timetable.scss index c85072e..3c9fde2 100644 --- a/private/scss/modules/plugins/_timetable.scss +++ b/private/scss/modules/plugins/_timetable.scss @@ -11,6 +11,27 @@ $timetable_count: 15; } } +.timetable__button { + opacity: 0; + position: fixed; + top: 103px; + left: 50%; + transform: translateX(-50%); + z-index: 1000; + transition: opacity 0.5s $easeOutQuad; + #timetable[data-active="0"] & { + opacity: 1; + } + img { + position: absolute; + top: 50%; + left: 50%; + width: 40px; + height: 20px; + margin-left: -20px; + } +} + .timetable__clock__frame { position: fixed; top: 50%; diff --git a/requirements.in b/requirements.in index f3b0ce3..a222e50 100644 --- a/requirements.in +++ b/requirements.in @@ -15,7 +15,7 @@ https://control.divio.com/api/v1/apps/serve/django-filer/1.4.1/e7e860ea-0af6-4fc elasticsearch==6.4.0 django-spurl==0.6.5 aldryn-search==1.0.1 -django-fontawesome==0.3.1 +django-fontawesome==1.0 mailchimp3==2.1.0 django-image-cropping==1.2.0 django-admin-view-permission==1.9 @@ -36,3 +36,5 @@ django-simple-captcha==0.5.12 django-treebeard==4.3.1 django-meta==1.7.0 tablib==0.14.0 +django-simple-sso==0.14.1 +easy-thumbnails==2.7.1 diff --git a/src/project/migrations/0011_auto_20211104_1608.py b/src/project/migrations/0011_auto_20211104_1608.py new file mode 100644 index 0000000..a51424f --- /dev/null +++ b/src/project/migrations/0011_auto_20211104_1608.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.21 on 2021-11-04 16:08 +from __future__ import unicode_literals + +from django.db import migrations, models +import djangocms_text_ckeditor.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('project', '0010_auto_20200325_1611'), + ] + + operations = [ + migrations.AddField( + model_name='timetable', + name='video_cta', + field=djangocms_text_ckeditor.fields.HTMLField(blank=True, null=True, verbose_name='Video CTA'), + ), + migrations.AddField( + model_name='timetable', + name='video_vimeo_id', + field=models.IntegerField(blank=True, help_text='e.g. https://vimeo.com/131766159', null=True, verbose_name='Video Vimeo ID'), + ), + ] diff --git a/src/project/models.py b/src/project/models.py index bdcc755..c21b014 100644 --- a/src/project/models.py +++ b/src/project/models.py @@ -265,6 +265,8 @@ class Timetable(CMSPlugin): introduction = HTMLField(verbose_name='Intro', configuration='CKEDITOR_SETTINGS_INPUT') outro = HTMLField(verbose_name='Outro', configuration='CKEDITOR_SETTINGS_INPUT', blank=True, null=True) cta = HTMLField(verbose_name='CTA', configuration='CKEDITOR_SETTINGS_INPUT', blank=True, null=True) + video_vimeo_id = models.IntegerField(verbose_name='Video Vimeo ID', blank=True, null=True, help_text='e.g. https://vimeo.com/131766159') + video_cta = HTMLField(verbose_name='Video CTA', configuration='CKEDITOR_SETTINGS_INPUT', blank=True, null=True) class Meta(CMSPlugin.Meta): verbose_name = 'Timetable' diff --git a/src/project/templates/project/plugins/timetable/timetable.html b/src/project/templates/project/plugins/timetable/timetable.html index 31cb035..adc3736 100644 --- a/src/project/templates/project/plugins/timetable/timetable.html +++ b/src/project/templates/project/plugins/timetable/timetable.html @@ -1,6 +1,15 @@ {% load i18n cms_tags thumbnail util_tags %}
+ {% if instance.video_vimeo_id and instance.video_cta %} +
+ + {% include 'project/assets/play.svg' %} + {{ instance.video_cta }} + +
+ {% endif %} +