mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
style(admin): the user form asks who, what role, what quota, then what more
The create and edit pages of a user had one form for both, ordered for editing: permissions first, the name and password folded below them and the quota folded and closed at the end; a new user's name came last. Both pages now go Account (name, password, may sign in), Role, Quota, then Groups and permissions, each section with what it is for beside its fields. Template editor and Superuser become one Role choice with User: choosing Superuser hides the quota and permissions, which a superuser does not need (no quota check applies, every permission is theirs); it keeps the is_staff it had. The quota is always open: each limit takes a number from 0, or No limit, which is kept as -1 as before; memory is entered in GiB and kept in MiB, shown exactly so saving a user again changes nothing. The button says Create user or Save changes.
This commit is contained in:
parent
c9fe077fe8
commit
6523fd0955
13 changed files with 988 additions and 865 deletions
11
static/js/user_form.js
Normal file
11
static/js/user_form.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// The user form (admin/user_form.html): a superuser needs no quota or
|
||||
// permissions, so their sections hide while Superuser is chosen; a limit's
|
||||
// No limit box disables its number, which the server then keeps as -1.
|
||||
document.querySelectorAll('input[name=role]').forEach((radio) => radio.addEventListener('change', () => {
|
||||
const superuser = radio.value === 'superuser';
|
||||
document.querySelectorAll('[data-not-superuser]').forEach((section) => { section.hidden = superuser; });
|
||||
document.getElementById('superuser-note').hidden = !superuser;
|
||||
}));
|
||||
document.querySelectorAll('[data-no-limit]').forEach((box) => box.addEventListener('change', () => {
|
||||
document.getElementById(box.dataset.noLimit).disabled = box.checked;
|
||||
}));
|
||||
Loading…
Add table
Add a link
Reference in a new issue