From a9cec3a920f17d002641bbcb6441ad8faf090f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Wed, 17 Aug 2016 11:51:44 +0200 Subject: [PATCH] =?UTF-8?q?Option=20sur=20les=20reset=20K-Psul=20pour=20do?= =?UTF-8?q?nner=20le=20focus=20ou=20non=20=C3=A0=20input=20trigramme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kfet/templates/kfet/kpsul.html | 12 +++++------- kfet/views.py | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 9d809bd9..e311318a 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -769,7 +769,7 @@ $(document).ready(function() { // Reset functions - function coolReset() { + function coolReset(give_tri_focus=true) { resetAccountData(); articleId.val(0); articleSelect.val(''); @@ -777,16 +777,17 @@ $(document).ready(function() { displayMatchedArticles(articlesList); triInput.val(''); resetBasket(); + if (give_tri_focus) + triInput.focus(); } - function hardReset() { - coolReset(); + function hardReset(give_tri_focus=true) { + coolReset(give_tri_focus); articles_container.find('tr').remove(); articlesList = []; resetCheckoutData(); getArticlesData(); getHistory(); - } // Shorcuts @@ -796,7 +797,6 @@ $(document).ready(function() { case 112: // F1 - Cool reset coolReset(); - triInput.focus(); return false; case 113: // F2 - Deposit @@ -809,7 +809,6 @@ $(document).ready(function() { case 121: // F10 - Hard reset hardReset(); - triInput.focus(); return false; } }); @@ -819,7 +818,6 @@ $(document).ready(function() { // ----- hardReset(); - triInput.focus(); }); diff --git a/kfet/views.py b/kfet/views.py index 88b6247d..5ea708d3 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -408,7 +408,6 @@ def kpsul(request): data['checkout_form'] = KPsulCheckoutForm() operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none()) data['operation_formset'] = operation_formset - print(operation_formset.empty_form) return render(request, 'kfet/kpsul.html', data) @permission_required('kfet.is_team')