From 7629eed323324402e1cc7a56f381c4ed155d93fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Wed, 21 Aug 2019 22:39:42 +0200 Subject: [PATCH] Inprovements to entry disabling. --- app/templates/main_admin.html | 2 +- app/templates/songlist.html | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/templates/main_admin.html b/app/templates/main_admin.html index 8a28ab6..52cd764 100644 --- a/app/templates/main_admin.html +++ b/app/templates/main_admin.html @@ -43,7 +43,7 @@ $(function () { $('[data-toggle="tooltip"]').tooltip(); $('#entryToggle').change(function() { - $.ajax({url: "/api/entries/accept/"+($('#entryToggle').is(":checked") ? "1" : "0"), complete: refreshEntryToggle}); + $.ajax({url: "/api/entries/accept/"+($('#entryToggle').is(":checked") ? "1" : "0"), complete: setTimeout(refreshEntryToggle, 500)}); }) refreshEntryToggle(); }) diff --git a/app/templates/songlist.html b/app/templates/songlist.html index 01d420f..c91612e 100644 --- a/app/templates/songlist.html +++ b/app/templates/songlist.html @@ -56,18 +56,13 @@ $("#songtable").html("") $(items.join("")).appendTo("#songtable"); + entriesAccepted() }); } else { $("#songtable").html("") } }); - $.getJSON("/api/entries/accept", (data) => { - if (data["value"]==0) { - $("#filter").prop("disabled",true); - } - }) - $("#nameForm").submit( function (e) { e.preventDefault(); submitModal(); @@ -114,5 +109,12 @@ } + + function entriesAccepted() { + $.getJSON("/api/entries/accept", (data,out) => { + $(".enqueueButton").prop("disabled",!data["value"]) + }) + } + {% endblock %} \ No newline at end of file