New HTML Directory

This commit is contained in:
MrArmonius 2021-07-21 21:22:29 +02:00 committed by Alex Auvolat
parent b1ce932cd6
commit 819d7bf02f
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1
4 changed files with 44 additions and 7 deletions

View file

@ -1,8 +1,8 @@
function searchDirectory() { function searchDirectory() {
var input = document.getElementById("search").value; var input = document.getElementById("search").value;
if(input){
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() { xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) { if (this.readyState == 4 && this.status == 201) {
// Typical action to be performed when the document is ready: // Typical action to be performed when the document is ready:
//Response from Request Ajax //Response from Request Ajax
@ -26,10 +26,12 @@ function searchDirectory() {
} }
old_table.parentNode.replaceChild(table, old_table) old_table.parentNode.replaceChild(table, old_table)
} }
}; };
xhttp.overrideMimeType("application/json"); xhttp.overrideMimeType("application/json");
xhttp.open("GET", "/search/".concat(input), true); xhttp.open("GET", "/search/".concat(input), true);
xhttp.send(); xhttp.send();
}

33
templates/directory.html Normal file
View file

@ -0,0 +1,33 @@
{{define "title"}}Directory |{{end}}
{{define "body"}}
<div class="d-flex">
<h4>Directory</h4>
<a class="ml-auto btn btn-info" href="/">Menu principal</a>
</div>
<div class="d-flex">
<div class="d-flex mx-auto">
<p class="">Name:</p>
<form class="px-2" style="width: fit-content;">
<input id="search" type="text" onkeyup="searchDirectory()" size="20">
</form>
</div>
</div>
<table class="table mt-4">
<thead>
<th scope="col">Identifiant</th>
<th scope="col">Nom complet</th>
<th scope="col">Email</th>
</thead>
<tbody id="users">
</tbody>
</table>
<script src="/static/javascript/search.js"></script>
{{end}}

View file

@ -16,6 +16,7 @@
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action" href="/profile">Modifier mon profil</a> <a class="list-group-item list-group-item-action" href="/profile">Modifier mon profil</a>
<a class="list-group-item list-group-item-action" href="/passwd">Modifier mon mot de passe</a> <a class="list-group-item list-group-item-action" href="/passwd">Modifier mon mot de passe</a>
<a class="list-group-item list-group-item-action" href="/directory">Annuaire</a>
</div> </div>
</div> </div>

View file

@ -6,6 +6,7 @@
<link rel="stylesheet" href="/static/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/css/bootstrap.min.css">
<title>{{template "title"}} Guichet</title> <title>{{template "title"}} Guichet</title>
</head> </head>
<body> <body>