mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 02:39:47 +02:00
Starting sortable playlist implmentation to re-order songs.
This commit is contained in:
parent
40ef2d3de7
commit
0599214703
3 changed files with 116 additions and 77 deletions
|
@ -19,6 +19,17 @@
|
|||
//
|
||||
$(document).ready(function () {
|
||||
$('.default_hidden').hide();
|
||||
|
||||
$('#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() {
|
||||
|
@ -68,9 +79,7 @@ function toggleVisible(element) {
|
|||
// delayRun
|
||||
// This function delays the run of another function by X milliseconds
|
||||
function delayRun(element, time, method, page, source) {
|
||||
|
||||
var function_string = method + '(\'' + page + '\',\'' + source + '\')';
|
||||
|
||||
var action = function () { eval(function_string); };
|
||||
|
||||
if (element.zid) {
|
||||
|
@ -78,7 +87,6 @@ function delayRun(element, time, method, page, source) {
|
|||
}
|
||||
|
||||
element.zid = setTimeout(action, time);
|
||||
|
||||
}
|
||||
|
||||
// reloadUtil
|
||||
|
|
|
@ -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 + '}');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ $web_path = Config::get('web_path');
|
|||
<col id="col_userflag" />
|
||||
<col id="col_action" />
|
||||
</colgroup>
|
||||
<tbody id="sortableplaylist">
|
||||
<tr class="th-top">
|
||||
<?php if (Config::get('directplay')) { ?>
|
||||
<th class="cel_directplay"><?php echo T_('Play'); ?></th>
|
||||
|
@ -92,5 +93,6 @@ $web_path = Config::get('web_path');
|
|||
<?php } ?>
|
||||
<th class="cel_action"><?php echo T_('Action'); ?></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue