base.html 15.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.

Copyright © 2017  Goulven Kermarec
Copyright © 2017  Augustin Lemesle

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}

lhark's avatar
lhark committed
24 25 26 27
{% load staticfiles %}

{# Load the tag library #}
{% load bootstrap3 %}
28
{% load acl %}
29
{% load self_adhesion %}
30 31
{% load i18n %}

32
{% self_adhesion as var_sa %}
lhark's avatar
lhark committed
33 34
<!DOCTYPE html>
<html lang="fr">
35
    <head prefix="og: http://ogp.me/ns#">
36 37 38 39 40 41
        <meta property="og:title" content="Re2o" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="{{ request.scheme }}://{{ request.get_host }}/" />
        <meta property="og:image" content="{% static 'images/logo_re2o.svg' %}"/>
        <meta property="og:image:type" content="image/svg"/>
        <meta property="og:image:alt" content="The Re2o logo"/>
42
        <meta property="og:description" content="{% trans "Networking managing website endorsed by FedeRez." %}" />
Alexandre Iooss's avatar
Alexandre Iooss committed
43

44 45 46 47 48
        {# Preload JavaScript #}
        {% bootstrap_javascript %}
        <script src="/static/js/typeahead/typeahead.js"></script>
        <script src="/static/js/bootstrap-tokenfield/bootstrap-tokenfield.js"></script>

49
        {# Load CSS #}
lhark's avatar
lhark committed
50
        {% bootstrap_css %}
51 52 53 54
        <link href="{% static 'css/typeaheadjs.css' %}" rel="stylesheet">
        <link href="{% static 'css/bootstrap-tokenfield.css' %}" rel="stylesheet">
        <link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
        <link href="{% static 'css/base.css' %}" rel="stylesheet">
lhark's avatar
lhark committed
55

chirac's avatar
chirac committed
56
        <meta name="viewport" content="width=device-width, initial-scale=1">
57
        <link rel="shortcut icon" type="image/svg" href="{% static 'images/logo_re2o.svg' %}">
58
        <title>{{ name_website }} : {% block title %}{% trans "Home" %}{% endblock %}</title>
lhark's avatar
lhark committed
59 60
    </head>

Alexandre Iooss's avatar
Alexandre Iooss committed
61
    <body id="main">
Alexandre Iooss's avatar
Alexandre Iooss committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
        <nav class="navbar navbar-inverse navbar-static-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="/">
                        <img src="{% static 'images/logo_re2o_navbar.svg' %}" height=32>
                        {{ name_website }}
                    </a>
                </div>
                <div class="collapse navbar-collapse" id="myNavbar">
                    <ul class="nav navbar-nav">
                        {% can_view_any_app users machines cotisations %}
                        <li class="dropdown">
79
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-users"></i> {% trans "Users" %}<span class="caret"></span></a>
Alexandre Iooss's avatar
Alexandre Iooss committed
80 81
                            <ul class="dropdown-menu">
                                {% can_view_app users %}
82 83
                                <li><a href="{% url 'users:index' %}"><i class="fa fa-user"></i> {% trans "Manage the users" %}</a></li>
                                <li><a href="{% url 'users:index-clubs' %}"><i class="fa fa-users"></i> {% trans "Manage the clubs" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
84 85
                                {% acl_end %}                              
                                {% can_view_app machines %}
86
                                <li><a href="{% url 'machines:index' %}"><i class="fa fa-desktop"></i> {% trans "Manage the machines" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
87 88
                                {% acl_end %}
                                {% can_view_app cotisations %}
89
                                <li><a href="{% url 'cotisations:index' %}"><i class="fa fa-eur"></i> {% trans "Manage the subscriptions" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
90 91 92 93 94 95 96 97
                                {% acl_end %}
                            </ul>
                        </li>
                        {% acl_end %}
                        {% can_view_app topologie %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-sitemap"></i> {% trans "Topology" %}<span class="caret"></span></a>
                            <ul class="dropdown-menu">
98 99 100
                                <li><a href="{% url "topologie:index" %}"><i class="fa fa-microchip"></i> {% trans "Switches" %}</a></li>
                                <li><a href="{% url "topologie:index-ap" %}"><i class="fa fa-wifi"></i> {% trans "Access points" %}</a></li>
                                <li><a href="{% url "topologie:index-room" %}"><i class="fa fa-home"></i> {% trans "Rooms" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
101 102 103 104
                            </ul>
                        </li>
                        {% acl_end %}
                        {% can_view_app logs %}
105
                        <li><a href="{% url "logs:index" %}"><i class="fa fa-area-chart"></i> {% trans "Statistics" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
106 107 108 109 110 111 112 113 114 115 116
                        {% acl_end %}
                        {% can_view_app preferences %}
                        <li>
                            <a href="{% url 'preferences:display-options' %}">
                                <i class="fa fa-cogs"></i> {% trans "Administration" %}
                            </a>
                        </li>
                        {% acl_end %}
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
117
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-info"></i> {% trans "More information" %}<span class="caret"></span></a>
Alexandre Iooss's avatar
Alexandre Iooss committed
118 119
                            <ul class="dropdown-menu">
                                <li><a href="{% url 'about' %}"><i class="fa fa-info-circle"></i> {% trans "About" %}</a></li>
120
                                <li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
121 122 123 124
                            </ul>
                        </li>
                        {% if not request.user.is_authenticated %}
                            {% if var_sa %}
125
                            <li>
Alexandre Iooss's avatar
Alexandre Iooss committed
126 127
                                <a href="{% url 'users:new-user' %}">
                                    <i class="fa fa-user-plus"></i> {% trans "Sign up" %}
128 129
                                </a>
                            </li>
Maël Kervella's avatar
Maël Kervella committed
130
                            {% endif %}
Alexandre Iooss's avatar
Alexandre Iooss committed
131 132
                            <li>
                                <a id="toggle_login" href="{% url 'login' %}">
133
                                    <i class="fa fa-sign-in"></i> {% trans "Log in" %}
Alexandre Iooss's avatar
Alexandre Iooss committed
134
                                </a>
135
                            </li>
Alexandre Iooss's avatar
Alexandre Iooss committed
136 137
                        {% else %}
                        {% can_view_any_app users machines cotisations %}
138
                            <li>
Alexandre Iooss's avatar
Alexandre Iooss committed
139 140 141 142 143 144 145 146 147
                                <form action="{% url "search:search"%}" class="navbar-form" role="search">
                                    <div class="input-group">
                                        <input type="text" class="form-control" placeholder="{% trans "Search" %}" name="q" id="search-term" {% if search_term %}value="{{ search_term }}"{% endif %}>
                                        <div class="input-group-btn">
                                            <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
                                            <a href="{% url "search:searchp" %}" class="btn btn-default" role="button"><i class="fa fa-plus"></i></a>
                                        </div>
                                    </div>
                                </form>
148
                            </li>
149
                        {% acl_end %}
Alexandre Iooss's avatar
Alexandre Iooss committed
150 151 152 153 154 155
                        {% endif %}
                        {% if request.user.is_authenticated %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user-circle"></i> {{ request.user.pseudo|slice:":15" }} <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{% url "users:mon-profil" %}"><i class="fa fa-user"></i> {% trans "My profile" %}</a></li>
156
                                <li><a id="toggle_login" href="{% url 'logout' %}"><i class="fa fa-sign-out"></i> {% trans "Log out" %}</a></li>
Alexandre Iooss's avatar
Alexandre Iooss committed
157 158 159 160 161 162 163
                            </ul>
                        </li>
                        {% endif %}
                        <li>
                            {% include 'buttons/setlang.html' %}
                        </li>
                    </ul>
lhark's avatar
lhark committed
164
                </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
165 166
            </div>
        </nav>
lhark's avatar
lhark committed
167

Alexandre Iooss's avatar
Alexandre Iooss committed
168 169
        <div class="container-fluid text-center">
            <div class="row content">
Alexandre Iooss's avatar
Alexandre Iooss committed
170
                <div class="col-sm-2 sidenav pt4">
Alexandre Iooss's avatar
Alexandre Iooss committed
171 172 173 174
                    <div class="panel panel-default">
                        <div class="text-left list-group">
                        {% block sidebar %}
                        {% endblock %}
lhark's avatar
lhark committed
175
                        </div>
chirac's avatar
chirac committed
176
                    </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
177
                </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
178
                <div class="col-sm-8 text-left pt4">
Alexandre Iooss's avatar
Alexandre Iooss committed
179 180 181 182
                    {# Display django.contrib.messages as Bootstrap alerts #}
                    {% bootstrap_messages %}
                    {% block content %}{% endblock %}
                </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
183
                <div class="col-sm-2 sidenav pt4">
Alexandre Iooss's avatar
Alexandre Iooss committed
184
                    <div class="panel panel-default">
chirac's avatar
chirac committed
185
                        {% if request_user.is_authenticated %}
Alexandre Iooss's avatar
Alexandre Iooss committed
186 187
                        <div class="panel-heading">
                            <h4>{{ request_user.name }} {{ request_user.surname }}</h4>
chirac's avatar
chirac committed
188
                        </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
189 190 191 192 193 194 195 196 197 198
                        <table class="table">
                            <tr>
                                <th scope="row">{% trans "Username" %}</th>
                                <td class="text-right">{{ request_user.pseudo }}</td>
                            </tr>
                            <tr>
                                <th scope="row">{% trans "Room" %}</th>
                                <td class="text-right">{{ request_user.room }}</td>
                            </tr>
                            <tr>
199
                                <th scope="row">{% trans "Internet access" %}</th>
Alexandre Iooss's avatar
Alexandre Iooss committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
                                <td class="text-right">
                                {% if request_user.has_access %}
                                    <i class="text-success">{% blocktrans with request.user.end_access|date:"d b Y" as date %}Until {{ date }}{% endblocktrans %}</i>
                                {% else %}
                                    <i class="text-danger">{% trans "Disabled" %}</i>
                                {% endif %}
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">{% trans "Membership" %}</th>
                                <td class="text-right">
                                {% if request_user.is_adherent %}
                                    <i class="text-success">{% blocktrans with request_user.end_adhesion|date:"d b Y" as date %}Until {{ date }}{% endblocktrans %}</i>
                                {% else %}
                                    <i class="text-danger">{% trans "Not a member" %}</i>
                                {% endif %}
                                </td>
                            </tr>
                        </table>
                        <div class="list-group">
                            <a class="list-group-item list-group-item-info" role="button"href="{% url "users:mon-profil" %}">
                                <i class="fa fa-user-circle"></i>
222
                                {% trans "View my profile" %}
Alexandre Iooss's avatar
Alexandre Iooss committed
223 224 225
                            </a>
                        </div>
                        {% else %}
226
                            <p>{% trans "You are not logged in." %}</p>
chirac's avatar
chirac committed
227
                        {% endif %}
lhark's avatar
lhark committed
228
                    </div>
Alexandre Iooss's avatar
Alexandre Iooss committed
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
                    {% if request_user.is_authenticated %}
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4>{% blocktrans count interfaces|length as nb %}{{ nb }} active machine{% plural %}{{ nb }} active machines{% endblocktrans %}</h4>
                        </div>
                        <ul class="list-group">
                        {% for interface in interfaces|slice:":5" %}
                            <div class="list-group-item">{{interface}}</div>
                        {% endfor %}
                        {% if interfaces|length > 5 %}
                            <a class="list-group-item list-group-item-info" role="button" href="{% url "users:mon-profil" %}">
                                <i class="fa fa-plus"></i>
                                {% trans "View my machines" %}
                            </a>
                        {% endif %}
                        </ul>
                    </div>
                    {% endif %}
lhark's avatar
lhark committed
247 248 249 250
                </div>
            </div>
        </div>

Alexandre Iooss's avatar
Alexandre Iooss committed
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
        <footer class="text-muted">
            <div class="container">
                <p class="pull-right">
                  <a href="#">{% trans "Back to top" %}</a>
                </p>
                <p>{{ name_website }} {% trans "powered by" %} Re2o 2016&ndash;2018</p>
                <p>
                    {% blocktrans trimmed %}
                    Brought to you with <i class="fa fa-heart text-danger"></i>.
                    {% endblocktrans %}
                    <a href="{{ request.scheme }}://{{ request.get_host }}/about/">{% trans "About this website" %}</a>.
                </p>
                <p>
                    {% blocktrans trimmed %}
                    This software is under the terms of the
                    <a href="http://www.gnu.org/licenses/gpl-2.0.txt" target="_blank" rel="nofollow">GPLv2</a> License.
                    {% endblocktrans %}
                </p>
269
            </div>
lhark's avatar
lhark committed
270
        </footer>
Alexandre Iooss's avatar
Alexandre Iooss committed
271

272 273 274
        {# Load JavaScript #}
        <script src="/static/js/handlebars/handlebars.js"></script>
        <script src="/static/js/konami/konami.js"></script>
Alexandre Iooss's avatar
Alexandre Iooss committed
275 276 277 278 279 280
        <script src="/static/js/sapphire.js"></script>
        <script>
            // Konami activate sapphire
            let s = Sapphire();
            Konami(s.activate);
        </script>
281 282
        <script src="/static/js/shortcuts.js"></script>

lhark's avatar
lhark committed
283 284 285
        {# Read the documentation for more information #}
    </body>
</html>
286