mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
The Users, Groups and Removed VMs pages were bare tables: rows of coloured icon buttons without words, five columns of small checks for a user's role and permissions, dates broken over three lines and a lone "+" for a new entry. The owner chose a directory layout from three rendered options; it follows the host pages' cards: - Each list is a card with its count and search in the header and one list-group item per entry, which stacks on a phone without scrolling. - A user shows their role as a badge (Superuser, Template editor) or "User", Blocked as a red badge, their groups, a granted clone permission and live API tokens, and the last login on one line; role and status are searchable. Edit is the visible action, the menu holds View profile, Block or Unblock and Delete; Block and Delete are disabled on one's own account, which the server refuses anyway. - A group shows its member and permission counts; its name opens it. The page's title said "Users". - A removed VM shows its UUID, the host it left, its owners and when the record was made and expires. - Logs keep their table in a card, the server search in its header, the count of matching rows, Done and Failed as badges, and a message column wide enough to read on a phone. The user form was one long column of horizontal fields. The owner rejected three boxed layouts and chose one led by what the user may do: the Active switch, Template editor and Superuser as two cards, groups as chips, the user's own permissions as switches each saying what it allows, then the name and password and the quota folded into details whose summaries tell their values (-1 as "any"); they open on a new user and on an error inside them. A refused group or permission is said beside its field. The group form follows it: the name, what its members may do, its members as chips. Cancel goes back to the list instead of the browser history.
50 lines
2.3 KiB
HTML
50 lines
2.3 KiB
HTML
{% extends "base.html" %}
|
|
{% load django_bootstrap5 %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{{ title }}{% endblock %}
|
|
|
|
{% block page_heading %}{{ title }}{% endblock page_heading %}
|
|
|
|
{% block content %}
|
|
{# as the user form: what the members may do first, then who they are #}
|
|
<form id="create-update" method="post">
|
|
{% csrf_token %}
|
|
{% bootstrap_form_errors form type="non_fields" %}
|
|
{% bootstrap_field form.name %}
|
|
|
|
<h4 class="h5 mb-1">{% trans "What can its members do?" %}</h4>
|
|
<p class="small text-body-secondary mb-2">{% trans "Each member has these permissions besides their own." %}</p>
|
|
<div class="border-top mb-4">
|
|
{% for box, help in form.permission_rows %}
|
|
<div class="form-check form-switch border-bottom py-2 ps-5">
|
|
<input id="{{ box.id_for_label }}" class="form-check-input" type="checkbox" role="switch" name="permissions"
|
|
value="{{ box.data.value }}"{% if box.data.selected %} checked{% endif %}>
|
|
<label class="form-check-label" for="{{ box.id_for_label }}">
|
|
<span class="d-block">{{ box.data.value.instance.name }}</span>
|
|
<span class="small text-body-secondary">{{ help }}</span>
|
|
</label>
|
|
</div>
|
|
{% endfor %}
|
|
{% for error in form.permissions.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
|
|
</div>
|
|
|
|
<fieldset class="mb-3">
|
|
<legend class="fs-6 fw-semibold">{% trans "Members" %}</legend>
|
|
<div class="d-flex flex-wrap gap-2">
|
|
{% for box in form.users %}
|
|
<label class="border rounded px-2 py-1 text-break">
|
|
<input id="{{ box.id_for_label }}" class="form-check-input me-1" type="checkbox" name="users" value="{{ box.data.value }}"{% if box.data.selected %} checked{% endif %}>
|
|
{{ box.choice_label }}
|
|
</label>
|
|
{% endfor %}
|
|
</div>
|
|
{% for error in form.users.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
|
|
</fieldset>
|
|
|
|
<div class="d-flex justify-content-end gap-2 mt-3">
|
|
<a class="btn btn-outline-secondary" href="{% url 'admin:group_list' %}">{% trans "Cancel" %}</a>
|
|
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
|
</div>
|
|
</form>
|
|
{% endblock content %}
|