Open nypgand1 opened 8 years ago
@mbr Hello there?
Hey, I haven't forgotten this pull request and am looking into it.
I'm willing to merge this for now, but cannot guarantee that it stays; but I'll try to make it work next time I'm hacking on Flask-Nav.
One of the issues I've had with this is that there are essentially two sets of **kwargs
one would like to pass; the ones for url_for
and any extra attributes for the img
tag. Currently, img_src
and img_alt
are provided, however what if at some point you want an id
or extra class
on there? This could get ugly somewhat fast - especially if having an id
will prevent you from using id
as a parameter for url_for
. It then becomes img_id
and I feel it all might go downhill from there =).
An alternative I've been considering has been passing around dominate-tags, this would mean passing in the img
-tag as an object. In this case, it would probably be more flexible to put this logic into View
and renamed text
to content
; having everything work slightly similar to how it works with the JS DOM.
But, as I said above, I'll merge this, provided you drop the .gitignore
=)
Thanks for your advice and your great work!
Hey @nypgand1 ,
Thanks for your code, I was also looking at how to implement a logo in my Navbar.
The code you made works, but produces two <li></li>
tags.
<li>
<li>
<a href="/" title="logo">
<img alt="logo" src="/static/logo.png">
</a>
</li>
</li>
where i think it should be
<li>
<a href="/" title="logo">
<img alt="logo" src="/static/logo.png">
</a>
</li>
The following should be sufficient:
def visit_ViewImg(self, node):
a = tags.a(href=node.get_url(), title=node.text)
a.add(tags.img(src=node.img_src, alt=node.img_alt))
return a
Hello, I was wondering if the project was still alive and the feature present here could be merged. Regards!
New element "ViewImg" for link with a img tag.
Used by issue #2 and template "Logo Nav" of Start Bootstrap.
http://startbootstrap.com/template-overviews/logo-nav/