Commit 6623b9b0eb2351bdf9073b17e273d634b1d4f353
1 parent
5f1a0b43
check js error move block in content editor
Showing
2 changed files
with
50 additions
and
40 deletions
| @@ -640,14 +640,20 @@ jQuery(document).ready(function(){ | @@ -640,14 +640,20 @@ jQuery(document).ready(function(){ | ||
| 640 | } | 640 | } |
| 641 | 641 | ||
| 642 | $(this).sortable({ | 642 | $(this).sortable({ |
| 643 | - items: ".col" | 643 | + items: ".col", |
| 644 | + stop: function(event, ui){ | ||
| 645 | + $block.find('.save').trigger('click'); | ||
| 646 | + } | ||
| 644 | }); | 647 | }); |
| 645 | 648 | ||
| 646 | }); | 649 | }); |
| 647 | 650 | ||
| 648 | 651 | ||
| 649 | $content_block.sortable({ | 652 | $content_block.sortable({ |
| 650 | - items: ".row-fluid" | 653 | + items: ".row-fluid", |
| 654 | + stop: function(event, ui){ | ||
| 655 | + $block.find('.save').trigger('click'); | ||
| 656 | + } | ||
| 651 | }); | 657 | }); |
| 652 | } | 658 | } |
| 653 | 659 | ||
| @@ -721,11 +727,10 @@ jQuery(document).ready(function(){ | @@ -721,11 +727,10 @@ jQuery(document).ready(function(){ | ||
| 721 | 727 | ||
| 722 | }, | 728 | }, |
| 723 | drop: function(event, ui){ | 729 | drop: function(event, ui){ |
| 724 | - | ||
| 725 | var currentPosition = ui.offset.top - $(this).offset().top; | 730 | var currentPosition = ui.offset.top - $(this).offset().top; |
| 726 | $prevElement = undefined; | 731 | $prevElement = undefined; |
| 727 | 732 | ||
| 728 | - if(ui.draggable.hasClass('element-row') || ui.draggable.hasClass('row-fluid') || ui.draggable.hasClass('element-block') ) { | 733 | + if(!ui.draggable.hasClass('ui-sortable') && (ui.draggable.hasClass('element-row') || ui.draggable.hasClass('row-fluid') || ui.draggable.hasClass('element-block') ) ) { |
| 729 | $content_block.find('.row-fluid').each(function(){ | 734 | $content_block.find('.row-fluid').each(function(){ |
| 730 | var $item = $(this); | 735 | var $item = $(this); |
| 731 | if($item != ui.draggable) { | 736 | if($item != ui.draggable) { |
| @@ -763,11 +768,15 @@ jQuery(document).ready(function(){ | @@ -763,11 +768,15 @@ jQuery(document).ready(function(){ | ||
| 763 | } | 768 | } |
| 764 | //dragRow($newContent); | 769 | //dragRow($newContent); |
| 765 | $content_block.sortable({ | 770 | $content_block.sortable({ |
| 766 | - items: ".row-fluid" | 771 | + items: ".row-fluid", |
| 772 | + stop: function(event, ui){ | ||
| 773 | + $block.find('.save').trigger('click'); | ||
| 774 | + } | ||
| 767 | }); | 775 | }); |
| 768 | } | 776 | } |
| 769 | $block.find('.save').trigger('click'); | 777 | $block.find('.save').trigger('click'); |
| 770 | } | 778 | } |
| 779 | + | ||
| 771 | } | 780 | } |
| 772 | }); | 781 | }); |
| 773 | 782 | ||
| @@ -781,48 +790,49 @@ jQuery(document).ready(function(){ | @@ -781,48 +790,49 @@ jQuery(document).ready(function(){ | ||
| 781 | cells = [], | 790 | cells = [], |
| 782 | row_attributes = {}; | 791 | row_attributes = {}; |
| 783 | 792 | ||
| 784 | - if($row.hasClass('row-element-block')){ | ||
| 785 | - row_attributes['type'] = 'block'; | ||
| 786 | - row_attributes['id'] = $row.data('id'); | ||
| 787 | - }else{ | ||
| 788 | - row_attributes['type'] = 'row'; | ||
| 789 | - } | ||
| 790 | - if($row.data('status') == undefined || $row.data('status') == 'enabled'){ | ||
| 791 | - row_attributes['status'] = 'enabled'; | ||
| 792 | - }else{ | ||
| 793 | - row_attributes['status'] = 'disabled'; | ||
| 794 | - } | ||
| 795 | - | 793 | + if($row.css('visibility') == 'visible'){ |
| 796 | 794 | ||
| 797 | - $row.find('.col').each(function(){ | ||
| 798 | - var $cell = $(this), | ||
| 799 | - size = $cell.data('size'), | ||
| 800 | - offset = $cell.data('offset'), | ||
| 801 | - id = $cell.data('id'), | ||
| 802 | - className = $cell.data('class'); | ||
| 803 | - | ||
| 804 | - var attributes = { | ||
| 805 | - size: size, | ||
| 806 | - offset: offset, | ||
| 807 | - id: id | ||
| 808 | - }; | ||
| 809 | - | ||
| 810 | - if($cell.data('status') == undefined || $cell.data('status') == 'enabled'){ | ||
| 811 | - attributes['status'] = 'enabled'; | 795 | + if($row.hasClass('row-element-block')){ |
| 796 | + row_attributes['type'] = 'block'; | ||
| 797 | + row_attributes['id'] = $row.data('id'); | ||
| 812 | }else{ | 798 | }else{ |
| 813 | - attributes['status'] = 'disabled'; | 799 | + row_attributes['type'] = 'row'; |
| 814 | } | 800 | } |
| 801 | + if($row.data('status') == undefined || $row.data('status') == 'enabled'){ | ||
| 802 | + row_attributes['status'] = 'enabled'; | ||
| 803 | + }else{ | ||
| 804 | + row_attributes['status'] = 'disabled'; | ||
| 805 | + } | ||
| 815 | 806 | ||
| 816 | - if(className != undefined){ | ||
| 817 | - attributes['className'] = className; | ||
| 818 | - } | ||
| 819 | 807 | ||
| 820 | - cells.push(attributes); | ||
| 821 | - }); | 808 | + $row.find('.col').each(function(){ |
| 809 | + var $cell = $(this), | ||
| 810 | + size = $cell.data('size'), | ||
| 811 | + offset = $cell.data('offset'), | ||
| 812 | + id = $cell.data('id'), | ||
| 813 | + className = $cell.data('class'); | ||
| 814 | + | ||
| 815 | + var attributes = { | ||
| 816 | + size: size, | ||
| 817 | + offset: offset, | ||
| 818 | + id: id | ||
| 819 | + }; | ||
| 822 | 820 | ||
| 821 | + if($cell.data('status') == undefined || $cell.data('status') == 'enabled'){ | ||
| 822 | + attributes['status'] = 'enabled'; | ||
| 823 | + }else{ | ||
| 824 | + attributes['status'] = 'disabled'; | ||
| 825 | + } | ||
| 823 | 826 | ||
| 827 | + if(className != undefined){ | ||
| 828 | + attributes['className'] = className; | ||
| 829 | + } | ||
| 824 | 830 | ||
| 825 | - res.push({attributes: row_attributes, cells: cells}); | 831 | + cells.push(attributes); |
| 832 | + }); | ||
| 833 | + | ||
| 834 | + res.push({attributes: row_attributes, cells: cells}); | ||
| 835 | + } | ||
| 826 | }); | 836 | }); |
| 827 | 837 | ||
| 828 | jQuery.ajax({ | 838 | jQuery.ajax({ |