Commit 3545e0cccb8516c47d087c1f2a2f2a0406d6e5b1

Authored by Karpikau Andrei
1 parent 5ec841e4

check sort repeat elements

... ... @@ -476,11 +476,10 @@ jQuery(document).ready(function(){
476 476 $nextItem = $currentItem.next();
477 477
478 478 if($this.hasClass('sort-up') && $prevItem){
479   - $currentItem.insertBefore($prevItem);
  479 + $currentItem.insertBefore($prevItem);
480 480 }
481 481 if($this.hasClass('sort-down') && $nextItem){
482 482 $currentItem.insertAfter($nextItem);
483   -
484 483 }
485 484
486 485
... ... @@ -497,6 +496,20 @@ jQuery(document).ready(function(){
497 496 data: {data: data},
498 497 success: function (data) {
499 498
  499 + if($this.hasClass('sort-up') && $prevItem){
  500 + var prevItemId = $prevItem.data('id'),
  501 + currentItemId = $currentItem.data('id');
  502 + $currentItem.data('id', prevItemId);
  503 + $prevItem.data('id', currentItemId);
  504 + }
  505 + if($this.hasClass('sort-down') && $nextItem){
  506 + var nextItemId = $nextItem.data('id'),
  507 + currentItemId = $currentItem.data('id');
  508 +
  509 + $currentItem.data('id', nextItemId);
  510 + $nextItem.data('id', currentItemId);
  511 + }
  512 +
500 513 }
501 514 });
502 515
... ...
... ... @@ -47,8 +47,12 @@ module Kanjai
47 47 h[item[:index].to_i] = item[:position].to_i
48 48 end
49 49
  50 + p h
  51 +
50 52 @obj.page_content_markers.each do |item|
51 53 if h[item.row_item]
  54 + p item.row_item
  55 + p h[item.row_item]
52 56 item.update_column(:row_item, h[item.row_item])
53 57 end
54 58 end
... ...
1 1 module Kanjai
2   - VERSION = "0.0.195"
  2 + VERSION = "0.0.196"
3 3 end
... ...