flask-nav icon indicating copy to clipboard operation
flask-nav copied to clipboard

navbar not fully rendered in the example

Open hstarmans opened this issue 7 years ago • 1 comments

Dear @mbr,

I like flask-nav, thanks for sharing this code with your insights. I have run into a minor issue. The example does not work completely; you don't get to see Widgets Inc. It seems like the first object of Navbar has no effect. I use flask 0.12.1. This is a navbar which does show Widgets inc and shows the problem.

nav.register_element(
    'top',
    Navbar(
        None, #  NOTE: here is the problem, what ever you put first has no effect
                  #              if you put an object first it is not rendered
        View('Widgits, Inc.', 'index'),
        View('Our Mission', 'about'),
        Subgroup('Products',
                 View('Wg240-Series',
                      'products',
                      product='wg240'),
                 View('Wg250-Series',
                      'products',
                      product='wg250'),
                 Separator(),
                 Text('Discontinued Products'),
                 View('Wg10X',
                      'products',
                      product='wg10x'), ),
        Link('Tech Support', 'http://techsupport.invalid/widgits_inc'), ))

hstarmans avatar Apr 09 '17 16:04 hstarmans

Yesterday, too, I ran into this problem. The reason for this behavior is as follows: class Navbar inherits from class Subgroup: class Navbar(Subgroup): pass , but class Subgroup when creating the first parameter takes the value of the title: class Subgroup(NavigationItem): def __init__(self, title, *items): self.title = title self.items = list(items)

AlexNizovoy avatar Jul 01 '17 10:07 AlexNizovoy