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 { main section {
background-color: whitesmoke; background-color: whitesmoke;
padding: 5%; padding: 2% 5%;
border-radius: 0.5em; border-radius: 0.5em;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 1px 5px 0 rgba(0, 0, 0, 0.12); 0 1px 5px 0 rgba(0, 0, 0, 0.12);
} }
h2 {
font-size: 16px;
margin: 0;
cursor: pointer;
}
#avail_sites { #avail_sites {
margin: 0; margin: 0;
padding-left: 1em; 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) { function perm_change(row) {
let user_perms = users_perms[row.children[0].textContent]; let user_perms = users_perms[row.children[0].textContent];
let row_perms = []; let row_perms = [];

View File

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