feature/21 :: Added ordered row numbers to tables

This commit is contained in:
Rene 2022-09-27 17:34:25 -06:00
parent 0c49949a5d
commit a5e37cde98
3 changed files with 113 additions and 94 deletions

View file

@ -11,6 +11,19 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
<!-- JavaScript Bundle with Popper --> <!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<style>
table {
counter-reset: rowNumber;
}
table td.row-index::before {
display: table-cell;
counter-increment: rowNumber;
content: counter(rowNumber) ".";
padding-right: 0.3em;
text-align: right;
}
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-sm navbar-dark bg-primary"> <nav class="navbar navbar-expand-sm navbar-dark bg-primary">

View file

@ -12,6 +12,7 @@
<p>Scanning interfaces: {{ .Config.Iface }}</p> <p>Scanning interfaces: {{ .Config.Iface }}</p>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>#</th>
<th>Name</th> <th>Name</th>
<th>Ip</th> <th>Ip</th>
<th>Mac</th> <th>Mac</th>
@ -21,6 +22,7 @@
{{ range .Hosts }} {{ range .Hosts }}
{{ if eq .Now 1 }} {{ if eq .Now 1 }}
<tr> <tr>
<td class="row-index"></td>
<td>{{ .Name }}</td> <td>{{ .Name }}</td>
<td><a href="http://{{ .Ip }}" target="_blank">{{ .Ip }}</a></td> <td><a href="http://{{ .Ip }}" target="_blank">{{ .Ip }}</a></td>
<td>{{ .Mac }}</td> <td>{{ .Mac }}</td>
@ -36,9 +38,11 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
</table> </table>
<h2>Log</h2> <h2>Log</h2>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>#</th>
<th>Name</th> <th>Name</th>
<th>Ip</th> <th>Ip</th>
<th>Mac</th> <th>Mac</th>
@ -50,6 +54,7 @@
<form action="/update_host/" method="post"> <form action="/update_host/" method="post">
<input name="id" type="hidden" class="form-control" value="{{ .Id }}"> <input name="id" type="hidden" class="form-control" value="{{ .Id }}">
<tr> <tr>
<td class="row-index"></td>
<td> <td>
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}"> <input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
</td> </td>

View file

@ -10,6 +10,7 @@
<div class="container mt-3"> <div class="container mt-3">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>#</th>
<form action="/sort_hosts/" method="post"> <form action="/sort_hosts/" method="post">
<th>Name<br> <th>Name<br>
<button type="submit" name="sort_method" value="name-up" class="btn btn-primary btn-sm"> <button type="submit" name="sort_method" value="name-up" class="btn btn-primary btn-sm">
@ -51,6 +52,7 @@
<form action="/update_host/" method="post"> <form action="/update_host/" method="post">
<input name="id" type="hidden" class="form-control" value="{{ .Id }}"> <input name="id" type="hidden" class="form-control" value="{{ .Id }}">
<tr> <tr>
<td class="row-index"></td>
<td> <td>
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}"> <input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
</td> </td>
@ -70,6 +72,5 @@
{{ end }} {{ end }}
</table> </table>
</div> </div>
{{ template "footer" }} {{ template "footer" }}
{{ end }} {{ end }}