forked from TagesschuleElementa/www.tagesschule-elementa.ch
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2963c0b3fb | ||
|
|
eac8a31856 | ||
|
|
0048f5ef99 | ||
|
|
a0bb334f05 | ||
|
|
1f3adfd482 | ||
|
|
71fa095663 | ||
|
|
b27e30700f | ||
|
|
d4b9ba68a5 | ||
|
|
6883bc9cb9 | ||
|
|
5a0457d4ff | ||
|
|
7f11089915 | ||
|
|
93de30564d |
@@ -1,21 +1,40 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:1.16-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./docker/conf/nginx:/etc/nginx/conf.d
|
||||
- ./docker/static_collected:/app/static_collected
|
||||
- ${MEDIA_DIR}:/app/data/media
|
||||
ports:
|
||||
- ${HTTP_PORT}:80
|
||||
#command: "/bin/sh -c 'while :; do sleep 1m & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||
depends_on:
|
||||
- web
|
||||
network_mode: bridge
|
||||
links:
|
||||
- web
|
||||
web:
|
||||
restart: unless-stopped
|
||||
build: "."
|
||||
links:
|
||||
- "db:postgres"
|
||||
ports:
|
||||
- "8007:80"
|
||||
volumes:
|
||||
- ".:/app:rw"
|
||||
- "./data:/data:rw"
|
||||
command: python manage.py runserver 0.0.0.0:80
|
||||
- .:/app:rw
|
||||
- ${DATA_DIR}:/data:rw
|
||||
- ${STATIC_DIR}:/app/static_collected
|
||||
- ${MEDIA_DIR}:/app/data/media
|
||||
network_mode: bridge
|
||||
command: "/bin/sh -c '/app/wait-for-postgres.sh postgres /app/run.sh'"
|
||||
env_file:
|
||||
- ./.env
|
||||
db:
|
||||
restart: unless-stopped
|
||||
image: postgres:9.6-alpine
|
||||
env_file:
|
||||
- ./.env-db
|
||||
volumes:
|
||||
- ".:/app:rw"
|
||||
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql/data:rw
|
||||
network_mode: bridge
|
||||
|
||||
@@ -38,3 +38,4 @@
|
||||
@import "modules/plugins/_timetable.scss";
|
||||
@import "modules/plugins/_reference_list.scss";
|
||||
@import "modules/plugins/_form.scss";
|
||||
@import "modules/plugins/_iframe.scss";
|
||||
|
||||
3
private/scss/modules/plugins/_iframe.scss
Normal file
3
private/scss/modules/plugins/_iframe.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
.iframe {
|
||||
margin: em(50px) 0;
|
||||
}
|
||||
@@ -38,3 +38,8 @@ django-meta==1.7.0
|
||||
tablib==0.14.0
|
||||
django-simple-sso==0.14.1
|
||||
easy-thumbnails==2.7.1
|
||||
dj-database-url==0.5.0
|
||||
django-js-asset==1.2.3
|
||||
idna==3.4
|
||||
cssselect==1.1.0
|
||||
lxml-html-clean==0.1.1
|
||||
|
||||
@@ -264,3 +264,9 @@ RECAPTCHA_PUBLIC_KEY = '6LeILd0ZAAAAAB9xO_y8kS292wv2ikl0M8s7zFn9'
|
||||
RECAPTCHA_PRIVATE_KEY = '6LeILd0ZAAAAAOGF1AvxdiGcXWLjr2BzHaQ8Zush'
|
||||
|
||||
RECAPTCHA_SCORE_THRESHOLD = 0.5
|
||||
|
||||
ALDRYN_FORMS_ACTION_BACKENDS = {
|
||||
'default': 'project.action_backends.DefaultAction',
|
||||
'email_only': 'aldryn_forms.action_backends.EmailAction',
|
||||
'none': 'aldryn_forms.action_backends.NoAction',
|
||||
}
|
||||
|
||||
13
src/project/action_backends.py
Normal file
13
src/project/action_backends.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from aldryn_forms.action_backends_base import BaseAction
|
||||
|
||||
class DefaultAction(BaseAction):
|
||||
verbose_name = 'Default'
|
||||
|
||||
def form_valid(self, cmsplugin, instance, request, form):
|
||||
email = form.cleaned_data.get('emailfield_1', None)
|
||||
if email and email in ['eric.jones.z.mail@gmail.com']:
|
||||
return
|
||||
recipients = cmsplugin.send_notifications(instance, form)
|
||||
form.instance.set_recipients(recipients)
|
||||
form.save()
|
||||
@@ -15,7 +15,7 @@ from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
|
||||
from project.forms import NewsletterSubscriptionForm
|
||||
from project.models import Section, Quote, SliderItem, SectionText, Video, DownloadSection, DownloadSectionFolder, \
|
||||
TextSliderItem, HighlightListItem, ReferenceListItem, SocialMediaList, SocialMediaListItem, Timetable, \
|
||||
TimetableItem, Partner, HighlightList, Image, TitleListItem, TitleList, IntroImage, Gallery
|
||||
TimetableItem, Partner, HighlightList, Image, TitleListItem, TitleList, IntroImage, Gallery, Iframe
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
@@ -29,7 +29,7 @@ class SectionPlugin(CMSPluginBase):
|
||||
'SectionTextPlugin', 'VideoPlugin', 'DownloadSectionPlugin', 'TextSliderPlugin',
|
||||
'HighlightListPlugin', 'ReferenceListPlugin', 'FormPlugin', 'PicturePlugin', 'SubPageListPlugin',
|
||||
'PartnerPlugin', 'NewsletterSubscriptionPlugin', 'NewsletterArchivePlugin',
|
||||
'SocialMediaListPlugin', 'GalleryPlugin']
|
||||
'SocialMediaListPlugin', 'GalleryPlugin', 'IframePlugin']
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
@@ -348,3 +348,11 @@ class GalleryPlugin(CMSPluginBase):
|
||||
module = 'Content'
|
||||
name = 'Gallery'
|
||||
render_template = 'project/plugins/content/gallery.html'
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class IframePlugin(CMSPluginBase):
|
||||
model = Iframe
|
||||
module = 'Content'
|
||||
name = 'Iframe'
|
||||
render_template = 'project/plugins/content/iframe.html'
|
||||
|
||||
30
src/project/migrations/0012_iframe.py
Normal file
30
src/project/migrations/0012_iframe.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.21 on 2024-05-23 15:51
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0020_old_tree_cleanup'),
|
||||
('project', '0011_auto_20211104_1608'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Iframe',
|
||||
fields=[
|
||||
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='project_iframe', serialize=False, to='cms.CMSPlugin')),
|
||||
('html', models.TextField(verbose_name='HTML')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Iframe',
|
||||
'verbose_name_plural': 'Iframes',
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('cms.cmsplugin',),
|
||||
),
|
||||
]
|
||||
@@ -349,3 +349,14 @@ class Gallery(CMSPlugin):
|
||||
@property
|
||||
def files(self):
|
||||
return self.folder.files.all().order_by('name')
|
||||
|
||||
|
||||
class Iframe(CMSPlugin):
|
||||
html = models.TextField('HTML')
|
||||
|
||||
class Meta(CMSPlugin.Meta):
|
||||
verbose_name = 'Iframe'
|
||||
verbose_name_plural = 'Iframes'
|
||||
|
||||
def __str__(self):
|
||||
return self.html
|
||||
|
||||
@@ -177,12 +177,14 @@
|
||||
<div id="privacy-message" style="display: none;">
|
||||
<div class="privacy-message__frame">
|
||||
<p>
|
||||
{% page_url 'imprint' as privacy_url %}
|
||||
{% blocktrans with privacy_url=privacy_url %}
|
||||
{% page_url 'privacy' as privacy_url %}
|
||||
{% if LANGUAGE_CODE == 'de' %}
|
||||
Um diese Webseite optimal gestalten und fortlaufend verbessern zu können, verwenden wir Cookies.
|
||||
Weitere Informationen finden Sie in unserer
|
||||
<a href="{{ privacy_url }}">Datenschutzerklärung im Impressum</a>.
|
||||
{% endblocktrans %}
|
||||
Weitere Informationen finden Sie in unserer <a href="{{ privacy_url }}">Datenschutzerklärung</a>.
|
||||
{% else %}
|
||||
In order to optimize this website and to continuously improve it, we use cookies.
|
||||
Further information can be found in our <a href="{{ privacy_url }}">data protection policy</a>.
|
||||
{% endif %}
|
||||
</p>
|
||||
<div class="privacy-message__actions">
|
||||
<a href="#" class="button button--small button--ghost privacy_action--decline">
|
||||
@@ -208,30 +210,20 @@
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
var init_google_analytics = function() {
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function() {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date();
|
||||
a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', 'UA-116863155-1', 'auto');
|
||||
ga('set', 'anonymizeIp', true);
|
||||
ga('send', 'pageview');
|
||||
var init_tag_manager = function() {
|
||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-WVRJ872');
|
||||
};
|
||||
|
||||
if (window.privacy_accepted) {
|
||||
init_google_analytics();
|
||||
init_tag_manager();
|
||||
}
|
||||
|
||||
$('body').on('enable_tracking', function() {
|
||||
init_google_analytics();
|
||||
init_tag_manager();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="iframe reveal_container">
|
||||
<div class="reveal reveal_animation">
|
||||
<div style="display:inline-block;vertical-align:top;width:300px;margin:20px auto;color:#333;background:#fff;border:1px solid #ddd;line-height:1.2;text-decoration:none;padding:0"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer"><img src="https://assets.api.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/books/3EzILpspTZubAkL9btIklA/cover/share" style="max-height:300px;max-width:100%;display:block;margin:0 auto;padding:0;border:none" alt="Unsere Lieblingstiere"/></a><div style="display:block;padding:20px;overflow:hidden;overflow-x:hidden;border-top:1px solid #ddd"><div style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal;font-size:21px;margin:0 0 0.25em"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">Unsere Lieblingstiere</a></div><div style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal;font-size:16px;margin:0 0 0.5em"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">Click to read this book, made with Book Creator</a></div><div style="display:block;color:#455a64;line-height:1.2;text-decoration:none;padding:0;font-weight:bold;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">read.bookcreator.com</a></div></div></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@ from django.conf.urls import url, include
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
from project.views import SearchView, NewsletterSubscriptionView, LoginRedirectView, MediaRedirectView
|
||||
from project.views import SearchView, NewsletterSubscriptionView, LoginRedirectView, MediaRedirectView, ArchiveFilerPublic
|
||||
|
||||
urlpatterns = [
|
||||
url(_(r'^suche/'), SearchView.as_view(), kwargs={'search': True}, name='search'),
|
||||
@@ -13,4 +13,5 @@ urlpatterns = [
|
||||
name='newsletter_subscription_success'),
|
||||
url(r'^login/redirect/$', LoginRedirectView.as_view(), name='login_redirect'),
|
||||
url(r'^media/bridge/$', MediaRedirectView.as_view(), name='media_bridge'),
|
||||
url(r'^media/archive/$', ArchiveFilerPublic.as_view(), name='media_archive'),
|
||||
]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from aldryn_search.views import AldrynSearchView
|
||||
from cms.models import Page
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.views import View
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.generic.edit import FormView
|
||||
from aldryn_forms.admin.views import FormExportWizardView
|
||||
@@ -9,6 +10,8 @@ from aldryn_forms.admin.exporter import Exporter
|
||||
from tablib import Dataset
|
||||
from django.http import HttpResponse
|
||||
from project.forms import NewsletterSubscriptionForm
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
|
||||
class SearchView(AldrynSearchView):
|
||||
@@ -102,3 +105,21 @@ class CustomFormExportWizardView(FormExportWizardView):
|
||||
response = HttpResponse(dataset.xls, content_type=content_type)
|
||||
response['Content-Disposition'] = 'attachment; filename=%s' % filename
|
||||
return response
|
||||
|
||||
|
||||
class ArchiveFilerPublic(View):
|
||||
|
||||
def get(self, request):
|
||||
path = '/app/data/media/filer_public/'
|
||||
with zipfile.ZipFile('filer_public.zip', 'w', zipfile.ZIP_DEFLATED) as zipf:
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
filePath = os.path.join(root, file)
|
||||
try:
|
||||
with open(filePath) as tempFile:
|
||||
pass
|
||||
zipf.write(filePath, os.path.relpath(filePath, os.path.join(path, '..')))
|
||||
except IOError:
|
||||
print(filePath)
|
||||
return HttpResponse('success')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user