Merged in contact-form-1 (pull request #6)

Contact form 1
This commit is contained in:
Oleg Lavrovsky 2017-04-12 11:44:26 +00:00
commit d8a18bfd93
6 changed files with 96 additions and 30 deletions

View file

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-12 10:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0010_auto_20170410_2307'),
]
operations = [
migrations.RenameField(
model_name='contactform',
old_name='intro_de',
new_name='intro',
),
migrations.RenameField(
model_name='contactform',
old_name='intro_fr',
new_name='thanks',
),
migrations.RemoveField(
model_name='contactform',
name='thanks_de',
),
migrations.RemoveField(
model_name='contactform',
name='thanks_fr',
),
migrations.RemoveField(
model_name='contactform',
name='title_fr',
),
migrations.AlterField(
model_name='articlepage',
name='on_homepage',
field=models.BooleanField(default=False, help_text='Auf der Frontpage anzeigen', verbose_name='Featured'),
),
]

View file

@ -19,32 +19,12 @@ class ContactFormField(AbstractFormField):
page = ParentalKey('ContactForm', related_name='form_fields')
class ContactForm(AbstractEmailForm):
title_fr = CharField(max_length=255, default="")
trans_title = TranslatedField(
'title',
'title_fr',
)
intro_de = RichTextField(default='', blank=True)
intro_fr = RichTextField(default='', blank=True)
trans_intro = TranslatedField(
'intro_de',
'intro_fr',
)
thanks_de = RichTextField(default='', blank=True)
thanks_fr = RichTextField(default='', blank=True)
trans_thanks = TranslatedField(
'thanks_de',
'thanks_fr',
)
intro = RichTextField(default='', blank=True)
thanks = RichTextField(default='', blank=True)
content_panels = AbstractEmailForm.content_panels + [
FieldPanel('intro_de', classname="full"),
FieldPanel('thanks_de', classname="full"),
FieldPanel('title_fr', classname="full"),
FieldPanel('intro_fr', classname="full"),
FieldPanel('thanks_fr', classname="full"),
FieldPanel('intro', classname="full"),
FieldPanel('thanks', classname="full"),
InlinePanel('form_fields', label="Form fields"),
MultiFieldPanel([
FieldRowPanel([

View file

@ -7,9 +7,9 @@
<section id="contact-page">
<div class="container">
<h2>{{ page.trans_title }}</h2>
<h2>{{ page.title }}</h2>
<p class="lead">{{ page.trans_intro|richtext }}</p>
<p class="lead">{{ page.intro|richtext }}</p>
<!-- Main content -->
<div class="article-body" role="main">
@ -19,6 +19,14 @@
<button class="btn btn-primary" type="submit">Senden / Envoi</button>
</form>
</div>
<script language="JavaScript">
window.addEventListener('load', function() {
$('span.helptext').each(function() {
$(this).insertBefore( $(this).prev() );
});
});
</script>
</div>
</section>
{% endblock %}

View file

@ -7,10 +7,10 @@
<section id="contact-page">
<div class="container">
<h2>{{ page.trans_title }}</h2>
<h2>{{ page.title }}</h2>
<center>
<p class="lead">{{ page.trans_thanks|richtext }}</p>
<p class="lead">{{ page.thanks|richtext }}</p>
</center>
</div>
</section>

View file

@ -5,7 +5,24 @@
label {
width: 15em;
border-bottom: 1px dashed #ccc;
line-height: 155%;
line-height: 166%;
vertical-align: top;
}
label:only-child {
width: auto;
border: none;
}
&> p label {
font-weight: bold;
}
ul {
list-style: none;
label { width: auto; }
}
.helptext {
margin-bottom: 1em;
display: block;
font-size: 90%;
}
}

View file

@ -8526,7 +8526,26 @@ footer#footer a {
#contact-page form label {
width: 15em;
border-bottom: 1px dashed #ccc;
line-height: 155%;
line-height: 166%;
vertical-align: top;
}
#contact-page form label:only-child {
width: auto;
border: none;
}
#contact-page form > p label {
font-weight: bold;
}
#contact-page form ul {
list-style: none;
}
#contact-page form ul label {
width: auto;
}
#contact-page form .helptext {
margin-bottom: 1em;
display: block;
font-size: 90%;
}
#search-form input {