|
@@ -159,8 +159,9 @@ jQuery(document).ready(function(){ |
|
@@ -159,8 +159,9 @@ jQuery(document).ready(function(){ |
|
159
|
var $wrapper = $(this);
|
159
|
var $wrapper = $(this);
|
|
160
|
$wrapper.sortable({
|
160
|
$wrapper.sortable({
|
|
161
|
stop: function( event, ui ) {
|
161
|
stop: function( event, ui ) {
|
|
162
|
- data = [];
|
|
|
|
163
|
- position = 1;
|
162
|
+ var data = [],
|
|
|
|
163
|
+ position = 1;
|
|
|
|
164
|
+
|
|
164
|
$wrapper.find( " > .panel" ).each(function(){
|
165
|
$wrapper.find( " > .panel" ).each(function(){
|
|
165
|
data.push({position: position, index: $(this).data('id')});
|
166
|
data.push({position: position, index: $(this).data('id')});
|
|
166
|
position += 1;
|
167
|
position += 1;
|
|
@@ -320,6 +321,42 @@ jQuery(document).ready(function(){ |
|
@@ -320,6 +321,42 @@ jQuery(document).ready(function(){ |
|
320
|
return false;
|
321
|
return false;
|
|
321
|
});
|
322
|
});
|
|
322
|
|
323
|
|
|
|
|
324
|
+ $('.html-generator').on('click', '.sort-repeat-row', function(data, status, xhr){
|
|
|
|
325
|
+ var $this = $(this),
|
|
|
|
326
|
+ url = $this.attr('href'),
|
|
|
|
327
|
+ $wrapper = $this.closest('.panel-group'),
|
|
|
|
328
|
+ $currentItem = $this.closest('.panel'),
|
|
|
|
329
|
+ $prevItem = $currentItem.prev(),
|
|
|
|
330
|
+ $nextItem = $currentItem.next();
|
|
|
|
331
|
+
|
|
|
|
332
|
+ if($this.hasClass('sort-up') && $prevItem){
|
|
|
|
333
|
+ $currentItem.insertBefore($prevItem);
|
|
|
|
334
|
+ }
|
|
|
|
335
|
+ if($this.hasClass('sort-down') && $nextItem){
|
|
|
|
336
|
+ $currentItem.insertAfter($nextItem);
|
|
|
|
337
|
+ }
|
|
|
|
338
|
+
|
|
|
|
339
|
+
|
|
|
|
340
|
+ var data = [],
|
|
|
|
341
|
+ position = 1;
|
|
|
|
342
|
+
|
|
|
|
343
|
+ $wrapper.find( " > .panel" ).each(function(){
|
|
|
|
344
|
+ data.push({position: position, index: $(this).data('id')});
|
|
|
|
345
|
+ position += 1;
|
|
|
|
346
|
+ });
|
|
|
|
347
|
+ jQuery.ajax({
|
|
|
|
348
|
+ type: 'POST',
|
|
|
|
349
|
+ url: $wrapper.data('update-url'),
|
|
|
|
350
|
+ data: {data: data},
|
|
|
|
351
|
+ success: function (data) {
|
|
|
|
352
|
+
|
|
|
|
353
|
+ }
|
|
|
|
354
|
+ });
|
|
|
|
355
|
+
|
|
|
|
356
|
+
|
|
|
|
357
|
+ return false;
|
|
|
|
358
|
+ });
|
|
|
|
359
|
+
|
|
323
|
|
360
|
|
|
324
|
|
361
|
|
|
325
|
|
362
|
|