From 2f5e7b8366f17555009b8a33f4cafa08a79a52f9 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 22 May 2023 11:48:24 +0100 Subject: [PATCH] Automagically clear and focus ID field when audit modal closes Closes #533 --- assets/templates/asset_audit_list.html | 5 +++++ assets/templates/partials/asset_list_table.html | 2 +- templates/base_ajax.html | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/templates/asset_audit_list.html b/assets/templates/asset_audit_list.html index 057d2dae..73711dbb 100644 --- a/assets/templates/asset_audit_list.html +++ b/assets/templates/asset_audit_list.html @@ -35,6 +35,11 @@ function onAuditClick(assetID) { $('#' + assetID).remove(); } + $('#modal').on('hidden.bs.modal', function (e) { + searchbar = document.getElementById('id_q'); + searchbar.value = ""; + setTimeout(searchbar.focus(), 2000); + }) {% endblock %} diff --git a/assets/templates/partials/asset_list_table.html b/assets/templates/partials/asset_list_table.html index d5963b00..e5136eb4 100644 --- a/assets/templates/partials/asset_list_table.html +++ b/assets/templates/partials/asset_list_table.html @@ -12,7 +12,7 @@ {% for item in object_list %} - + {{ item.asset_id }} {{ item.description }} {{ item.category }} diff --git a/templates/base_ajax.html b/templates/base_ajax.html index 435b7607..1fd3fa46 100644 --- a/templates/base_ajax.html +++ b/templates/base_ajax.html @@ -17,7 +17,6 @@ e.preventDefault(); data = $(this).serialize(); action = $(this).attr('action'); - console.log(action) $.post(action, data, function(resp) { $('#modal').html(resp); });