From e7ef899bb3df55b19f48208c884f4265f7f07003 Mon Sep 17 00:00:00 2001 From: oslomp Date: Thu, 10 Jan 2019 19:04:37 +0100 Subject: [PATCH] Improving alert box Fixed error with the cancel button and upgraded the returned messages --- marietje/marietje/static/js/queue.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/marietje/marietje/static/js/queue.js b/marietje/marietje/static/js/queue.js index 1d6e209..e34df2b 100644 --- a/marietje/marietje/static/js/queue.js +++ b/marietje/marietje/static/js/queue.js @@ -49,13 +49,16 @@ $(function () { var songId = $(this).data('report-song-id'); var message = prompt("What is wrong with the song?"); if (message == "") { - alert("Please enter a message."); + createAlert('danger', 'Please enter a message.'); return false } + if (message == null) { + return false + } $.post('/api/report', {id: songId, msg: message, csrfmiddlewaretoken: csrf_token}, function (result) { console.log(result); if (result.success) { - alert("Thanks for the report!"); + createAlert('success', 'Thanks for your song report!'); } }); return false;