Showing
3 changed files
with
29 additions
and
16 deletions
| @@ -109,18 +109,31 @@ jQuery(document).ready(function(){ | @@ -109,18 +109,31 @@ jQuery(document).ready(function(){ | ||
| 109 | delete_cell_url = $block.data('delete_cell_url'), | 109 | delete_cell_url = $block.data('delete_cell_url'), |
| 110 | mas_cell_id = []; | 110 | mas_cell_id = []; |
| 111 | 111 | ||
| 112 | - $row.find('.col').each(function(){ | ||
| 113 | - mas_cell_id.push($(this).data('id')); | ||
| 114 | - }); | 112 | + if($row.hasClass('row-element-row')){ |
| 113 | + $row.find('.col').each(function(){ | ||
| 114 | + mas_cell_id.push($(this).data('id')); | ||
| 115 | + }); | ||
| 115 | 116 | ||
| 116 | - jQuery.ajax({ | ||
| 117 | - type: 'POST', | ||
| 118 | - url: delete_cell_url, | ||
| 119 | - data: {structure_ids: mas_cell_id}, | ||
| 120 | - success: function (data) { | ||
| 121 | - $row.remove(); | ||
| 122 | - } | ||
| 123 | - }); | 117 | + jQuery.ajax({ |
| 118 | + type: 'POST', | ||
| 119 | + url: delete_cell_url, | ||
| 120 | + data: {structure_ids: mas_cell_id}, | ||
| 121 | + success: function (data) { | ||
| 122 | + $row.remove(); | ||
| 123 | + } | ||
| 124 | + }); | ||
| 125 | + } | ||
| 126 | + if($row.hasClass('row-element-block')){ | ||
| 127 | + | ||
| 128 | + jQuery.ajax({ | ||
| 129 | + type: 'POST', | ||
| 130 | + url: delete_cell_url, | ||
| 131 | + data: {structure_id: $row.data('id')}, | ||
| 132 | + success: function (data) { | ||
| 133 | + $row.remove(); | ||
| 134 | + } | ||
| 135 | + }); | ||
| 136 | + } | ||
| 124 | } | 137 | } |
| 125 | }); | 138 | }); |
| 126 | 139 |
| @@ -113,8 +113,8 @@ module Kanjai | @@ -113,8 +113,8 @@ module Kanjai | ||
| 113 | 113 | ||
| 114 | @obj.page_content_markers.each do |item| | 114 | @obj.page_content_markers.each do |item| |
| 115 | new_item = item.dup | 115 | new_item = item.dup |
| 116 | - item.page_content = @new_obj | ||
| 117 | - item.save(validate: false) | 116 | + new_item.page_content = @new_obj |
| 117 | + new_item.save(validate: false) | ||
| 118 | end | 118 | end |
| 119 | new_ids << next_structure_id | 119 | new_ids << next_structure_id |
| 120 | else | 120 | else |
| @@ -135,8 +135,8 @@ module Kanjai | @@ -135,8 +135,8 @@ module Kanjai | ||
| 135 | 135 | ||
| 136 | @obj.page_content_markers.each do |item| | 136 | @obj.page_content_markers.each do |item| |
| 137 | new_item = item.dup | 137 | new_item = item.dup |
| 138 | - item.page_content = @new_obj | ||
| 139 | - item.save(validate: false) | 138 | + new_item.page_content = @new_obj |
| 139 | + new_item.save(validate: false) | ||
| 140 | end | 140 | end |
| 141 | 141 | ||
| 142 | render json: {status: 'ok', id: next_structure_id} | 142 | render json: {status: 'ok', id: next_structure_id} |