Commit 3545e0cccb8516c47d087c1f2a2f2a0406d6e5b1

Authored by Karpikau Andrei
1 parent 5ec841e4

check sort repeat elements

@@ -476,11 +476,10 @@ jQuery(document).ready(function(){ @@ -476,11 +476,10 @@ jQuery(document).ready(function(){
476 $nextItem = $currentItem.next(); 476 $nextItem = $currentItem.next();
477 477
478 if($this.hasClass('sort-up') && $prevItem){ 478 if($this.hasClass('sort-up') && $prevItem){
479 - $currentItem.insertBefore($prevItem); 479 + $currentItem.insertBefore($prevItem);
480 } 480 }
481 if($this.hasClass('sort-down') && $nextItem){ 481 if($this.hasClass('sort-down') && $nextItem){
482 $currentItem.insertAfter($nextItem); 482 $currentItem.insertAfter($nextItem);
483 -  
484 } 483 }
485 484
486 485
@@ -497,6 +496,20 @@ jQuery(document).ready(function(){ @@ -497,6 +496,20 @@ jQuery(document).ready(function(){
497 data: {data: data}, 496 data: {data: data},
498 success: function (data) { 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,8 +47,12 @@ module Kanjai
47 h[item[:index].to_i] = item[:position].to_i 47 h[item[:index].to_i] = item[:position].to_i
48 end 48 end
49 49
  50 + p h
  51 +
50 @obj.page_content_markers.each do |item| 52 @obj.page_content_markers.each do |item|
51 if h[item.row_item] 53 if h[item.row_item]
  54 + p item.row_item
  55 + p h[item.row_item]
52 item.update_column(:row_item, h[item.row_item]) 56 item.update_column(:row_item, h[item.row_item])
53 end 57 end
54 end 58 end
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.195" 2 + VERSION = "0.0.196"
3 end 3 end