1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Starting sortable playlist implmentation to re-order songs.

This commit is contained in:
SUTJael 2013-11-25 14:36:12 +01:00
parent 40ef2d3de7
commit 0599214703
3 changed files with 116 additions and 77 deletions

View file

@ -18,6 +18,10 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
/*********************/
/* Edit modal dialog */
/*********************/
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, edit_tag_choices) {
var parent = this;
parent.editFormId = 'form#' + edit_form_id;
@ -96,3 +100,28 @@ function check_inline_song_edit(type, song) {
$(source).replaceWith('<input type="text" name="' + type + '_name" value="New ' + type + '" onclick="this.select();" />');
}
}
/*********************/
/* Sortable table */
/*********************/
$(document).ready(function () {
$('#sortableplaylist').sortable({
axis: 'y',
delay: 200,
start: function (event, ui) {
$(ui.item).data("startindex", ui.item.index());
},
stop: function (event, ui) {
playlistUpdatedIndex(ui.item);
}
});
});
function playlistUpdatedIndex(item) {
var startIndex = item.data("startindex");
var newIndex = item.index();
if (newIndex != startIndex) {
alert('Start index {' + startIndex + '} Stop index {' + newIndex + '}');
}
}