Fixes 74 editing bar overlaps text, slight refactoring

This commit is contained in:
Oleg Lavrovsky 2017-05-09 12:45:02 +02:00
parent bda083cc2d
commit cb64d0c59e

View file

@ -5,7 +5,7 @@ from __future__ import unicode_literals
from django.db import models from django.db import models
from modelcluster.fields import ParentalKey from modelcluster.fields import ParentalKey
from wagtail.wagtailcore import blocks from wagtail.wagtailcore.blocks import StructBlock, CharBlock, URLBlock, RichTextBlock
from wagtail.wagtailcore.models import Page, Orderable from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.fields import StreamField, RichTextField from wagtail.wagtailcore.fields import StreamField, RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel, MultiFieldPanel from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel, MultiFieldPanel
@ -17,12 +17,12 @@ from puput.models import EntryPage
from ..util import TranslatedField from ..util import TranslatedField
class InfoBlock(blocks.StructBlock): class InfoBlock(StructBlock):
title = blocks.CharBlock(required=True) title = CharBlock(required=True)
photo = ImageChooserBlock(required=True) photo = ImageChooserBlock(required=True)
summary = blocks.RichTextBlock(required=True) summary = RichTextBlock(required=True)
action = blocks.CharBlock(required=False) action = CharBlock(required=False)
url = blocks.URLBlock(required=False) url = URLBlock(required=False)
class ArticleIndexPage(Page): class ArticleIndexPage(Page):
title_fr = models.CharField(max_length=255, default="") title_fr = models.CharField(max_length=255, default="")
@ -83,15 +83,15 @@ class ArticlePage(Page):
) )
body_de = StreamField([ body_de = StreamField([
('paragraph', blocks.RichTextBlock()), ('paragraph', RichTextBlock()),
('image', ImageChooserBlock()), ('image', ImageChooserBlock()),
('section', blocks.CharBlock(classname="full title")), ('section', CharBlock(classname="full title")),
('info', InfoBlock()), ('info', InfoBlock()),
], null=True, blank=True) ], null=True, blank=True)
body_fr = StreamField([ body_fr = StreamField([
('paragraph', blocks.RichTextBlock()), ('paragraph', RichTextBlock()),
('image', ImageChooserBlock()), ('image', ImageChooserBlock()),
('section', blocks.CharBlock(classname="full title")), ('section', CharBlock(classname="full title")),
('info', InfoBlock()), ('info', InfoBlock()),
], null=True, blank=True) ], null=True, blank=True)
trans_body = TranslatedField( trans_body = TranslatedField(
@ -123,14 +123,16 @@ class ArticlePage(Page):
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('title'), FieldPanel('title'),
FieldPanel('intro_de'), FieldPanel('intro_de'),
StreamFieldPanel('body_de'),
], heading="Deutsch"), ], heading="Deutsch"),
StreamFieldPanel('body_de'),
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('title_fr'), FieldPanel('title_fr'),
FieldPanel('intro_fr'), FieldPanel('intro_fr'),
StreamFieldPanel('body_fr'),
], heading="Français"), ], heading="Français"),
ImageChooserPanel('feed_image'), StreamFieldPanel('body_fr'),
MultiFieldPanel([
ImageChooserPanel('feed_image'),
], heading="Images"),
] ]
promote_panels = [ promote_panels = [
InlinePanel('related_links', label="Links"), InlinePanel('related_links', label="Links"),
@ -186,7 +188,7 @@ class HomePage(Page):
FieldPanel('body_de', classname="full"), FieldPanel('body_de', classname="full"),
StreamFieldPanel('infos_de'), StreamFieldPanel('infos_de'),
], heading="Deutsch"), ], heading="Deutsch"),
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('intro_fr', classname="full"), FieldPanel('intro_fr', classname="full"),
FieldPanel('body_fr', classname="full"), FieldPanel('body_fr', classname="full"),
StreamFieldPanel('infos_fr'), StreamFieldPanel('infos_fr'),