navigation.html 2.8 KB
Newer Older
David Haynes's avatar
David Haynes committed
1
<!-- load in go templatetags -->
2
{% load go_extras %}
David Haynes's avatar
David Haynes committed
3
4

<!-- define our navbar -->
5
<div class="navbar navbar-default">
David Haynes's avatar
David Haynes committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    <!-- define the main "header" of the navbar -->
    <div class="navbar-header" style="margin-left:5%;">
        <!-- responsive hamburger menu -->
        <button type="button" class="navbar-toggle" data-toggle="collapse"
        data-target=".navbar-responsive-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <!-- Go brand logo -->
        <a class="navbar-brand" href="{% url 'index' %}">
            <i class="fa fa-link"> Go</i>
        </a>
    </div>

    <!-- define the parts of the navbar that collapse b/c responsiveness -->
    <div class="navbar-collapse collapse navbar-responsive-collapse">
        <!-- The left side -->
        <ul class="nav navbar-nav navbar-left">
            <li><a href="{% url 'about' %}">About</a></li>
            <!-- only show if the current user is authenticated -->
            {% if user.is_authenticated %}
                <!-- only if they are an approved user -->
                {% if user.registereduser.approved %}
Zach Knox's avatar
Zach Knox committed
30
                    <li><a href="{% url 'new_link' %}">New Link</a></li>
David Haynes's avatar
David Haynes committed
31
32
33
34
35
36
                {% endif %}
                <!-- only if the current user has not registered to use go -->
                {% if not user.registereduser.registered %}
                    <li><a href="{% url 'signup' %}">Register</a></li>
                {% endif %}
            {% endif %}
37
        </ul>
David Haynes's avatar
David Haynes committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

        <!-- The right side -->
        <ul class="nav navbar-nav navbar-right" style="margin-right:5%;">
            <!-- only show if the user is authenticated -->
            {% if user.is_authenticated %}
                <!-- logout -->
                <li>
                    <a href="{% url 'go_logout' %}">
                        Log Out <i class="fa fa-sign-out fa-fw"></i>
                    </a>
                </li>
            {% else %}
                <!-- login -->
                <li>
                    <a href="{% url 'go_login' %}">
                        Log In <i class="fa fa-sign-in fa-fw"></i>
                    </a>
                </li>
            {% endif %}

            <!-- if the user is a staff member -->
            {% if user.is_staff %}
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle"
                    data-toggle="dropdown">
                    Administration <i class="fa fa-caret-down fa-fw"></i></a>
                    <ul class="dropdown-menu dropdown-menu-left">
                        <li><a href="{% url 'useradmin' %}">User Moderation <i class="fa fa-users fa-fw"></i></a></li>
                    </ul>
                </li>
            {% endif %}
        </ul>
    </div>
71
</div>