ixc / wagtail-admin-list-controls

A UI toolkit that extends Wagtail's admin list views and allows you to build custom filters, buttons, panels and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve flexibility of the panel and label declarations

markfinger opened this issue · comments

The currently glaring issue is the hard-coded panel and button labels which wont allow translation support. We don't have much experience with translation support, so for now a basic courtesy would be to make them configurable in the python code and allow folk to use the normal _('...') convention.

While it's not in-scope to support multiple panels of the same type, it might be something that we support in the future. For now, we can accept a children argument to the main declaration and then traverse it to pull in all the filters, sorts, layouts, etc and populate the internal list of them.

from django.utils.translation import gettext as _

# ...

ListViewControls([
    FilterPanel(
        label=_('Some filter panel'),
        submit_label=_('Some custom submit label'),
        children=[
            # ...
        ],
    ),
    SortingPanel(
        label=_('Some sort panel'),
        children=[
            # ...
        ],
    ),
    ResetButton(
        label=_('Some reset button'),
    ),
    LayoutOptions(
        label=_('Layout options'),
        children=[
            # ...
        ],
    ),
])

Fixed in latest codebase.