thestudentlife/Manhattan-Project

View on GitHub
mainsite/templates/navigation.html

Summary

Maintainability
Test Coverage
{% load staticfiles %}
{% load navigation_extras %}
<nav id="tslNavbar" class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            {% if flavour == "mobile" %}
                <a class="tsl navbar-brand mobile" href="{% url 'home' %}"><img id="tslLogo"
                                                                                src="{% static 'TSLlogo-02-01.svg' %}"/><span
                        id="tslLogoText">TSL</span></a>
            {% else %}
                <a class="tsl navbar-brand" href="{% url 'home' %}"><img id="tslLogo"
                                                                         src="{% static 'TSLlogo-02-01.svg' %}"/><span
                        id="tslLogoText">THE STUDENT LIFE</span></a>
            {% endif %}
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul id="main-menu" class="nav navbar-nav navbar-right">
                {% if flavour == "mobile" %}
                    <li>
                        <a href="#">
                            <form action="{% url 'search' %}" role="search" method="GET">
                                <div class="input-group">
                                    <input name="search" type="text" class="form-control" placeholder="Search for..."/>
                                    <span class="input-group-btn">
                                        <input class="btn btn-default btn-primary" type="submit" value="Search"/>
                                    </span>
                                </div>
                            </form>
                        </a>
                    </li>
                {% endif %}
                {% for section in sections %}
                    <li class="{% active_nav request section.slug %}"><a
                            href="{{ section.get_absolute_url }}">{{ section.name }}</a></li>
                {% endfor %}
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Other
                        <span class="caret"></span></a>
                    <ul class="dropdown-menu tsl-dropdown-menu" role="menu">
                        <li><a href="{% url 'archives' %}">Archives</a></li>
                        {% for page in pages %}
                             <li><a href="{% url 'page' page.name %}">{{ page.title }}</a></li>
                        {% endfor %}
                    </ul>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>