8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-05-09 19:06:11 +00:00

Refactor navbar and general frontend.

The menus of the navbar is reorganized
The footer is changed into a navbar
The right sidebar is placed to the left
The left sidebar is deleted
Header navbar and leftsidebar are now fixed
Physical grouing is split into 4 views
This commit is contained in:
Yoann Pétri 2020-11-15 20:41:23 +01:00 committed by Gabriel Detraz
parent fc9540187e
commit 6d2ad5b00e
18 changed files with 896 additions and 609 deletions

View file

@ -27,43 +27,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load i18n %}
{% block sidebar %}
{% can_create CustomInvoice %}
<a class="list-group-item list-group-item-success" href="{% url 'cotisations:new-custom-invoice' %}">
<i class="fa fa-plus"></i> {% trans "Create an invoice" %}
</a>
<a class="list-group-item list-group-item-warning" href="{% url 'cotisations:control' %}">
<i class="fa fa-eye"></i> {% trans "Control the invoices" %}
</a>
{% acl_end %}
{% can_view_all Facture %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index' %}">
<i class="fa fa-list-ul"></i> {% trans "Invoices" %}
</a>
{% acl_end %}
{% can_view_all CustomInvoice %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-custom-invoice' %}">
<i class="fa fa-list-ul"></i> {% trans "Custom invoices" %}
</a>
{% acl_end %}
{% can_view_all CostEstimate %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-cost-estimate' %}">
<i class="fa fa-list-ul"></i> {% trans "Cost estimates" %}
</a>
{% acl_end %}
{% can_view_all Article %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-article' %}">
<i class="fa fa-list-ul"></i> {% trans "Articles" %}
</a>
{% acl_end %}
{% can_view_all Banque %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-banque' %}">
<i class="fa fa-list-ul"></i> {% trans "Banks" %}
</a>
{% acl_end %}
{% can_view_all Paiement %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-paiement' %}">
<i class="fa fa-list-ul"></i> {% trans "Payment methods" %}
</a>
{% acl_end %}
{% endblock %}

View file

@ -27,35 +27,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load i18n %}
{% block sidebar %}
{% can_view_app logs %}
<a class="list-group-item list-group-item-info" href="{% url 'logs:index' %}">
<i class="fa fa-clipboard"></i>
{% trans "Summary" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-logs' %}">
<i class="fa fa-calendar"></i>
{% trans "Events" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-general' %}">
<i class="fa fa-area-chart"></i>
{% trans "General" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-models' %}">
<i class="fa fa-database"></i>
{% trans "Database" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-actions' %}">
<i class="fa fa-plug"></i>
{% trans "Wiring actions" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-users' %}">
<i class="fa fa-users"></i>
{% trans "Users" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'logs:stats-search-machine' %}">
<i class="fa fa-desktop"></i>
{% trans "Machine history" %}
</a>
{% acl_end %}
{% endblock %}

View file

@ -27,59 +27,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load i18n %}
{% block sidebar %}
{% can_view_all Machine %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index' %}">
<i class="fa fa-list-ul"></i>
{% trans "Machines" %}
</a>
{% acl_end %}
{% can_view_all MachineType %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-machinetype' %}">
<i class="fa fa-list-ul"></i>
{% trans "Machine types" %}
</a>
{% acl_end %}
{% can_view_all Extension %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-extension' %}">
<i class="fa fa-list-ul"></i>
{% trans "Extensions and zones" %}
</a>
{% acl_end %}
{% can_view_all IpType %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-iptype' %}">
<i class="fa fa-list-ul"></i>
{% trans "IP ranges" %}
</a>
{% acl_end %}
{% can_view_all Vlan %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-vlan' %}">
<i class="fa fa-list-ul"></i>
{% trans "VLANs" %}
</a>
{% acl_end %}
{% can_view_all Nas %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-nas' %}">
<i class="fa fa-list-ul"></i>
{% trans "NAS devices" %}
</a>
{% acl_end %}
{% can_view_all machines.Service %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-service' %}">
<i class="fa fa-list-ul"></i>
{% trans "Services (DHCP, DNS, ...)" %}
</a>
{% acl_end %}
{% can_view_all Role %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-role' %}">
<i class="fa fa-list-ul"></i>
{% trans "Server roles" %}
</a>
{% acl_end %}
{% can_view_all OuverturePortList %}
<a class="list-group-item list-group-item-info" href="{% url 'machines:index-portlist' %}">
<i class="fa fa-list-ul"></i>
{% trans "Ports openings" %}
</a>
{% acl_end %}
{% endblock %}

View file

@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Preferences" %}{% endblock %}
{% block content %}
<h2>{% trans "Preferences" %}</h2>
<div id="accordion">
<div class="panel panel-default" id="general">

View file

@ -1,3 +1,12 @@
/* For the footer to be at the bottom*/
body {
padding-top: 50px;
}
.content {
min-height: calc(100vh - 100px);
}
/* Footer */
footer {
padding-top: 3rem;
@ -70,10 +79,52 @@ a > i.fa {
}
/* Set gray background color */
.sidenav {
background-color: #f1f1f1;
border: 1px solid #e0e0e0;
border-radius: 0 0 5px 5px;
@media (min-width: 768px) {
.sidenav-right {
position: fixed;
top:50px;
right:0;
}
.sidenav-left {
position: fixed;
top:50px;
left:0;
}
.dropdown-menu .dropdown-toggle:after {
border-top: .3em solid transparent;
border-right: 0;
border-bottom: .3em solid transparent;
border-left: .3em solid;
}
.dropdown-menu .dropdown-menu {
margin-left: 0;
margin-right: 0;
}
.dropdown-menu li {
position: relative;
}
.nav-item .submenu {
display: none;
position: absolute;
left: 100%;
top: -7px;
}
.nav-item .submenu-left {
right: 100%;
left: auto;
}
.dropdown-menu>li:hover {
background-color: #f1f1f1
}
.dropdown-menu>li:hover>.submenu {
display: block;
}
}
.table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
vertical-align: middle;
@ -148,3 +199,11 @@ dl.profile-info > div {
[data-toggle~="collapse"] {
cursor: pointer;
}
/* Indent for submenu when collapsed */
@media (max-width:767px) {
.submenu > li {
margin-left:20px;
}
};

42
static/js/main.js Normal file
View file

@ -0,0 +1,42 @@
function adjustHeader(){
/* This function is here to adjust the header if the header navbar
goes into two lines. This can't happen if the width is sm or less,
and we shouldn't adjust in this case. */
if ($(window).width() >= 768) {
$('body').css('padding-top', $("#navbar-header").height());
$('.sidenav-left').css('top', $("#navbar-header").height());
} else {
$('body').css('padding-top', '');
$('.sidenav-left').css('top', '');
}
}
function listenSubmenu() {
/* Add listeners on sm screen or less for submenus. */
if ($(window).width() < 767) {
$('.dropdown-menu a').click(function (e) {
if ($(this).next('.submenu').length) {
e.preventDefault();
$(this).next('.submenu').toggle();
}
$('.dropdown').on('hide.bs.dropdown', function () {
$(this).find('.submenu').hide();
})
});
}
}
/* We need to apply those functions at init and when the screen is resized. */
$(window).resize(function () {
adjustHeader();
listenSubmenu();
});
adjustHeader();
listenSubmenu();
$(document).on('click', '.dropdown-menu', function (e) {
e.stopPropagation();
});

View file

@ -3,8 +3,8 @@ 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 Lara Kermarec
Copyright © 2017 Augustin Lemesle
Copyright © 2017 Lara 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
@ -13,7 +13,7 @@ the Free Software Foundation; either version 2 of the License, or
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
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
@ -32,327 +32,82 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% self_adhesion as var_sa %}
<!DOCTYPE html>
<html lang="fr">
<head prefix="og: http://ogp.me/ns#">
{# Open Graph for social media #}
<meta property="og:title" content="{{ name_website }}" />
<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"/>
<meta property="og:description" content="Networking managing website endorsed by FedeRez." />
{# Preload JavaScript #}
{% bootstrap_javascript %}
<script src="/static/js/typeahead/typeahead.js"></script>
<script src="/static/js/bootstrap-tokenfield/bootstrap-tokenfield.js"></script>
<script src="{% static 'js/collapse-from-url.js' %}"></script>
<head prefix="og: http://ogp.me/ns#">
{# Open Graph for social media #}
<meta property="og:title" content="{{ name_website }}" />
<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" />
<meta property="og:description" content="Networking managing website endorsed by FedeRez." />
{% block custom_js %}{% endblock %}
{# Preload JavaScript #}
{% bootstrap_javascript %}
<script src="/static/js/typeahead/typeahead.js"></script>
<script src="/static/js/bootstrap-tokenfield/bootstrap-tokenfield.js"></script>
<script src="{% static 'js/collapse-from-url.js' %}"></script>
{# Load CSS #}
{% bootstrap_css %}
<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">
{% block custom_js %}{% endblock %}
{# Favicon with iOS, Android, touchbar support #}
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'favicon/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon/favicon-16x16.png' %}">
<link rel="manifest" href="{% static 'favicon/site.webmanifest' %}">
<link rel="mask-icon" href="{% static 'favicon/safari-pinned-tab.svg' %}" color="#5bbad5">
<link rel="shortcut icon" href="{% static 'favicon/favicon.ico' %}">
<meta name="theme-color" content="#ffffff">
{# Load CSS #}
{% bootstrap_css %}
<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">
{# Do not allow zooming on devices #}
<meta name="viewport" content="width=device-width, initial-scale=1">
{# Favicon with iOS, Android, touchbar support #}
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'favicon/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon/favicon-16x16.png' %}">
<link rel="manifest" href="{% static 'favicon/site.webmanifest' %}">
<link rel="mask-icon" href="{% static 'favicon/safari-pinned-tab.svg' %}" color="#5bbad5">
<link rel="shortcut icon" href="{% static 'favicon/favicon.ico' %}">
<meta name="theme-color" content="#ffffff">
<title>{{ name_website }} : {% block title %}{% trans "Home" %}{% endblock %}</title>
</head>
{# Do not allow zooming on devices #}
<meta name="viewport" content="width=device-width, initial-scale=1">
<body id="main">
<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">
<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>
<ul class="dropdown-menu">
{% can_view_app users %}
<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>
{% acl_end %}
{% can_view_app machines %}
<li><a href="{% url 'machines:index' %}"><i class="fa fa-desktop"></i> {% trans "Manage the machines" %}</a></li>
{% acl_end %}
{% can_view_app cotisations %}
<li><a href="{% url 'cotisations:index' %}"><i class="fa fa-eur"></i> {% trans "Manage the subscriptions" %}</a></li>
{% acl_end %}
<title>{{ name_website }} : {% block title %}{% trans "Home" %}{% endblock %}</title>
</head>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app != 'topologie' %}
{{ template }}
{% endif %}
{% endfor %}
</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">
<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>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app == 'topologie' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}
{% can_view_app logs %}
<li><a href="{% url 'logs:index' %}"><i class="fa fa-area-chart"></i> {% trans "Statistics" %}</a></li>
{% 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">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-info"></i> {% trans "Information and contact" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'about' %}"><i class="fa fa-info-circle"></i> {% trans "About" %}</a></li>
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a></li>
{% comment %}
<li><a href="{% url 'tickets:new-ticket' %}"><i class="fa fa-ticket"></i> {% trans "Open a ticket" %}</a><li>
{% endcomment %}
</ul>
</li>
{% if not request.user.is_authenticated %}
{% for template in optionnal_templates_navbar_logout_list %}
{{ template }}
{% endfor %}
{% if var_sa %}
<li>
<a href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i> {% trans "Sign up" %}
</a>
</li>
{% endif %}
<li>
<a id="toggle_login" href="{% url 'login' %}">
<i class="fa fa-sign-in"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
{% can_view_any_app users machines cotisations %}
<li>
<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>
</li>
{% acl_end %}
{% 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>
<li><a id="toggle_login" href="{% url 'logout' %}"><i class="fa fa-sign-out"></i> {% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
<li>
{% include 'buttons/setlang.html' %}
</li>
</ul>
</div>
<body id="main">
{% include 'nav.html' %}
<div class="container-fluid text-center content">
<div class="row content">
<div class="col-sm-2 sidenav-left pt4">
{% include 'sidebar.html' %}
{% block sidebar %}
{% endblock %}
</div>
</nav>
<div class="container-fluid text-center">
<div class="row content">
<div class="col-sm-2 sidenav pt4">
<div class="panel panel-default">
<div class="text-left list-group">
{% block sidebar %}
{% endblock %}
</div>
</div>
</div>
<div class="col-sm-8 text-left pt4">
{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}
{% block content %}{% endblock %}
</div>
<div class="col-sm-2 sidenav pt4">
<div class="panel panel-default">
{% if request_user.is_authenticated %}
<div class="panel-heading">
<h4>{{ request_user.name }} {{ request_user.surname }}</h4>
</div>
<table class="table visible-sm visible-md">
<tr>
<td>
<b>{% trans "Username" %}</b>
<br>
{{ request_user.pseudo }}
</td>
</tr>
<tr>
<td>
<b>{% trans "Room" %}</b>
<br>
{{ request_user.room }}
</td>
</tr>
<tr>
<td>
<b>{% trans "Internet access" %}</b>
<br>
{% if request_user.has_access %}
<i class="text-success">{% blocktrans with end_access_date=request.user.end_access|date:"d b Y" %}Until {{ end_access_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Disabled" %}</i>
{% endif %}
</td>
</tr>
<tr>
<td>
<b>{% trans "Membership" %}</b>
<br>
{% if request_user.is_adherent %}
<i class="text-success">{% blocktrans with end_adhesion_date=request_user.end_adhesion|date:"d b Y" %}Until {{ end_adhesion_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Non member" %}</i>
{% endif %}
</td>
</tr>
</table>
<table class="table visible-xs visible-lg">
<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>
<th scope="row">{% trans "Internet access" %}</th>
<td class="text-right">
{% if request_user.has_access %}
<i class="text-success">{% blocktrans with end_access_date=request.user.end_access|date:"d b Y" %}Until {{ end_access_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 end_adhesion_date=request_user.end_adhesion|date:"d b Y" %}Until {{ end_adhesion_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Non 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>
{% trans "View my profile" %}
</a>
</div>
{% else %}
<div class="panel-body">
<p>{% trans "You are not logged in." %}</p>
</div>
{% endif %}
</div>
{% 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" style="word-break: break-all">{{ 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 %}
</div>
<div class="col-sm-offset-2 col-sm-10 text-left pt4">
{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}
{% block content %}{% endblock %}
</div>
</div>
</div>
<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;2020</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>
</div>
</footer>
{% include 'footer.html' %}
{# Load JavaScript #}
<script src="/static/js/konami/konami.js"></script>
<script src="/static/js/sapphire.js"></script>
<script>
// Konami activate sapphire
let s = Sapphire();
Konami(s.activate);
</script>
{% if request.user.shortcuts_enabled %}
<script src="/static/js/shortcuts.js"></script>
{% endif %}
{# Read the documentation for more information #}
</body>
</html>
{# Load JavaScript #}
<script src="/static/js/konami/konami.js"></script>
<script src="/static/js/sapphire.js"></script>
<script>
// Konami activate sapphire
let s = Sapphire();
Konami(s.activate);
</script>
{% if request.user.shortcuts_enabled %}
<script src="/static/js/shortcuts.js"></script>
{% endif %}
{# Read the documentation for more information #}
<script src="/static/js/main.js"></script>
</body>
</html>

53
templates/footer.html Normal file
View file

@ -0,0 +1,53 @@
{% 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 Lara 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 %}
{% load i18n %}
{% load static %}
<nav class="navbar navbar-default navbar-static-bottom">
<div class="container-fluid">
<p class="navbar-text">{{ name_website }} {% trans "powered by" %} Re2o 2016&ndash;2020.
{% blocktrans trimmed %}
Brought to you with <i class="fa fa-heart text-danger"></i>.
{% endblocktrans %}</p>
<ul class="nav navbar-nav">
<li>
<a href="{% url 'about' %}">
<i class="fa fa-info-circle"></i> {% trans "About" %}
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#">
<i class="fa fa-arrow-up"></i> {% trans "Top" %}
</a>
</li>
<p class="navbar-text">{% 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>
</ul>
</div>
</nav>

322
templates/nav.html Normal file
View file

@ -0,0 +1,322 @@
{% 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 Lara 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 %}
{% load static %}
{% load acl %}
{% load i18n %}
<nav class="navbar navbar-inverse navbar-fixed-top" id="navbar-header">
<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 %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-users"></i>
{% trans "Users" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
{% can_view_app users %}
<li><a class="dropdown-item" href="#"><i class="fa fa-users"></i>
{% trans "Users and clubs" %} &raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'users:index' %}"><i class="fa fa-user"></i>
{% trans "Users" %}</a></li>
<li><a class="dropdown-item" href="{% url 'users:index-clubs' %}"><i
class="fa fa-users"></i>
{% trans "Clubs" %}</a></li>
<li><a class="dropdown-item" href="{% url 'users:index-white' %}"><i
class="fa fa-user-plus"></i>
{% trans "Whitelists" %}</a></li>
<li><a class="dropdown-item" href="{% url 'users:index-ban' %}"><i
class="fa fa-user-times"></i>
{% trans "Bans" %}</a></li>
<li><a class="dropdown-item" href="{% url 'users:mass-archive' %}"><i
class="fa fa-archive"></i>
{% trans "Massively archive" %}</a></li>
</ul>
</li>
{% acl_end %}
{% can_view_app machines %}
<li><a class="dropdown-item" href="{% url 'machines:index' %}"><i class="fa fa-laptop"></i>
{% trans "Machines" %}</a></li>
{% acl_end %}
{% can_view_app users %}
<li><a class="dropdown-item" href="{% url 'users:index-listright' %}"><i
class="fa fa-object-group"></i>
{% trans "Groups" %}</a></li>
<li><a class="dropdown-item" href="#"><i class="fa fa-plus"></i> {% trans "Advanced" %}
&raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'users:index-school' %}"><i
class="fa fa-graduation-cap"></i>
{% trans "Schools" %}</a></li>
<li><a class="dropdown-item" href="{% url 'users:index-shell' %}"><i
class="fa fa-terminal"></i>
{% trans "Shells" %}</a></li>
</ul>
</li>
{% acl_end %}
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app != 'cotisations' and app != 'topologie' and app != 'logs' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}
{% can_view_app cotisations %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-eur"></i>
{% trans "Treasury" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#"><i class="fa fa-file"></i>
{% trans "Invoices" %} &raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'cotisations:control' %}"><i
class="fa fa-eye"></i>
{% trans "Control invoices" %}</a></li>
<li><a class="dropdown-item" href="{% url 'cotisations:index' %}"><i
class="fa fa-file"></i>
{% trans "Invoices" %}</a></li>
<li><a class="dropdown-item" href="{% url 'cotisations:index-custom-invoice' %}"><i
class="fa fa-file-text"></i>
{% trans "Cutsom invoices" %}</a></li>
</ul>
</li>
<li><a class="dropdown-item" href="{% url 'cotisations:index-cost-estimate' %}"><i
class="fa fa-files-o"></i>
{% trans "Cost estimates" %}</a></li>
<li><a class="dropdown-item" href="#"><i class="fa fa-money"></i>
{% trans "Advanced" %}
&raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'cotisations:index-banque' %}"><i
class="fa fa-bank"></i>
{% trans "Banks" %}</a></li>
<li><a class="dropdown-item" href="{% url 'cotisations:index-article' %}"><i
class="fa fa-barcode"></i>
{% trans "Articles" %}</a></li>
<li><a class="dropdown-item" href="{% url 'cotisations:index-paiement' %}"><i
class="fa fa-credit-card"></i>
{% trans "Payment methods" %}</a></li>
</ul>
</li>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app == 'cotisations' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}
{% can_view_app topologie %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-sitemap"></i>
{% trans "Topology" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#"><i class="fa fa-microchip"></i>
{% trans "Switches" %} &raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'topologie:index' %}"><i
class="fa fa-microchip"></i>
{% trans "Switches" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-model-switch' %}"><i
class="fa fa-object-group"></i>
{% trans "Switch models" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-module' %}"><i
class="fa fa-puzzle-piece"></i>
{% trans "Switch modules" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-switch-bay' %}"><i class="fa fa-wrench"></i>
{% trans "Switch bays" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-stack' %}"><i class="fa fa-server"></i>
{% trans "Stacks" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-port-profile' %}"><i
class="fa fa-cog"></i>
{% trans "Port profiles" %}</a></li>
</ul>
</li>
<li><a class="dropdown-item" href="#"><i class="fa fa-building"></i>
{% trans "Infrastructure" %}
&raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'topologie:index-dormitory' %}"><i class="fa fa-bank"></i>
{% trans "Dormitories" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-building' %}"><i class="fa fa-home"></i>
{% trans "Buildings" %}</a></li>
<li><a class="dropdown-item" href="{% url 'topologie:index-room' %}"><i
class="fa fa-bed"></i>
{% trans "Rooms" %}</a></li>
</ul>
</li>
<li><a class="dropdown-item" href="{% url 'topologie:index-ap' %}"><i class="fa fa-wifi"></i>
{% trans "Access points" %}</a></li>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app == 'topologie' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}
{% can_view_app logs %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-area-chart"></i>
{% trans "Statistics" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{% url 'logs:index' %}"><i class="fa fa-clipboard"></i>
{% trans "Summary" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-logs' %}"><i class="fa fa-calendar"></i>
{% trans "Events" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-general' %}"><i class="fa fa-area-chart"></i>
{% trans "General" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-models' %}"><i class="fa fa-database"></i>
{% trans "Database" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-users' %}"><i class="fa fa-plug"></i>
{% trans "Wiring actions" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-actions' %}"><i class="fa fa-users"></i>
{% trans "Users" %}</a></li>
<li><a class="dropdown-item" href="{% url 'logs:stats-search-machine' %}"><i class="fa fa-laptop"></i>
{% trans "Machine history" %}</a></li>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app == 'logs' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}
{% can_view_any_app preferences users machines %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-cogs"></i>
{% trans "Administration" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
{% can_view_app preferences %}
<li><a class="dropdown-item" href="{% url 'preferences:display-options' %}"><i
class="fa fa-cogs"></i>
{% trans "General" %}</a></li>
{% acl_end %}
{% can_view_app users %}
<li><a class="dropdown-item" href="{% url 'users:index-serviceusers' %}"><i
class="fa fa-address-book"></i>
{% trans "LDAP service users" %}</a></li>
{% acl_end %}
{% can_view_app machines %}
<li><a class="dropdown-item" href="{% url 'machines:index-service' %}"><i
class="fa fa-wrench"></i>
{% trans "Services" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-machinetype' %}"><i
class="fa fa-laptop"></i>
{% trans "Machine types" %}</a></li>
<li><a class="dropdown-item" href="#"><i class="fa fa-globe"></i>
{% trans "Network" %} &raquo </a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="{% url 'machines:index-iptype' %}"><i
class="fa fa-ellipsis-h"></i>
{% trans "IP ranges" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-vlan' %}"><i
class="fa fa-object-group"></i>
{% trans "VLANs" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-extension' %}"><i
class="fa fa-wrench"></i>
{% trans "Extensions and zones" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-nas' %}"><i
class="fa fa-certificate"></i>
{% trans "NAS" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-role' %}"><i
class="fa fa-server"></i>
{% trans "Server roles" %}</a></li>
<li><a class="dropdown-item" href="{% url 'machines:index-portlist' %}"><i
class="fa fa-cog"></i>
{% trans "Ports openings" %}</a></li>
</ul>
</li>
{% acl_end %}
</ul>
</li>
{% acl_end %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a>
{% if not request.user.is_authenticated %}
{% for template in optionnal_templates_navbar_logout_list %}
{{ template }}
{% endfor %}
{% if var_sa %}
<li>
<a href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i> {% trans "Sign up" %}
</a>
</li>
{% endif %}
<li>
<a id="toggle_login" href="{% url 'login' %}">
<i class="fa fa-sign-in"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
{% can_view_any_app users machines cotisations %}
<li>
<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>
</li>
{% acl_end %}
{% 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>
<li><a id="toggle_login" href="{% url 'logout' %}"><i class="fa fa-sign-out"></i>
{% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
<li>
{% include 'buttons/setlang.html' %}
</li>
</ul>
</div>
</div>
</nav>

136
templates/sidebar.html Normal file
View file

@ -0,0 +1,136 @@
{% 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 Lara 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 %}
{% load i18n %}
<div class="panel panel-default">
{% if request_user.is_authenticated %}
<div class="panel-heading">
<h4>{{ request_user.name }} {{ request_user.surname }}</h4>
</div>
<table class="table visible-sm visible-md">
<tr>
<td>
<b>{% trans "Username" %}</b>
<br>
{{ request_user.pseudo }}
</td>
</tr>
<tr>
<td>
<b>{% trans "Room" %}</b>
<br>
{{ request_user.room }}
</td>
</tr>
<tr>
<td>
<b>{% trans "Internet access" %}</b>
<br>
{% if request_user.has_access %}
<i class="text-success">{% blocktrans with end_access_date=request.user.end_access|date:"d b Y" %}Until
{{ end_access_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Disabled" %}</i>
{% endif %}
</td>
</tr>
<tr>
<td>
<b>{% trans "Membership" %}</b>
<br>
{% if request_user.is_adherent %}
<i class="text-success">{% blocktrans with end_adhesion_date=request_user.end_adhesion|date:"d b Y" %}Until
{{ end_adhesion_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Non member" %}</i>
{% endif %}
</td>
</tr>
</table>
<table class="table visible-xs visible-lg">
<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>
<th scope="row">{% trans "Internet access" %}</th>
<td class="text-right">
{% if request_user.has_access %}
<i class="text-success">{% blocktrans with end_access_date=request.user.end_access|date:"d b Y" %}Until
{{ end_access_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 end_adhesion_date=request_user.end_adhesion|date:"d b Y" %}Until
{{ end_adhesion_date }}{% endblocktrans %}</i>
{% else %}
<i class="text-danger">{% trans "Non 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>
{% trans "View my profile" %}
</a>
</div>
{% else %}
<div class="panel-body">
<p>{% trans "You are not logged in." %}</p>
</div>
{% endif %}
</div>
{% 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" style="word-break: break-all">{{ 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 %}

View file

@ -0,0 +1,42 @@
{% extends 'topologie/sidebar.html' %}
{% 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 Gabriel Détraz
Copyright © 2017 Lara 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 %}
{% load bootstrap3 %}
{% load acl %}
{% load i18n %}
{% block title %}{% trans "Topology" %}{% endblock %}
{% block content %}
<h2>{% trans "Buildings" %}</h2>
{% can_create Building %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-building' %}">
<i class="fa fa-plus"></i> {% trans "Add a building" %}
</a>
<hr>
{% acl_end %}
{% include 'topologie/aff_building.html' with building_list=building_list %}
{% endblock %}

View file

@ -30,33 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Topology" %}{% endblock %}
{% block content %}
<h2>{% trans "Stacks" %}</h2>
{% can_create Stack %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-stack' %}">
<i class="fa fa-plus"></i> {% trans "Add a stack" %}
</a>
{% acl_end %}
{% include 'topologie/aff_stacks.html' with stack_list=stack_list %}
<h2>{% trans "Switch bays" %}</h2>
{% can_create SwitchBay %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch-bay' %}">
<i class="fa fa-plus"></i> {% trans "Add a switch bay" %}
</a>
<hr>
{% acl_end %}
{% include 'topologie/aff_switch_bay.html' with switch_bay_list=switch_bay_list %}
<h2>{% trans "Buildings" %}</h2>
{% can_create Building %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-building' %}">
<i class="fa fa-plus"></i> {% trans "Add a building" %}
</a>
<hr>
{% acl_end %}
{% include 'topologie/aff_building.html' with building_list=building_list %}
<h2>{% trans "Dormitories" %}</h2>
{% can_create Dormitory %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-dormitory' %}">

View file

@ -0,0 +1,41 @@
{% extends 'topologie/sidebar.html' %}
{% 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 Gabriel Détraz
Copyright © 2017 Lara 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 %}
{% load bootstrap3 %}
{% load acl %}
{% load i18n %}
{% block title %}{% trans "Topology" %}{% endblock %}
{% block content %}
<h2>{% trans "Stacks" %}</h2>
{% can_create Stack %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-stack' %}">
<i class="fa fa-plus"></i> {% trans "Add a stack" %}
</a>
{% acl_end %}
{% include 'topologie/aff_stacks.html' with stack_list=stack_list %}
{% endblock %}

View file

@ -0,0 +1,42 @@
{% extends 'topologie/sidebar.html' %}
{% 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 Gabriel Détraz
Copyright © 2017 Lara 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 %}
{% load bootstrap3 %}
{% load acl %}
{% load i18n %}
{% block title %}{% trans "Topology" %}{% endblock %}
{% block content %}
<h2>{% trans "Switch bays" %}</h2>
{% can_create SwitchBay %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch-bay' %}">
<i class="fa fa-plus"></i> {% trans "Add a switch bay" %}
</a>
<hr>
{% acl_end %}
{% include 'topologie/aff_switch_bay.html' with switch_bay_list=switch_bay_list %}
{% endblock %}

View file

@ -23,36 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load i18n %}
{% block sidebar %}
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-room' %}">
<i class="fa fa-home"></i>
{% trans "Rooms and premises" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index' %}">
<i class="fa fa-microchip"></i>
{% trans "Switches" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-module' %}">
<i class="fa fa-microchip"></i>
{% trans "Switch modules" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-port-profile' %}">
<i class="fa fa-cogs"></i>
{% trans "Port profiles" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-ap' %}">
<i class="fa fa-wifi"></i>
{% trans "Access points" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-physical-grouping' %}">
<i class="fa fa-list-ul"></i>
{% trans "Physical grouping" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url 'topologie:index-model-switch' %}">
<i class="fa fa-list-ul"></i>
{% trans "Switch models and constructors" %}
</a>
{% endblock %}

View file

@ -49,9 +49,24 @@ urlpatterns = [
url(r"^edit_switch/(?P<switchid>[0-9]+)$", views.edit_switch, name="edit-switch"),
url(r"^new_stack/$", views.new_stack, name="new-stack"),
url(
r"^index_physical_grouping/$",
views.index_physical_grouping,
name="index-physical-grouping",
r"^index_stack/$",
views.index_stack,
name="index-stack",
),
url(
r"^index_switch_bay/$",
views.index_switch_bay,
name="index-switch-bay",
),
url(
r"^index_building/$",
views.index_building,
name="index-building",
),
url(
r"^index_dormitory/$",
views.index_dormitory,
name="index-dormitory",
),
url(r"^edit_stack/(?P<stackid>[0-9]+)$", views.edit_stack, name="edit-stack"),
url(r"^del_stack/(?P<stackid>[0-9]+)$", views.del_stack, name="del-stack"),

View file

@ -242,35 +242,12 @@ def index_ap(request):
@login_required
@can_view_all(Stack, Building, Dormitory, SwitchBay)
def index_physical_grouping(request):
"""View used to display the list of stacks (display all switches)."""
stack_list = Stack.objects.prefetch_related(
"switch_set__interface_set__domain__extension"
)
building_list = Building.objects.all().select_related("dormitory")
dormitory_list = Dormitory.objects.all().prefetch_related("building_set")
@can_view_all(SwitchBay)
def index_switch_bay(request):
"""View used to display the list of switch bays."""
switch_bay_list = SwitchBay.objects.select_related(
"building__dormitory"
).prefetch_related("switch_set__interface_set__domain")
stack_list = SortTable.sort(
stack_list,
request.GET.get("col"),
request.GET.get("order"),
SortTable.TOPOLOGIE_INDEX_STACK,
)
building_list = SortTable.sort(
building_list,
request.GET.get("col"),
request.GET.get("order"),
SortTable.TOPOLOGIE_INDEX_BUILDING,
)
dormitory_list = SortTable.sort(
dormitory_list,
request.GET.get("col"),
request.GET.get("order"),
SortTable.TOPOLOGIE_INDEX_DORMITORY,
)
switch_bay_list = SortTable.sort(
switch_bay_list,
request.GET.get("col"),
@ -279,15 +256,64 @@ def index_physical_grouping(request):
)
return render(
request,
"topologie/index_physical_grouping.html",
"topologie/index_switch_bay.html",
{
"stack_list": stack_list,
"switch_bay_list": switch_bay_list,
"building_list": building_list,
"dormitory_list": dormitory_list,
},
)
@login_required
@can_view_all(Stack)
def index_stack(request):
"""View used to display the list of stacks (display all switches)."""
stack_list = Stack.objects.prefetch_related(
"switch_set__interface_set__domain__extension"
)
return render(
request,
"topologie/index_stack.html",
{
"stack_list": stack_list,
},
)
@login_required
@can_view_all(Building)
def index_building(request):
"""View used to display the list of buildings"""
building_list = Building.objects.all().select_related("dormitory")
building_list = SortTable.sort(
building_list,
request.GET.get("col"),
request.GET.get("order"),
SortTable.TOPOLOGIE_INDEX_BUILDING,
)
return render(
request,
"topologie/index_building.html",
{
"building_list": building_list,
},
)
@login_required
@can_view_all(Dormitory)
def index_dormitory(request):
"""View used to display the list of dormitories."""
dormitory_list = Dormitory.objects.all().prefetch_related("building_set")
dormitory_list = SortTable.sort(
dormitory_list,
request.GET.get("col"),
request.GET.get("order"),
SortTable.TOPOLOGIE_INDEX_DORMITORY,
)
return render(
request,
"topologie/index_dormitory.html",
{
"dormitory_list": dormitory_list,
},
)
@login_required
@can_view_all(ModelSwitch, ConstructorSwitch)
@ -440,7 +466,7 @@ def new_stack(request):
if stack.is_valid():
stack.save()
messages.success(request, _("The stack was created."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-stack"))
return form(
{"topoform": stack, "action_name": _("Add")}, "topologie/topo.html", request
)
@ -455,7 +481,7 @@ def edit_stack(request, stack, **_kwargs):
if stack.changed_data:
stack.save()
messages.success(request, _("The stack was edited."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-stack"))
return form(
{"topoform": stack, "action_name": _("Edit")}, "topologie/topo.html", request
)
@ -480,7 +506,7 @@ def del_stack(request, stack, **_kwargs):
% stack
),
)
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-stack"))
return form({"objet": stack}, "topologie/delete.html", request)
@ -847,7 +873,7 @@ def new_switch_bay(request):
if switch_bay.is_valid():
switch_bay.save()
messages.success(request, _("The switch bay was created."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-switch-bay"))
return form(
{"topoform": switch_bay, "action_name": _("Add")},
"topologie/topo.html",
@ -864,7 +890,7 @@ def edit_switch_bay(request, switch_bay, **_kwargs):
if switch_bay.changed_data:
switch_bay.save()
messages.success(request, _("The switch bay was edited."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-switch-bay"))
return form(
{"topoform": switch_bay, "action_name": _("Edit")},
"topologie/topo.html",
@ -891,7 +917,7 @@ def del_switch_bay(request, switch_bay, **_kwargs):
% switch_bay
),
)
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-switch-bay"))
return form(
{"objet": switch_bay, "objet_name": _("switch bay")},
"topologie/delete.html",
@ -907,7 +933,7 @@ def new_building(request):
if building.is_valid():
building.save()
messages.success(request, _("The building was created."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-building"))
return form(
{"topoform": building, "action_name": _("Add")},
"topologie/topo.html",
@ -924,7 +950,7 @@ def edit_building(request, building, **_kwargs):
if building.changed_data:
building.save()
messages.success(request, _("The building was edited."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-building"))
return form(
{"topoform": building, "action_name": _("Edit")}, "topologie/topo.html", request
)
@ -949,7 +975,7 @@ def del_building(request, building, **_kwargs):
% building
),
)
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-building"))
return form(
{"objet": building, "objet_name": _("building")},
"topologie/delete.html",
@ -965,7 +991,7 @@ def new_dormitory(request):
if dormitory.is_valid():
dormitory.save()
messages.success(request, _("The dormitory was created."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-dormitory"))
return form(
{"topoform": dormitory, "action_name": _("Add")},
"topologie/topo.html",
@ -982,7 +1008,7 @@ def edit_dormitory(request, dormitory, **_kwargs):
if dormitory.changed_data:
dormitory.save()
messages.success(request, _("The dormitory was edited."))
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-dormitory"))
return form(
{"topoform": dormitory, "action_name": _("Edit")},
"topologie/topo.html",
@ -1009,7 +1035,7 @@ def del_dormitory(request, dormitory, **_kwargs):
% dormitory
),
)
return redirect(reverse("topologie:index-physical-grouping"))
return redirect(reverse("topologie:index-dormitory"))
return form(
{"objet": dormitory, "objet_name": _("dormitory")},
"topologie/delete.html",

View file

@ -26,73 +26,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load i18n %}
{% block sidebar %}
{% if request.user.is_authenticated%}
{% can_create Club %}
<a class="list-group-item list-group-item-success" href="{% url 'users:new-club' %}">
<i class="fa fa-plus"></i>
{% trans "Create a club or organisation" %}
</a>
{% acl_end %}
{% can_create Adherent %}
<a class="list-group-item list-group-item-success" href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i>
{% trans "Create a user" %}
</a>
{% acl_end %}
{% endif %}
{% can_view_all Club %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-clubs' %}">
<i class="fa fa-list-ul"></i>
{% trans "Clubs and organisations" %}
</a>
{% acl_end %}
{% can_view_all Adherent %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index' %}">
<i class="fa fa-list-ul"></i>
{% trans "Users" %}
</a>
{% acl_end %}
{% can_view_all Ban %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-ban' %}">
<i class="fa fa-list-ul"></i>
{% trans "Bans" %}
</a>
{% acl_end %}
{% can_view_all Whitelist %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-white' %}">
<i class="fa fa-list-ul"></i>
{% trans "Whitelists" %}
</a>
{% acl_end %}
{% can_view_all School %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-school' %}">
<i class="fa fa-list-ul"></i>
{% trans "Schools" %}
</a>
{% acl_end %}
{% can_view_all ListShell %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-shell' %}">
<i class="fa fa-list-ul"></i>
{% trans "Shells" %}
</a>
{% acl_end %}
{% can_view_all ListRight %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-listright' %}">
<i class="fa fa-list-ul"></i>
{% trans "Groups of rights" %}
</a>
{% acl_end %}
{% can_view_all ServiceUser %}
<a class="list-group-item list-group-item-info" href="{% url 'users:index-serviceusers' %}">
<i class="fa fa-list-ul"></i>
{% trans "Service users" %}
</a>
{% acl_end %}
{% can_change User state %}
<a class="list-group-item list-group-item-danger" href="{% url 'users:mass-archive' %}">
<i class="fa fa-archive"></i>
{% trans "Massively archive" %}
</a>
{% acl_end %}
{% endblock %}