Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navbar not fully rendered in the example #21

Open
hstarmans opened this issue Apr 9, 2017 · 1 comment
Open

navbar not fully rendered in the example #21

hstarmans opened this issue Apr 9, 2017 · 1 comment

Comments

@hstarmans
Copy link

hstarmans commented Apr 9, 2017

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'), ))
@AlexNizovoy
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants