1 | $(document).ready( |
---|
2 | function () |
---|
3 | { |
---|
4 | $('#song_list').Sortable({ |
---|
5 | accept: 'song', |
---|
6 | tolerance: 'intersect', |
---|
7 | handle: '.drag', |
---|
8 | floats: true, |
---|
9 | axis: 'vertically', |
---|
10 | helperclass: 'sorthelper', |
---|
11 | onStop: function(ser) |
---|
12 | { |
---|
13 | // Serialize the order and update |
---|
14 | var sorted = $.SortSerialize('song_list'); |
---|
15 | var ids = sorted.hash |
---|
16 | .replace(/song_/g, '') |
---|
17 | .replace(/list\[\]\=/g, '') |
---|
18 | .split('&').join('~'); |
---|
19 | $.post('/playlists/update_sort/<?= $playlist->id; ?>', {id: <?= $playlist->id; ?>, ids: ids}); |
---|
20 | } |
---|
21 | }); |
---|
22 | } |
---|
23 | ); |
---|