from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.admin.edit_handlers import TabbedInterface, StreamFieldPanel, ObjectList

from falmer.content.blocks import HeroImageBlock, FalmerImageChooserBlock
from falmer.content.models.core import Page


class GridItem(blocks.StructBlock):
    title = blocks.CharBlock(required=True)
    link = blocks.URLBlock()
    image = FalmerImageChooserBlock()

    class Meta:
        icon = 'item'


class SelectionGridPage(Page):
    parent_page_types = []

    body = StreamField([
        ('heading_hero', HeroImageBlock()),
        ('selection_grid', blocks.ListBlock(GridItem)),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='Content'),
        ObjectList(Page.promote_panels, heading='Promote'),
        ObjectList(Page.settings_panels, heading='Settings', classname="settings"),
    ])

    type_fields = (
        'body',
    )

@@ -25,16 +25,62 @@
  blocks%0A
+from wagtail.core.blocks import RichTextBlock%0A
 from wag
@@ -468,16 +468,64 @@
 rBlock()
+%0A    description = RichTextBlock(required=False)
 %0A%0A    cl
@@ -593,36 +593,8 @@
 e):%0A
-    parent_page_types = %5B%5D%0A%0A
     

Add description to selectiongrid items