diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 73708a8bb..50a40c1bc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -28,8 +28,9 @@ Changelog * Bare text entered in rich text areas is now automatically wrapped in a paragraph element * Added pagination to the snippets listing and chooser (Martin Sanders) * Page / document / image / snippet choosers now include a link to edit the chosen item - * Fix: The `document_served` signal now correctly passes the Document class as `sender` and the document as `instance` - * Fix: Image edit page no longer throws OSError when the original image is missing + * The `document_served` signal now correctly passes the Document class as `sender` and the document as `instance` + * Image/Document edit page no longer throws OSError when the original image is missing + * Page classes can specify an edit_handler property to override the default Content / Promote / Settings tabbed interface 0.8.5 (17.02.2015) ~~~~~~~~~~~~~~~~~~ diff --git a/docs/releases/0.9.rst b/docs/releases/0.9.rst index 03b46d6c9..1a526d305 100644 --- a/docs/releases/0.9.rst +++ b/docs/releases/0.9.rst @@ -49,6 +49,7 @@ Admin * ``FieldPanel`` now accepts an optional ``widget`` parameter to override the field's default form widget * Page model fields without a ``FieldPanel`` are no longer displayed in the form * No longer need to specify the base model on ``InlinePanel`` definitions + * Page classes can specify an edit_handler property to override the default Content / Promote / Settings tabbed interface **Other admin changes** @@ -157,3 +158,32 @@ Previously, the forms for creating and editing images followed Django's default has_legal_approval = models.BooleanField() admin_form_fields = Image.admin_form_fields + ['photographer'] + +Customising the tabbed interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Wagtail organises panels into three tabs: 'Content', 'Promote' and 'Settings'. Depending on the requirements of your site, you may wish to customise this for specific page types - for example, adding an additional tab for sidebar content. This can be done by specifying an ``edit_handler`` property on the page model. For example: + +.. code-block:: python + + from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList + + class BlogPage(Page): + # field definitions omitted + + BlogPage.content_panels = [ + FieldPanel('title', classname="full title"), + FieldPanel('date'), + FieldPanel('body', classname="full"), + ] + BlogPage.sidebar_content_panels = [ + SnippetChooserPanel('advert', Advert), + InlinePanel('related_links', label="Related links"), + ] + + BlogPage.edit_handler = TabbedInterface([ + ObjectList(BlogPage.content_panels, heading='Content'), + ObjectList(BlogPage.sidebar_content_panels, heading='Sidebar content'), + ObjectList(BlogPage.promote_panels, heading='Promote'), + ObjectList(BlogPage.settings_panels, heading='Settings', classname="settings"), + ])