starlette-admin icon indicating copy to clipboard operation
starlette-admin copied to clipboard

Bug: Nested Drop Down Menu doesn't work as expected

Open hasansezertasan opened this issue 7 months ago • 0 comments

Describe the bug

The expected result for the code below is like:

  • Parent
    • Child 1
    • Child 2
      • G Child 1
      • G Child 2

What I get is this:

  • Parent
    • Child 1
  • Child 2
    • G Child 1
    • G Child 2

To Reproduce

from starlette.applications import Starlette
from starlette_admin.base import BaseAdmin
from starlette_admin.views import DropDown, Link


app = Starlette()
admin = BaseAdmin(title="Nested Menu")
admin.add_view(
    DropDown(
        "Parent",
        icon="fa fa-server",
        views=[
            Link(
                label="Child 1",
                icon="fa fa-link",
                url="/",
            ),
            DropDown(
                "Child 2",
                icon="fa fa-server",
                views=[
                    Link(
                        label="G Child 1",
                        icon="fa fa-link",
                        url="/",
                    ),
                    Link(
                        label="G Child 2",
                        icon="fa fa-link",
                        url="/",
                    ),
                ],
            ),
        ],
    )
)
admin.mount_to(app)

Environment (please complete the following information):

  • Starlette-Admin version: [e.g. 0.12.2]

hasansezertasan avatar Jan 08 '24 09:01 hasansezertasan