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

How to make a dropdown menu using flask-bootstrap? #71

Closed
cyrexcyborg opened this issue Aug 20, 2014 · 5 comments
Closed

How to make a dropdown menu using flask-bootstrap? #71

cyrexcyborg opened this issue Aug 20, 2014 · 5 comments

Comments

@cyrexcyborg
Copy link

This is my starting lines of layout.html

{% extends "bootstrap/base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "bootstrap/fixes.html" as fixes %}
...
{% if current_user.is_authenticated() %}
              <li>                  
                <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">                    
                    <a class="dropdown-toggle" href="#">
                        <span></span>
                        {{ current_user.email }} <strong class="caret"></strong>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">Your Bio Page</a></li>
                            <li><a href="#">Settings..</a></li>
                            <li class="divider"></li>
                            <li><a href=<li><a href='{{ url_for("logout") }}'>Выйти</a></li>
                        </ul>
                 </li>   
                </ul>

             </li>
 {% endif %}

I'm asking, because i can't explain why my dropdown doesn't work properly.
Why bootstrap.js don't loading?

@jhyland
Copy link

jhyland commented Oct 5, 2014

I am experiencing this issue as well. My current work around is to include js as such.

{% block head %}
{{super()}}
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
{% endblock %}

@mbr
Copy link
Owner

mbr commented Mar 23, 2015

This usually happens if you forget a super() (which you probably haven't, seeing that that is your workaround) or if you use the wrong block (i.e. body when you should be using content). Flask-bootstrap loads the javascript source at the end of the <body> block, not inside <head>.

@mbr mbr closed this as completed Mar 23, 2015
@jhyland
Copy link

jhyland commented Mar 28, 2015

Ahh yes... I was mis-using the block contents. Sorry for the misunderstanding and thank you for the great project.

@lestortues67
Copy link

Hello, i found this post interesting. Thank you.

@ashwinprabhukp
Copy link

ashwinprabhukp commented Jan 2, 2023

This post helped me, thanks!

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

5 participants