mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-15 09:12:21 +01:00
Song reporting and user stats
This commit is contained in:
committed by
Daan Sprenkels
parent
0c1f9cb08d
commit
f6fcc63450
@ -45,6 +45,22 @@ $(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', '[data-report-song-id]', function () {
|
||||
var songId = $(this).data('report-song-id');
|
||||
var message = prompt("What is wrong with the song?");
|
||||
if (message == "") {
|
||||
alert("Please enter a message.");
|
||||
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!");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#cancel-request').click(function () {
|
||||
hideRequestTable();
|
||||
});
|
||||
@ -267,7 +283,11 @@ function getSongs()
|
||||
$.each(songs, function (id, song) {
|
||||
var artist = song.artist.trim() === '' ? '?' : song.artist;
|
||||
var title = song.title.trim() === '' ? '?' : song.title;
|
||||
$('#request-table tbody:last-child').append('<tr><td>' + artist + '</td><td><a href="#" data-song-id="' + song.id + '">' + title + '</a></td><td>' + (song.uploader_name ? song.uploader_name : 'Marietje') + '</td><td style="text-align: right;">' + song.duration.secondsToMMSS() + '</td></tr>');
|
||||
$('#request-table tbody:last-child').append('<tr><td>' + artist +
|
||||
'</td><td><a href="#" data-song-id="' + song.id + '">' + title +
|
||||
'</a></td><td>' + (song.uploader_name ? song.uploader_name : 'Marietje') +
|
||||
'</td><td style="text-align: right;">' + song.duration.secondsToMMSS() +
|
||||
'</td><td><a href="#" data-report-song-id="'+ song.id + '">⚑</a></td></tr>');
|
||||
});
|
||||
var pageNumSelect = $('.pagenum');
|
||||
pageNumSelect.empty();
|
||||
@ -290,6 +310,7 @@ function getSongs()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function showRequestTable()
|
||||
{
|
||||
$('#request-button').text('Close');
|
||||
|
||||
Reference in New Issue
Block a user