From 866b762b7b42870ca82bc2769410df5a4aa92e6c Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 14 May 2015 22:41:35 +0100 Subject: [PATCH] Merge "collapsing multi field panels" into MultiFieldPanel --- docs/reference/pages/editing_api.rst | 42 ++++++++++++---------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/docs/reference/pages/editing_api.rst b/docs/reference/pages/editing_api.rst index efb2fcadcc..0dd551b6c7 100644 --- a/docs/reference/pages/editing_api.rst +++ b/docs/reference/pages/editing_api.rst @@ -94,6 +94,24 @@ MultiFieldPanel A heading for the fields +.. topic:: Collapsing MultiFieldPanels to save space + + By default, ``MultiFieldPanel`` s are expanded and not collapsible. Adding the classname ``collapsible`` will enable the collapse control. Adding both ``collapsible`` and ``collapsed`` to the classname parameter will load the editor page with the ``MultiFieldPanel`` collapsed under its heading. + + .. code-block:: python + + content_panels = [ + MultiFieldPanel( + [ + ImageChooserPanel('cover'), + DocumentChooserPanel('book_file'), + PageChooserPanel('publisher'), + ], + heading="Collection of Book Fields", + classname="collapsible collapsed" + ), + ] + InlinePanel ----------- @@ -305,30 +323,6 @@ Without a panel definition, a default form field (without label) will be used to .. _Django model field reference (editable): https://docs.djangoproject.com/en/dev/ref/models/fields/#editable -MultiFieldPanel -~~~~~~~~~~~~~~~ - -The ``MultiFieldPanel`` groups a list of child fields into a fieldset, which can also be collapsed into a heading bar to save space. - -.. code-block:: python - - BOOK_FIELD_COLLECTION = [ - ImageChooserPanel('cover'), - DocumentChooserPanel('book_file'), - PageChooserPanel('publisher'), - ] - - BookPage.content_panels = [ - MultiFieldPanel( - BOOK_FIELD_COLLECTION, - heading="Collection of Book Fields", - classname="collapsible collapsed" - ), - ] - -By default, ``MultiFieldPanel`` s are expanded and not collapsible. Adding the classname ``collapsible`` will enable the collapse control. Adding both ``collapsible`` and ``collapsed`` to the classname parameter will load the editor page with the ``MultiFieldPanel`` collapsed under its heading. - - .. _inline_panels: Inline Panels and Model Clusters