Refactor CID user group form: enhance layout with Bootstrap styling, improve error handling, and update user list presentation
This commit is contained in:
@@ -23,28 +23,46 @@
|
|||||||
<form action="" method="post" enctype="multipart/form-data" id="condition-form">
|
<form action="" method="post" enctype="multipart/form-data" id="condition-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<table>
|
<div class="card mb-3">
|
||||||
{{ form.as_table }}
|
<div class="card-body">
|
||||||
</table>
|
<div class="row">
|
||||||
<input type="submit" class="submit-button" value="Submit" name="submit">
|
<div class="col-12 col-md-8">
|
||||||
|
{% for field in form.visible_fields %}
|
||||||
|
<div class="mb-3">
|
||||||
|
{{ field.label_tag }}
|
||||||
|
{{ field }}
|
||||||
|
{% if field.help_text %}
|
||||||
|
<div class="form-text text-muted">{{ field.help_text }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if field.errors %}
|
||||||
|
<div class="text-danger small">{{ field.errors|striptags }}</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div class="mt-2">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm">Save group</button>
|
||||||
|
<a href="{% url 'generic:manage_cids' %}" class="btn btn-link btn-sm ms-2">Manage CIDs</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-4">
|
||||||
{% if cidusergroup %}
|
{% if cidusergroup %}
|
||||||
<p>Users can be added to the group <a href="{% url 'generic:manage_cids' %}">here</a></p>
|
<div class="small text-muted mb-2">Users currently in this group</div>
|
||||||
|
<ul class="list-group list-group-flush small">
|
||||||
<h3>Users</h3>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{% for user in cidusergroup.ciduser_set.all %}
|
{% for user in cidusergroup.ciduser_set.all %}
|
||||||
<li><a href="{% url 'generic:update_cid' user.pk %}">{{user.cid}}</a>: {{user.name}} [{{user.email}} {{user.last_name}}] {{user.userprofile.grade}}</li>
|
<li class="list-group-item bg-transparent border-0 px-0 py-1">
|
||||||
|
<a href="{% url 'generic:update_cid' user.pk %}">{{ user.cid }}</a>
|
||||||
|
<div class="text-muted">{{ user.name }} · {{ user.email }}</div>
|
||||||
|
</li>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<li>Group currently has no users.</li>
|
<li class="list-group-item bg-transparent border-0 px-0 py-1 text-muted">Group currently has no users.</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
Count: {{cidusergroup.ciduser_set.count}}
|
<div class="small text-muted mt-2">Count: {{ cidusergroup.ciduser_set.count }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user