collapsible sections

This commit is contained in:
iou1name 2019-09-25 12:51:36 -04:00
parent 2356c50fba
commit e3c33a7492
3 changed files with 95 additions and 59 deletions

View File

@ -22,13 +22,19 @@ main {
main section {
background-color: whitesmoke;
padding: 5%;
padding: 2% 5%;
border-radius: 0.5em;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
h2 {
font-size: 16px;
margin: 0;
cursor: pointer;
}
#avail_sites {
margin: 0;
padding-left: 1em;

View File

@ -1,3 +1,17 @@
function load() {
let headers = document.querySelectorAll('h2');
headers.forEach(function(header) {
header.addEventListener('click', function() {
let article = this.nextElementSibling;
if (article.style.display === 'none') {
article.style.display = '';
} else {
article.style.display = 'none';
}
});
});
}
function perm_change(row) {
let user_perms = users_perms[row.children[0].textContent];
let row_perms = [];

View File

@ -2,11 +2,12 @@
<html lang="en">
<head>
<title>Buckler</title>
<link rel="stylesheet" type="text/css" href="/static/buckler.css">
<script>
var users_perms = {{ users_json|safe }};
</script>
<script type="text/javascript" src="/static/buckler.js"></script>
<link rel="stylesheet" type="text/css" href="/static/buckler.css">
<script>window.onload = load;</script>
</head>
<body>
<header>
@ -15,15 +16,21 @@
</header>
<main>
<section>
Available sites
<h2>Available Sites</h2>
<article>
<hr>
<ul id="avail_sites">
{% for site in avail_sites %}
<li><a href="{{ site['url'] }}">{{ site['name'] }}</a></li>
{% endfor %}
</ul>
</article>
</section>
{% if request['session']['admin'] %}
<section>
<h2>User Permissions</h2>
<article>
<hr>
<table id="users">
<thead>
<tr>
@ -46,9 +53,13 @@
{% endfor %}
</tbody>
</table>
</article>
</section>
{% endif %}
<section>
<h2>Change Password</h2>
<article>
<hr>
<form action="{{ request.app.router['change_password'].url_for() }}" method="post" enctype="application/x-www-form-urlencoded">
<label for="current_password">Current password</label>
<input id="current_password" name="current_password" type="password"><br>
@ -58,8 +69,12 @@
<input id="verify_password" name="verify_password" type="password"><br>
<input type="submit" value="Submit">
</form>
</article>
</section>
<section>
<h2>Security Keys</h2>
<article>
<hr>
{% if fido2_keys %}
<table id="security_keys">
<thead>
@ -81,6 +96,7 @@
<span>No registered keys.</span>
{% endif %}
<br><a href="./add_key">Add key</a>
</article>
</section>
</main>
</body>