From 1a3a3f06b5c8fc0a264818c2ecef68e3cafee0e4 Mon Sep 17 00:00:00 2001 From: Simon Caminada Date: Fri, 23 Mar 2018 16:53:10 +0100 Subject: [PATCH] portal cms apphook and various fixes --- private/scss/modules/_control-panel.scss | 13 +++++++ private/scss/modules/_footer.scss | 2 +- private/scss/modules/plugins/_form.scss | 2 +- settings.py | 14 ++++++-- src/portal/cms_apps.py | 11 ++++++ src/portal/templates/portal/overview.html | 11 +++--- src/project/cms_plugins.py | 10 +++++- src/project/migrations/0006_introimage.py | 35 +++++++++++++++++++ src/project/models.py | 9 +++++ src/project/templates/main.html | 16 +++++---- src/project/templates/project/content.html | 4 ++- .../project/includes/header_button_menu.html | 11 ++++-- .../project/includes/navigation.html | 18 ++++++---- .../project/newsletter/subscription.html | 4 +++ .../project/plugins/content/intro_image.html | 5 +++ .../plugins/content/section_title.html | 2 +- src/project/urls.py | 5 ++- src/project/views.py | 17 +++++++++ 18 files changed, 161 insertions(+), 28 deletions(-) create mode 100644 src/portal/cms_apps.py create mode 100644 src/project/migrations/0006_introimage.py create mode 100644 src/project/templates/project/plugins/content/intro_image.html diff --git a/private/scss/modules/_control-panel.scss b/private/scss/modules/_control-panel.scss index 4c080df..7505091 100644 --- a/private/scss/modules/_control-panel.scss +++ b/private/scss/modules/_control-panel.scss @@ -3,6 +3,16 @@ padding: em(100px) 0 0; will-change: transform, height; text-align: left; + .section__title { + padding-left: 75%; + } +} + +.control_panel, .downloads__frame { + .section__title { + position: relative; + z-index: -1; + } } .information__form { @@ -189,6 +199,9 @@ padding: em(150px) 0; position: relative; will-change: transform; + .section__title { + padding-left: 25%; + } .downloads { li { width: 33.3333%; diff --git a/private/scss/modules/_footer.scss b/private/scss/modules/_footer.scss index 5811e77..beac7dc 100644 --- a/private/scss/modules/_footer.scss +++ b/private/scss/modules/_footer.scss @@ -60,7 +60,7 @@ width: em(12px); height: em(12px); top: em(-1px); - margin-right: em(10px); + margin-left: em(10px); } } @media screen and (max-width: $medium_breakpoint) { diff --git a/private/scss/modules/plugins/_form.scss b/private/scss/modules/plugins/_form.scss index 0eba100..11edfc6 100644 --- a/private/scss/modules/plugins/_form.scss +++ b/private/scss/modules/plugins/_form.scss @@ -172,7 +172,7 @@ } .form__field--icon { - input { + input[type="text"], input[type="email"], input[type="number"], input[type="password"] { height: em(70px); padding: 0 em(90px) 0 em(15px); } diff --git a/settings.py b/settings.py index 054f23b..4b1aac7 100644 --- a/settings.py +++ b/settings.py @@ -33,8 +33,7 @@ INSTALLED_APPS.extend([ 'image_cropping', ]) - -LOGIN_REDIRECT_URL = 'portal:overview' +LOGIN_REDIRECT_URL = 'login_redirect' MIDDLEWARE_CLASSES.extend([ # add your own middlewares here @@ -92,7 +91,18 @@ CMS_PLACEHOLDER_CONF = { 'plugins': ['TimetablePlugin'], }, 'social_media': { + 'name': 'Social Media', 'plugins': ['SocialMediaListPlugin'], + 'limits': { + 'global': 1, + }, + }, + 'portal_intro': { + 'name': 'Portal Intro', + 'plugins': ['IntroImagePlugin'], + 'limits': { + 'global': 1, + }, }, } diff --git a/src/portal/cms_apps.py b/src/portal/cms_apps.py new file mode 100644 index 0000000..5ef4747 --- /dev/null +++ b/src/portal/cms_apps.py @@ -0,0 +1,11 @@ +from cms.app_base import CMSApp +from cms.apphook_pool import apphook_pool + + +@apphook_pool.register +class PortalApphook(CMSApp): + name = 'Portal' + app_name = 'portal' + + def get_urls(self, page=None, language=None, **kwargs): + return ['portal.urls'] diff --git a/src/portal/templates/portal/overview.html b/src/portal/templates/portal/overview.html index b701947..09870c8 100644 --- a/src/portal/templates/portal/overview.html +++ b/src/portal/templates/portal/overview.html @@ -1,5 +1,5 @@ {% extends 'main.html' %} -{% load i18n static %} +{% load i18n static cms_tags %} {% block title %}{% trans 'Mitgliederbereich' %}{% endblock %} @@ -14,8 +14,7 @@ {% trans 'Logout' %} -
+ {% static_placeholder 'portal_intro' %}
@@ -88,10 +87,12 @@ {% endfor %}
+ {% trans 'Einstellungen' as settings_section_title %} + {% include 'project/plugins/content/section_title.html' with section_title=settings_section_title %}
-
+

{% trans 'Downloads' %}

@@ -110,6 +111,8 @@ {% include 'project/plugins/content/download_section.html' with instance=section %}
{% endfor %} + {% trans 'Downloads' as downloads_section_title %} + {% include 'project/plugins/content/section_title.html' with section_title=downloads_section_title %}
diff --git a/src/project/cms_plugins.py b/src/project/cms_plugins.py index d888278..53473aa 100644 --- a/src/project/cms_plugins.py +++ b/src/project/cms_plugins.py @@ -12,7 +12,7 @@ from mailchimp3 import MailChimp 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 + TimetableItem, Partner, HighlightList, Image, TitleListItem, TitleList, IntroImage @plugin_pool.register_plugin @@ -37,6 +37,14 @@ class SectionTitlePlugin(CMSPluginBase): render_template = 'project/plugins/content/section_title.html' +@plugin_pool.register_plugin +class IntroImagePlugin(CMSPluginBase): + model = IntroImage + module = 'Intro' + name = 'Intro Image' + render_template = 'project/plugins/content/intro_image.html' + + plugin_pool.unregister_plugin(_TextPlugin) diff --git a/src/project/migrations/0006_introimage.py b/src/project/migrations/0006_introimage.py new file mode 100644 index 0000000..68e3cf6 --- /dev/null +++ b/src/project/migrations/0006_introimage.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-03-23 10:12 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import image_cropping.fields +import project.utils + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.FILER_IMAGE_MODEL), + ('cms', '0018_pagenode'), + ('project', '0005_auto_20180322_1612'), + ] + + operations = [ + migrations.CreateModel( + name='IntroImage', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='project_introimage', serialize=False, to='cms.CMSPlugin')), + ('cropping', image_cropping.fields.ImageRatioField('image', '1000x1000', adapt_rotation=False, allow_fullsize=False, free_crop=True, help_text=None, hide_image_field=False, size_warning=False, verbose_name='cropping')), + ('image', project.utils.CroppableFilerImageField(on_delete=django.db.models.deletion.CASCADE, to=settings.FILER_IMAGE_MODEL, verbose_name='Bild')), + ], + options={ + 'abstract': False, + 'verbose_name_plural': 'intro Bilder', + 'verbose_name': 'Intro Bild', + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/src/project/models.py b/src/project/models.py index 15f8319..2b2fa3d 100644 --- a/src/project/models.py +++ b/src/project/models.py @@ -42,6 +42,15 @@ class SectionText(CMSPlugin): verbose_name_plural = 'Section Texts' +class IntroImage(CMSPlugin): + image = CroppableFilerImageField(verbose_name='Bild') + cropping = ImageRatioField('image', '1000x1000', free_crop=True) + + class Meta(CMSPlugin.Meta): + verbose_name = 'Intro Bild' + verbose_name_plural = 'intro Bilder' + + class Video(CMSPlugin): vimeo_id = models.IntegerField(verbose_name='Vimeo ID', help_text='e.g. https://vimeo.com/131766159') thumbnail = CroppableFilerImageField(verbose_name='Vorschaubild') diff --git a/src/project/templates/main.html b/src/project/templates/main.html index 5d9cad4..e68e274 100644 --- a/src/project/templates/main.html +++ b/src/project/templates/main.html @@ -121,12 +121,16 @@