1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00
webvirtcloud/templates/common/form.html
catborise aefe551450 feat(ui): the owner and VM lists of the ownership forms are searchable
The VM page's Add owner and a user's Add VM page listed every user and
every VM in a plain drop-down: with 800 users and 300 VMs one was found
by scrolling. They now have a search box (Tom Select, already used by the
create form), through searchable_select.js for a select with
data-searchable.

The box loses focus once an item is chosen: focused, it is a line taller,
and on a phone the tap on Save shrank it and moved the button away from
under the finger, so the first tap did nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 09:21:25 +03:00

40 lines
1.3 KiB
HTML

{% extends "base.html" %}
{% load django_bootstrap5 %}
{% load i18n %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block style %}
{% if searchable %}<link href="{% static 'css/tom-select.bootstrap5.min.css' %}" rel="stylesheet">{% endif %}
{% endblock style %}
{% block page_header %}
<div class="row justify-content-center">
<div class="col-lg-8"><h3 class="mb-3">{{ title }}</h3></div>
</div>
{% endblock page_header %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-8">
<form method="post">
{% csrf_token %}
<div class="card mb-3">
<div class="card-body">{% bootstrap_form form %}</div>
</div>
<div class="d-flex flex-wrap justify-content-end gap-2">
<a class="btn btn-outline-secondary" href="#" data-history-back>{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
</div>
</form>
</div>
</div>
{% endblock content %}
{% block script %}
{% if searchable %}{# its selects with data-searchable #}
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
<script src="{% static 'js/searchable_select.js' %}"></script>
{% endif %}
{% endblock script %}