Implement CORS-fields in views & HTML, improve list rendering & selection

This commit is contained in:
Josako
2024-05-15 21:27:23 +02:00
parent ea23e8d327
commit 8c6d9bf5ca
13 changed files with 434 additions and 68 deletions

View File

@@ -0,0 +1,45 @@
{% extends 'base.html' %}
{% from "macros.html" import render_selectable_table %}
{% block title %}View Tenant Domains{% endblock %}
{% block content_title %}Select a domain{% endblock %}
{% block content_description %}Select the domain you'd like to action upon{% endblock %}
{% block content %}
<form action="{{ url_for('user_bp.handle_tenant_domain_action') }}" method="POST">
{{ render_selectable_table(headers=["ID", "Domain Name", "Valid To"], rows=tenant_domains, selectable=True, id="tenantDomainsTable") }}
<div class="form-group mt-3">
<button type="submit" name="action" value="edit_tenant_domain" class="btn btn-primary">Edit Selected Domain</button>
<!-- Additional buttons can be added here for other actions -->
</div>
</form>
{% endblock %}
{% block scripts %}
<script>
$(document).ready(function() {
$('#tenantDomainsTable').DataTable({
'columnDefs': [
{
'targets': 0,
'searchable': false,
'orderable': false,
'className': 'dt-body-center',
'render': function (data, type, full, meta) {
return '<input type="radio" name="user_id" value="' + $('<div/>').text(data).html() + '">';
}
},
{
'targets': 1,
'orderable': true,
},
{
'targets': 2,
'orderable': true,
},
],
'order': [[1, 'asc']]
});
});
</script>
{% endblock %}