admin panel

This commit is contained in:
iou1name 2019-09-27 13:57:00 -04:00
parent 8daf81ac46
commit 0f8f691a3e
3 changed files with 45 additions and 25 deletions

View File

@ -3,6 +3,7 @@ body {
margin-right: 10%; margin-right: 10%;
background-color: lightgray; background-color: lightgray;
font-family: Helvetica,sans-serif; font-family: Helvetica,sans-serif;
font-size: 14px;
} }
header { header {
@ -29,12 +30,21 @@ main section {
0 1px 5px 0 rgba(0, 0, 0, 0.12); 0 1px 5px 0 rgba(0, 0, 0, 0.12);
} }
h2 { .sub_section {
box-shadow: none;
border: 1px solid lightgray;
}
h2, h3 {
font-size: 16px; font-size: 16px;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
} }
h3 {
font-size: 14px;
}
#avail_sites { #avail_sites {
margin: 0; margin: 0;
padding-left: 1em; padding-left: 1em;

View File

@ -1,5 +1,10 @@
function load() { function load() {
let headers = document.querySelectorAll('h2'); let headers = document.querySelectorAll('h2');
headers = Array.prototype.slice.call(headers);
let headers3 = document.querySelectorAll('h3');
headers3 = Array.prototype.slice.call(headers3);
headers = headers.concat(headers3);
headers.forEach(function(header) { headers.forEach(function(header) {
header.addEventListener('click', function() { header.addEventListener('click', function() {
let article = this.nextElementSibling; let article = this.nextElementSibling;

View File

@ -30,31 +30,36 @@
</section> </section>
{% if request['session']['admin'] %} {% if request['session']['admin'] %}
<section> <section>
<h2>User Permissions</h2> <h2>Admin Panel</h2>
<article style="display: none;"> <article style="display: none;">
<hr> <section class="sub_section">
<table id="users"> <h3>User Permissions</h3>
<thead> <article style="display: none;">
<tr> <hr>
<th>User</th> <table id="users">
{% for app in apps %} <thead>
<th>{{ app['name'] }}</th> <tr>
{% endfor %} <th>User</th>
<th></th> {% for app in apps %}
</tr> <th>{{ app['name'] }}</th>
</thead> {% endfor %}
<tbody> <th></th>
{% for username, values in users.items() %} </tr>
<tr> </thead>
<td>{{ username }}</td> <tbody>
{% for name, value in values.items() %} {% for username, values in users.items() %}
<td><input aria-label="{{ username }}-{{ name }}" data-app-name={{ name }} type="checkbox" onchange="perm_change(this.parentElement.parentElement)"{% if value %} checked{% endif %}></td> <tr>
{% endfor %} <td>{{ username }}</td>
<td><input type="submit"></td> {% for name, value in values.items() %}
</tr> <td><input aria-label="{{ username }}-{{ name }}" data-app-name={{ name }} type="checkbox" onchange="perm_change(this.parentElement.parentElement)"{% if value %} checked{% endif %}></td>
{% endfor %} {% endfor %}
</tbody> <td><input type="submit"></td>
</table> </tr>
{% endfor %}
</tbody>
</table>
</article>
</section>
</article> </article>
</section> </section>
{% endif %} {% endif %}