standalone
Simon Caminada 8 years ago
parent d7a082c0c7
commit 0bed73158f

Binary file not shown.

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-27 12:11-0500\n"
"POT-Creation-Date: 2018-06-07 11:18-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,30 +18,39 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/portal/models.py:20 src/project/forms.py:10
#: src/portal/models.py:19 src/project/forms.py:10
msgid "Vorname"
msgstr ""
#: src/portal/models.py:21 src/project/forms.py:11
#: src/portal/models.py:20 src/project/forms.py:11
msgid "Nachname"
msgstr ""
#: src/portal/models.py:22
#: src/portal/models.py:21
msgid "Strasse"
msgstr ""
#: src/portal/models.py:23
#: src/portal/models.py:22
msgid "PLZ"
msgstr ""
#: src/portal/models.py:24
#: src/portal/models.py:23
msgid "Ort"
msgstr ""
#: src/portal/models.py:25 src/project/forms.py:16 src/project/forms.py:17
#: src/portal/models.py:24 src/project/forms.py:16 src/project/forms.py:17
msgid "E-Mail"
msgstr ""
#: src/portal/templates/portal/content.html:12
#: src/portal/templates/portal/content.html:34
msgid "Zurück zur Übersicht"
msgstr ""
#: src/portal/templates/portal/content.html:39
msgid "Als gelesen markieren"
msgstr ""
#: src/portal/templates/portal/edit_form.html:11
msgid "Speichern"
msgstr ""
@ -54,15 +63,6 @@ msgstr ""
msgid "Schliessen"
msgstr ""
#: src/portal/templates/portal/information.html:12
#: src/portal/templates/portal/information.html:34
msgid "Zurück zur Übersicht"
msgstr ""
#: src/portal/templates/portal/information.html:39
msgid "Als gelesen markieren"
msgstr ""
#: src/portal/templates/portal/overview.html:4
msgid "Elementa Portal"
msgstr ""
@ -80,7 +80,7 @@ msgid "Logout"
msgstr ""
#: src/portal/templates/portal/overview.html:24
#: src/project/templates/main.html:93
#: src/project/templates/project/includes/meta_navigation.html:56
msgid "Aktuell"
msgstr ""
@ -102,19 +102,26 @@ msgid "Abbrechen"
msgstr ""
#: src/portal/templates/portal/overview.html:96
#: src/portal/templates/portal/overview.html:114
msgid "Downloads"
#: src/portal/templates/portal/overview.html:131
msgid "Informationen"
msgstr ""
#: src/portal/templates/portal/overview.html:102
#: src/portal/templates/portal/overview.html:103
#: src/portal/templates/portal/overview.html:142
msgid "Suchbegriff eingeben"
msgstr ""
#: src/portal/templates/portal/overview.html:103
#: src/portal/templates/portal/overview.html:104
#: src/portal/templates/portal/overview.html:143
#: src/project/templates/project/includes/search_form.html:14
msgid "Suchen"
msgstr ""
#: src/portal/templates/portal/overview.html:136
#: src/portal/templates/portal/overview.html:154
msgid "Downloads"
msgstr ""
#: src/portal/templates/registration/login.html:4
#: src/project/templates/project/includes/header_button_menu.html:13
msgid "Eltern-Login"
@ -150,18 +157,22 @@ msgid "^account/edit/profile/success/$"
msgstr ""
#: src/portal/urls.py:33
msgid "^information/(?P<pk>\\d+)/$"
msgid "^announcement/(?P<pk>\\d+)/$"
msgstr ""
#: src/portal/urls.py:36
msgid "^information/(?P<pk>\\d+)/$"
msgstr ""
#: src/portal/urls.py:40
msgid "^$"
msgstr ""
#: src/portal/views.py:51
#: src/portal/views.py:68
msgid "Benutzerdaten"
msgstr ""
#: src/portal/views.py:52
#: src/portal/views.py:69
msgid "Passwort"
msgstr ""
@ -219,28 +230,53 @@ msgstr ""
msgid "Suche"
msgstr ""
#: src/project/templates/main.html:104
#: src/project/templates/main.html:94
msgid "Menü"
msgstr ""
#: src/project/templates/main.html:128
#: src/project/templates/main.html:118
#: src/project/templates/project/includes/navigation.html:13
#: src/project/templates/project/plugins/content/contact_form_button.html:5
msgid "Kontakt aufnehmen"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:12
#: src/project/templates/main.html:142
msgid "Schliessen (Esc)"
msgstr ""
#: src/project/templates/main.html:143
msgid "Bild herunterladen"
msgstr ""
#: src/project/templates/main.html:144
msgid "Vollbildmodus ein/aus"
msgstr ""
#: src/project/templates/main.html:145
msgid "rein/raus zoomen"
msgstr ""
#: src/project/templates/main.html:158
msgid "Vorheriges Foto (linke Pfeiltaste)"
msgstr ""
#: src/project/templates/main.html:161
msgid "Nächstes Foto (rechte Pfeiltaste)"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:13
msgid "One Day"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:23
#: src/project/templates/project/includes/meta_navigation.html:25
msgid "News"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:34
#: src/project/templates/project/includes/meta_navigation.html:37
msgid "Kalender"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:42
#: src/project/templates/project/includes/meta_navigation.html:46
msgid "Standort & Kontakt"
msgstr ""

Binary file not shown.

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-27 12:11-0500\n"
"POT-Creation-Date: 2018-06-07 11:18-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,30 +17,39 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/portal/models.py:20 src/project/forms.py:10
#: src/portal/models.py:19 src/project/forms.py:10
msgid "Vorname"
msgstr "First Name"
#: src/portal/models.py:21 src/project/forms.py:11
#: src/portal/models.py:20 src/project/forms.py:11
msgid "Nachname"
msgstr "Last Name"
#: src/portal/models.py:22
#: src/portal/models.py:21
msgid "Strasse"
msgstr "Street"
#: src/portal/models.py:23
#: src/portal/models.py:22
msgid "PLZ"
msgstr "ZIP"
#: src/portal/models.py:24
#: src/portal/models.py:23
msgid "Ort"
msgstr "Place"
#: src/portal/models.py:25 src/project/forms.py:16 src/project/forms.py:17
#: src/portal/models.py:24 src/project/forms.py:16 src/project/forms.py:17
msgid "E-Mail"
msgstr ""
#: src/portal/templates/portal/content.html:12
#: src/portal/templates/portal/content.html:34
msgid "Zurück zur Übersicht"
msgstr "Back to the overview"
#: src/portal/templates/portal/content.html:39
msgid "Als gelesen markieren"
msgstr "Mark as read"
#: src/portal/templates/portal/edit_form.html:11
msgid "Speichern"
msgstr "Save"
@ -53,15 +62,6 @@ msgstr "Your information has been successfully altered."
msgid "Schliessen"
msgstr "Close"
#: src/portal/templates/portal/information.html:12
#: src/portal/templates/portal/information.html:34
msgid "Zurück zur Übersicht"
msgstr "Back to the overview"
#: src/portal/templates/portal/information.html:39
msgid "Als gelesen markieren"
msgstr "Mark as read"
#: src/portal/templates/portal/overview.html:4
msgid "Elementa Portal"
msgstr ""
@ -79,9 +79,9 @@ msgid "Logout"
msgstr ""
#: src/portal/templates/portal/overview.html:24
#: src/project/templates/main.html:93
#: src/project/templates/project/includes/meta_navigation.html:56
msgid "Aktuell"
msgstr "News"
msgstr "Topical"
#: src/portal/templates/portal/overview.html:55
msgid "Ältere laden"
@ -101,19 +101,26 @@ msgid "Abbrechen"
msgstr "Abort"
#: src/portal/templates/portal/overview.html:96
#: src/portal/templates/portal/overview.html:114
msgid "Downloads"
msgstr ""
#: src/portal/templates/portal/overview.html:131
msgid "Informationen"
msgstr "Informations"
#: src/portal/templates/portal/overview.html:102
#: src/portal/templates/portal/overview.html:103
#: src/portal/templates/portal/overview.html:142
msgid "Suchbegriff eingeben"
msgstr "Enter search term"
#: src/portal/templates/portal/overview.html:103
#: src/portal/templates/portal/overview.html:104
#: src/portal/templates/portal/overview.html:143
#: src/project/templates/project/includes/search_form.html:14
msgid "Suchen"
msgstr "Search"
#: src/portal/templates/portal/overview.html:136
#: src/portal/templates/portal/overview.html:154
msgid "Downloads"
msgstr ""
#: src/portal/templates/registration/login.html:4
#: src/project/templates/project/includes/header_button_menu.html:13
msgid "Eltern-Login"
@ -149,18 +156,22 @@ msgid "^account/edit/profile/success/$"
msgstr ""
#: src/portal/urls.py:33
msgid "^information/(?P<pk>\\d+)/$"
msgid "^announcement/(?P<pk>\\d+)/$"
msgstr ""
#: src/portal/urls.py:36
msgid "^information/(?P<pk>\\d+)/$"
msgstr ""
#: src/portal/urls.py:40
msgid "^$"
msgstr ""
#: src/portal/views.py:51
#: src/portal/views.py:68
msgid "Benutzerdaten"
msgstr "User details"
#: src/portal/views.py:52
#: src/portal/views.py:69
msgid "Passwort"
msgstr "Password"
@ -218,28 +229,54 @@ msgstr "Strengthen strengths. Learn to learn."
msgid "Suche"
msgstr "Search"
#: src/project/templates/main.html:104
#: src/project/templates/main.html:94
msgid "Menü"
msgstr "Menu"
#: src/project/templates/main.html:128
#: src/project/templates/main.html:118
#: src/project/templates/project/includes/navigation.html:13
#: src/project/templates/project/plugins/content/contact_form_button.html:5
msgid "Kontakt aufnehmen"
msgstr "Get in touch"
#: src/project/templates/project/includes/meta_navigation.html:12
#: src/project/templates/main.html:142
#| msgid "Schliessen"
msgid "Schliessen (Esc)"
msgstr "Close (Esc)"
#: src/project/templates/main.html:143
msgid "Bild herunterladen"
msgstr "Download Image"
#: src/project/templates/main.html:144
msgid "Vollbildmodus ein/aus"
msgstr "Fullscreen on/off"
#: src/project/templates/main.html:145
msgid "rein/raus zoomen"
msgstr "zoom in/out"
#: src/project/templates/main.html:158
msgid "Vorheriges Foto (linke Pfeiltaste)"
msgstr "Previous Image (left arrow key)"
#: src/project/templates/main.html:161
msgid "Nächstes Foto (rechte Pfeiltaste)"
msgstr "Next Image (right arrow key)"
#: src/project/templates/project/includes/meta_navigation.html:13
msgid "One Day"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:23
#: src/project/templates/project/includes/meta_navigation.html:25
msgid "News"
msgstr ""
#: src/project/templates/project/includes/meta_navigation.html:34
#: src/project/templates/project/includes/meta_navigation.html:37
msgid "Kalender"
msgstr "Calendar"
#: src/project/templates/project/includes/meta_navigation.html:42
#: src/project/templates/project/includes/meta_navigation.html:46
msgid "Standort & Kontakt"
msgstr "Location & Contact"

@ -107,6 +107,7 @@ $(function() {
}
function close_navigation() {
$body.removeClass('notification_open');
$navigation.removeAttr('style');
var $navigation_main = $navigation.find('.navigation__main');
$body.removeClass('navigation_open');

@ -10,6 +10,8 @@ $black: #000000;
$green: #98C53A;
$facebook_blue: #29487d;
$violet: rgba(149, 72, 200, 0.66);
$red: rgba(200, 0, 0, 0.66);
$blue: rgba(65, 93, 200, 0.66);

@ -232,6 +232,9 @@
.search_open &, .navigation_open & {
transform: translateY(em(-50px));
}
&.active {
color: $green;
}
@media screen and (max-width: $small_breakpoint) {
padding: 0 em(54px) 0 em(12px);
&.header__button--reverse {

@ -305,6 +305,9 @@
width: 100%;
margin-top: em(20px);
li {
&.selected {
color: $green;
}
a {
font-size: em(28px);
text-decoration: none;

@ -10,6 +10,7 @@
text-decoration: none;
padding-left: 50%;
position: relative;
background: $white;
transition: border-color 0.2s ease-in-out;
&:hover {
border-color: $green;

@ -86,6 +86,16 @@
font-size: em(14px);
}
.button--white {
background: $white;
color: $green;
.button__icon {
svg {
fill: $green;
}
}
}
.button--ghost {
background: none;
color: $green;

@ -33,7 +33,7 @@
margin: em(50px) 0;
}
.social_media__item {
background: $green;
background: $facebook_blue;
color: $white;
}
}

@ -151,7 +151,7 @@ $timetable_count: 15;
}
}
.timetable__clock__digital__intro {
.timetable__clock__digital__intro, .timetable__clock__digital__outro {
position: absolute;
bottom: 100%;
left: 20%;
@ -169,6 +169,11 @@ $timetable_count: 15;
}
}
.timetable__clock__digital__outro {
top: 100%;
bottom: auto;
}
#timetable__clock__digital__time span {
display: inline-block;
position: relative;
@ -235,23 +240,6 @@ $timetable_count: 15;
transform: translateX(100%);
}
@keyframes point {
0% {
transform: translate(0, 0);
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
transform: translate(0, em(20px));
opacity: 0;
}
}
.timetable__next {
position: fixed;
bottom: 0;
@ -260,49 +248,17 @@ $timetable_count: 15;
text-decoration: none;
color: $green;
text-align: center;
height: em(60px);
height: em(100px);
z-index: 10;
opacity: 0;
-webkit-tap-highlight-color: transparent;
transition: opacity 2s $reveal_timing_function, color 0s 1s !important;
span {
display: block;
position: absolute;
left: 50%;
bottom: em(40px);
margin-left: em(-15px);
width: em(30px);
height: em(50px);
border: em(2.5px) solid $green;
border-radius: em(50px);
transition: border 0s 1s;
&:before {
content: '';
position: absolute;
top: em(10px);
left: 50%;
width: em(6px);
height: em(6px);
margin-left: em(-3px);
background: $green;
border-radius: 50%;
display: block;
animation: point 2s infinite;
transition: background 0s 1s;
}
#timetable[data-active="0"] & {
border-color: $white;
&:before {
background: $white;
}
}
}
&.hidden {
opacity: 0;
pointer-events: none;
}
#timetable[data-active="0"] & {
color: $black;
color: $white;
opacity: 1;
&:before {
opacity: 1;
@ -313,6 +269,46 @@ $timetable_count: 15;
}
}
@keyframes opacity {
0% {
opacity: 0.2;
}
30% {
opacity: 1;
}
60% {
opacity: 0.2;
}
100% {
opacity: 0.2;
}
}
.timetable__next__icon {
display: block;
margin: em(15px) auto;
width: em(25px);
span {
display: block;
width: em(25px);
height: em(25px);
margin-top: em(-12px);
border-right: 2px solid currentColor;
border-bottom: 2px solid currentColor;
transform: rotate(45deg);
animation: opacity 1.2s infinite ease-in-out;
&.data_id_1 {
animation-delay: 0.2s;
}
&.data_id_2 {
animation-delay: 0.4s;
}
}
#timetable[data-active="0"] & {
color: $white;
}
}
.timetable__intro__placeholder {
width: 100%;
height: 50%;

@ -89,7 +89,7 @@ CMS_PLACEHOLDER_CONF = {
'plugins': ['SectionPlugin'],
},
'contact': {
'plugins': ['SectionTextPlugin', 'JourneyCalculatorPlugin'],
'plugins': ['SectionTextPlugin', 'ContactFormButtonPlugin', 'JourneyCalculatorPlugin'],
},
'timetable': {
'plugins': ['TimetablePlugin'],

@ -255,6 +255,14 @@ class SubPageListPlugin(CMSPluginBase):
render_template = 'project/plugins/content/subpage_list.html'
@plugin_pool.register_plugin
class ContactFormButtonPlugin(CMSPluginBase):
model = CMSPlugin
module = 'Content'
name = 'Contact Form Button'
render_template = 'project/plugins/content/contact_form_button.html'
@plugin_pool.register_plugin
class PartnerPlugin(CMSPluginBase):
model = Partner

@ -1,5 +1,7 @@
from cms.models import Page
from cms.utils.page import _page_is_published
from haystack.forms import ModelSearchForm
from parler.utils.i18n import get_language
from project.models import Notification
@ -22,8 +24,12 @@ def new_page_amount(request):
try:
page = Page.objects.public().get(reverse_id=tracked_page)
id = 'new_{}_amount'.format(tracked_page)
amount = 0
for page in page.get_child_pages():
if page.is_published(get_language()) and _page_is_published(page):
amount = amount + 1
context.update({
id: page.get_child_pages().count()
id: amount
})
except Page.DoesNotExist:
pass

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-06-07 08:10
from __future__ import unicode_literals
from django.db import migrations
import djangocms_text_ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('project', '0007_gallery'),
]
operations = [
migrations.AddField(
model_name='timetable',
name='cta',
field=djangocms_text_ckeditor.fields.HTMLField(blank=True, null=True, verbose_name='CTA'),
),
migrations.AddField(
model_name='timetable',
name='outro',
field=djangocms_text_ckeditor.fields.HTMLField(blank=True, null=True, verbose_name='Schluss'),
),
]

@ -262,7 +262,9 @@ class SocialMediaListItem(models.Model):
class Timetable(CMSPlugin):
start_image = CroppableFilerImageField(verbose_name='Startbild')
cropping = ImageRatioField('start_image', '1000x1000', free_crop=True)
introduction = HTMLField(verbose_name='Einleitung', configuration='CKEDITOR_SETTINGS_INPUT')
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)
class Meta(CMSPlugin.Meta):
verbose_name = 'Timetable'

@ -9,7 +9,6 @@
<div class="contact__content__main reveal reveal_animation data_delay_3">
<h1>{% page_attribute 'page_title' %}</h1>
{% placeholder 'contact' %}
{% static_placeholder 'social_media' %}
</div>
<div class="contact__content__backdrop reveal reveal_animation data_delay_5"></div>
</div>

@ -5,7 +5,8 @@
{% page_url 'calendar' as calendar_url %}
{% page_url 'contact' as contact_url %}
{% if oneday_url %}
<a href="{{ oneday_url }}" class="header__button header__button--reverse header__button--light data_id_0">
<a href="{{ oneday_url }}" class="header__button header__button--reverse header__button--light data_id_0
{% if oneday_url == request.path %}active{% endif %}">
<span class="header__button__icon">
{% include 'project/assets/oneday.svg' %}
</span>
@ -13,7 +14,8 @@
</a>
{% endif %}
{% if news_url %}
<a href="{{ news_url }}" class="header__button header__button--reverse header__button--light data_id_1">
<a href="{{ news_url }}" class="header__button header__button--reverse header__button--light data_id_1
{% if news_url == request.path %}active{% endif %}">
<span class="header__button__icon">
{% if new_news_amount %}
<span class="header__button__icon__number">{{ new_news_amount }}</span>
@ -24,7 +26,8 @@
</a>
{% endif %}
{% if calendar_url %}
<a href="{{ calendar_url }}" class="header__button header__button--reverse header__button--light data_id_2">
<a href="{{ calendar_url }}" class="header__button header__button--reverse header__button--light data_id_2
{% if calendar_url == request.path %}active{% endif %}">
<span class="header__button__icon">
{% if new_calendar_amount %}
<span class="header__button__icon__number">{{ new_calendar_amount }}</span>
@ -35,7 +38,8 @@
</a>
{% endif %}
{% if contact_url %}
<a href="{{ contact_url }}" class="header__button header__button--reverse header__button--light data_id_3">
<a href="{{ contact_url }}" class="header__button header__button--reverse header__button--light data_id_3
{% if contact_url == request.path %}active{% endif %}">
<span class="header__button__icon">
{% include 'project/assets/contact.svg' %}
</span>
@ -43,12 +47,12 @@
</a>
{% endif %}
{% if notification %}
<a href="#"
<a href="#" data-updated="{{ notification.updated }}"
class="header__button header__button--notification header__button--reverse header__button--light data_id_4">
<span class="header__button__icon">
<span class="header__button__icon__number">1</span>
{% include 'project/assets/bell.svg' %}
</span>
{% trans 'Atkuell' %}
{% trans 'Aktuell' %}
</a>
{% endif %}

@ -0,0 +1,9 @@
{% load i18n cms_tags %}
{% page_url 'cta' as cta_url %}
{% if cta_url %}
<a href="{{ cta_url }}" class="button button--white">
<span class="button__icon">{% include 'project/assets/arrow-right-long.svg' %}</span>
<span class="button__text">{% trans 'Kontakt aufnehmen' %}</span>
</a>
{% endif %}

@ -1,7 +1,9 @@
{% load util_tags %}
<div class="subpage_list">
<ul>
{% for page in request.current_page.get_child_pages %}
{% if page.get_public_url %}
{% if page|page_published %}
{% include "project/includes/page_item.html" with image=page.imageextension.image cropping=page.imageextension.cropping index=forloop.counter0 subpage=True %}
{% endif %}
{% endfor %}

@ -17,6 +17,9 @@
<span>:</span>
{{ instance.child_plugin_instances.0.time|time:'i' }}
</div>
{% if instance.outro %}
<span class="timetable__clock__digital__outro">{{ instance.outro }}</span>
{% endif %}
</div>
</div>
</div>
@ -26,7 +29,12 @@
<div class="timetable__start__door timetable__start__door--right"></div>
<a href="#" class="timetable__next reveal reveal_animation data_delay_23">
<span></span>
{% if instance.cta %}{{ instance.cta }}{% endif %}
<span class="timetable__next__icon">
<span class="data_id_0"></span>
<span class="data_id_1"></span>
<span class="data_id_2"></span>
</span>
</a>
{% thumbnail instance.start_image 2110x1200 box=instance.cropping crop detail as thumb %}

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from cms.models import Page
from cms.utils.page import _page_is_published
from django import template
from parler.utils.i18n import get_language
register = template.Library()
@ -13,6 +15,11 @@ def page_image(id):
return None
@register.filter
def page_published(page):
return page.is_published(get_language()) and _page_is_published(page)
@register.filter
def page_image_cropping(id):
try:

@ -0,0 +1,232 @@
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @fileOverview The Auto Grow plugin.
*/
'use strict';
( function() {
CKEDITOR.plugins.add( 'autogrow', {
init: function( editor ) {
// This feature is available only for themed ui instance.
if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
return;
editor.on( 'instanceReady', function() {
// Simply set auto height with div wysiwyg.
if ( editor.editable().isInline() )
editor.ui.space( 'contents' ).setStyle( 'height', 'auto' );
// For classic (`iframe`-based) wysiwyg we need to resize the editor.
else
initIframeAutogrow( editor );
} );
}
} );
function initIframeAutogrow( editor ) {
var lastHeight,
doc,
markerContainer,
scrollable,
marker,
configBottomSpace = editor.config.autoGrow_bottomSpace || 0,
configMinHeight = editor.config.autoGrow_minHeight !== undefined ? editor.config.autoGrow_minHeight : 200,
configMaxHeight = editor.config.autoGrow_maxHeight || Infinity,
maxHeightIsUnlimited = !editor.config.autoGrow_maxHeight;
editor.addCommand( 'autogrow', {
exec: resizeEditor,
modes: { wysiwyg: 1 },
readOnly: 1,
canUndo: false,
editorFocus: false
} );
var eventsList = { contentDom: 1, key: 1, selectionChange: 1, insertElement: 1, mode: 1 };
for ( var eventName in eventsList ) {
editor.on( eventName, function( evt ) {
// Some time is required for insertHtml, and it gives other events better performance as well.
if ( evt.editor.mode == 'wysiwyg' ) {
setTimeout( function() {
if ( isNotResizable() ) {
lastHeight = null;
return;
}
resizeEditor();
// Second pass to make correction upon the first resize, e.g. scrollbar.
// If height is unlimited vertical scrollbar was removed in the first
// resizeEditor() call, so we don't need the second pass.
if ( !maxHeightIsUnlimited )
resizeEditor();
}, 100 );
}
} );
}
// Coordinate with the "maximize" plugin. (https://dev.ckeditor.com/ticket/9311)
editor.on( 'afterCommandExec', function( evt ) {
if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
if ( evt.data.command.state == CKEDITOR.TRISTATE_ON )
scrollable.removeStyle( 'overflow-y' );
else
resizeEditor();
}
} );
editor.on( 'contentDom', refreshCache );
refreshCache();
if ( editor.config.autoGrow_onStartup && editor.editable().isVisible() ) {
editor.execCommand( 'autogrow' );
}
function refreshCache() {
doc = editor.document;
markerContainer = doc[ CKEDITOR.env.ie ? 'getBody' : 'getDocumentElement' ]();
// Quirks mode overflows body, standards overflows document element.
scrollable = CKEDITOR.env.quirks ? doc.getBody() : doc.getDocumentElement();
// Reset scrollable body height and min-height css values.
// While set by outside code it may break resizing. (https://dev.ckeditor.com/ticket/14620)
var body = CKEDITOR.env.quirks ? scrollable : scrollable.findOne( 'body' );
if ( body ) {
body.setStyle( 'height', 'auto' );
body.setStyle( 'min-height', CKEDITOR.env.safari ? '0%' : 'auto' ); // Safari does not support 'min-height: auto'.
}
marker = CKEDITOR.dom.element.createFromHtml(
'<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">' +
( CKEDITOR.env.webkit ? '&nbsp;' : '' ) +
'</span>',
doc );
}
function isNotResizable() {
var maximizeCommand = editor.getCommand( 'maximize' );
return (
!editor.window ||
// Disable autogrow when the editor is maximized. (https://dev.ckeditor.com/ticket/6339)
maximizeCommand && maximizeCommand.state == CKEDITOR.TRISTATE_ON
);
}
// Actual content height, figured out by appending check the last element's document position.
function contentHeight() {
// Append a temporary marker element.
markerContainer.append( marker );
var height = marker.getDocumentPosition( doc ).y + marker.$.offsetHeight;
marker.remove();
return height;
}
function resizeEditor() {
// Hide scroll because we won't need it at all.
// Thanks to that we'll need only one resizeEditor() call per change.
if ( maxHeightIsUnlimited )
scrollable.setStyle( 'overflow-y', 'hidden' );
var currentHeight = editor.window.getViewPaneSize().height,
newHeight = contentHeight();
// Additional space specified by user.
newHeight += configBottomSpace;
newHeight = Math.max( newHeight, configMinHeight );
newHeight = Math.min( newHeight, configMaxHeight );
// https://dev.ckeditor.com/ticket/10196 Do not resize editor if new height is equal
// to the one set by previous resizeEditor() call.
if ( newHeight != currentHeight && lastHeight != newHeight ) {
newHeight = editor.fire( 'autoGrow', { currentHeight: currentHeight, newHeight: newHeight } ).newHeight;
editor.resize( editor.container.getStyle( 'width' ), newHeight, true );
lastHeight = newHeight;
}
if ( !maxHeightIsUnlimited ) {
if ( newHeight < configMaxHeight && scrollable.$.scrollHeight > scrollable.$.clientHeight )
scrollable.setStyle( 'overflow-y', 'hidden' );
else
scrollable.removeStyle( 'overflow-y' );
}
}
}
} )();
/**
* The minimum height that the editor can assume when adjusting to content by using the Auto Grow
* feature. This option accepts a value in pixels, without the unit (for example: `300`).
*
* Read more in the [documentation](#!/guide/dev_autogrow)
* and see the [SDK sample](https://sdk.ckeditor.com/samples/autogrow.html).
*
* config.autoGrow_minHeight = 300;
*
* @since 3.4
* @cfg {Number} [autoGrow_minHeight=200]
* @member CKEDITOR.config
*/
/**
* The maximum height that the editor can assume when adjusting to content by using the Auto Grow
* feature. This option accepts a value in pixels, without the unit (for example: `600`).
* Zero (`0`) means that the maximum height is not limited and the editor will expand infinitely.
*
* Read more in the [documentation](#!/guide/dev_autogrow)
* and see the [SDK sample](https://sdk.ckeditor.com/samples/autogrow.html).
*
* config.autoGrow_maxHeight = 400;
*
* @since 3.4
* @cfg {Number} [autoGrow_maxHeight=0]
* @member CKEDITOR.config
*/
/**
* Whether automatic editor height adjustment brought by the Auto Grow feature should happen on
* editor creation.
*
* Read more in the [documentation](#!/guide/dev_autogrow)
* and see the [SDK sample](https://sdk.ckeditor.com/samples/autogrow.html).
*
* config.autoGrow_onStartup = true;
*
* @since 3.6.2
* @cfg {Boolean} [autoGrow_onStartup=false]
* @member CKEDITOR.config
*/
/**
* Extra vertical space to be added between the content and the editor bottom bar when adjusting
* editor height to content by using the Auto Grow feature. This option accepts a value in pixels,
* without the unit (for example: `50`).
*
* Read more in the [documentation](#!/guide/dev_autogrow)
* and see the [SDK sample](https://sdk.ckeditor.com/samples/autogrow.html).
*
* config.autoGrow_bottomSpace = 50;
*
* @since 3.6.2
* @cfg {Number} [autoGrow_bottomSpace=0]
* @member CKEDITOR.config
*/
/**
* Fired when the Auto Grow plugin is about to change the size of the editor.
*
* @event autogrow
* @member CKEDITOR.editor
* @param {CKEDITOR.editor} editor This editor instance.
* @param data
* @param {Number} data.currentHeight The current editor height (before resizing).
* @param {Number} data.newHeight The new editor height (after resizing). It can be changed
* to achieve a different height value to be used instead.
*/
Loading…
Cancel
Save