Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Blocks concertina'd shut by default #13

Closed
arctangent opened this issue Sep 28, 2018 · 3 comments
Closed

Blocks concertina'd shut by default #13

arctangent opened this issue Sep 28, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@arctangent
Copy link

We would like to be able to control which ones are open and which are closed by default

@BertrandBordage
Copy link
Contributor

Yes, this is one of the upcoming features :)

@BertrandBordage BertrandBordage added the enhancement New feature or request label Sep 28, 2018
@ladrua
Copy link

ladrua commented Nov 29, 2018

Is it possible to have all open by default in todays version?

@BertrandBordage
Copy link
Contributor

Since 1.0.0, released today, the default layout is SIMPLE, a layout closer to the old StreamField where there is no way to collapse blocks. Blocks can still be defined as using the COLLAPSIBLE layout by writing:

class YourBlock(CharBlock):
    def get_layout(self):
        return self.COLLAPSIBLE

That being said, you may want to keep COLLAPSIBLE blocks, but opened by default.

To do that, use this:

class YourBlock(CharBlock):
    def get_layout(self):
        return self.COLLAPSIBLE

    def get_definition(self):
        definition = super().get_definition()
        definition['closed'] = False
        return definition

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants