mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-13 03:32:22 +01:00
Add maximum length a person can queue in a row.
This commit is contained in:
@ -32,8 +32,14 @@ $(function () {
|
||||
|
||||
$(document).on('click', '[data-song-id]', function () {
|
||||
var songId = $(this).data('song-id');
|
||||
$.post('/api/request', {id: songId, csrfmiddlewaretoken: csrf_token}, function () {
|
||||
refreshQueue();
|
||||
$.post('/api/request', {id: songId, csrfmiddlewaretoken: csrf_token}, function (result) {
|
||||
if(result.success) {
|
||||
refreshQueue();
|
||||
} else {
|
||||
// Close request table and show message.
|
||||
hideRequestTable();
|
||||
createAlert('danger', result.message);
|
||||
}
|
||||
});
|
||||
$(this).parent().text($(this).text());
|
||||
return false;
|
||||
@ -117,7 +123,6 @@ $(function () {
|
||||
$('#queue-time-header').text(showTimeToPlay ? 'Plays In' : 'Plays At');
|
||||
Cookies.set('showtimetoplay', showTimeToPlay ? '1' : '0');
|
||||
});
|
||||
|
||||
getSongs();
|
||||
});
|
||||
|
||||
@ -326,3 +331,14 @@ Number.prototype.timestampToHHMMSS = function () {
|
||||
}
|
||||
return hours + ':' + minutes + ':' + seconds;
|
||||
}
|
||||
|
||||
function createAlert(type, message) {
|
||||
alertText = '<div class="alert alert-' + type + ' alert-dismissable">'+
|
||||
'<button type="button" class="close" ' +
|
||||
'data-dismiss="alert" aria-hidden="true">' +
|
||||
'×' +
|
||||
'</button>' +
|
||||
message +
|
||||
'</div>';
|
||||
$('body > div.container').prepend(alertText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user