From c061d1c3044be52c59ce72aa436278bac9e21c05 Mon Sep 17 00:00:00 2001 From: Lars van Rhijn Date: Wed, 4 Oct 2023 20:21:43 +0200 Subject: [PATCH 1/8] Fix scroll bug and add success/error messages --- marietje/queues/templates/queues/queue.html | 37 ++++++++++++++------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/marietje/queues/templates/queues/queue.html b/marietje/queues/templates/queues/queue.html index be7c2ad..f9e857e 100644 --- a/marietje/queues/templates/queues/queue.html +++ b/marietje/queues/templates/queues/queue.html @@ -93,17 +93,22 @@ - - +
+
+ + - - - - - + + +
+
+ + +
+
@@ -352,7 +357,11 @@ "Content-Type": 'application/json', }, } - ).finally(() => { + ).then(() => { + tata.success("", "Removed song from the queue."); + }).catch(() => { + tata.error("", "An error occurred while removing the song, please try again."); + }).finally(() => { this.refresh(); }); }, @@ -367,7 +376,11 @@ "Content-Type": 'application/json', }, } - ).finally(() => { + ).then(() => { + tata.success("", "Song was moved successfully."); + }).catch(() => { + tata.error("", "An error occurred while moving the song, please try again."); + }).finally(() => { this.refresh(); }); } From 7a1b0583a6de2efe39632dc85bd5269112bd4985 Mon Sep 17 00:00:00 2001 From: Lars van Rhijn Date: Wed, 4 Oct 2023 20:41:00 +0200 Subject: [PATCH 2/8] Store page size on manage and request pages --- marietje/marietje/static/marietje/js/base.js | 24 ++++++++++++++++++- .../marietje/templates/marietje/base.html | 7 +++--- marietje/queues/templates/queues/queue.html | 5 ++++ marietje/songs/templates/songs/manage.html | 5 ++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/marietje/marietje/static/marietje/js/base.js b/marietje/marietje/static/marietje/js/base.js index f008583..e28d9a2 100644 --- a/marietje/marietje/static/marietje/js/base.js +++ b/marietje/marietje/static/marietje/js/base.js @@ -36,4 +36,26 @@ Number.prototype.timestampToHHMMSS = function () { seconds = '0' + seconds; } return hours + ':' + minutes + ':' + seconds; -}; \ No newline at end of file +}; + +function setCookie(name, value, days) { + let expires = ""; + value = encodeURI(value); + if (days) { + let date = new Date(); + date.setTime(date.getTime() + (days*24*60*60*1000)); + expires = "; expires=" + date.toUTCString(); + } + document.cookie = name + "=" + (value || "") + expires + "; path=/"; +} + +function getCookie(name) { + let nameEQ = name + "="; + let ca = document.cookie.split(';'); + for(let i=0;i < ca.length;i++) { + let c = ca[i]; + while (c.charAt(0)===' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length,c.length)); + } + return null; +} \ No newline at end of file diff --git a/marietje/marietje/templates/marietje/base.html b/marietje/marietje/templates/marietje/base.html index d7bc93c..edba2ff 100644 --- a/marietje/marietje/templates/marietje/base.html +++ b/marietje/marietje/templates/marietje/base.html @@ -22,6 +22,10 @@ + +