Commit fe2611907121e03708d8df679ada7246f679b59d
1 parent
28f9e0b6
check duplicate function, and set name for block after change it
Showing
3 changed files
with
15 additions
and
8 deletions
| ... | ... | @@ -203,14 +203,17 @@ jQuery(document).ready(function(){ |
| 203 | 203 | data: {structure_ids: ids.join(',')}, |
| 204 | 204 | success: function (data) { |
| 205 | 205 | if(data.status == 'ok'){ |
| 206 | - var $newRow = $row.clone(true); | |
| 206 | + var $newRow = $row.clone(false); | |
| 207 | 207 | $row.after($newRow); |
| 208 | 208 | |
| 209 | 209 | $newRow.find('.col').each(function(index){ |
| 210 | 210 | if(data.ids[index] == ''){ |
| 211 | - $(this).data('id', getNextStructureIdGLobal($block.find('.html-content'))); | |
| 211 | + var nextId = getNextStructureIdGLobal($block.find('.html-content')); | |
| 212 | + $(this).data('id', nextId); | |
| 213 | + $(this).attr('data-id', nextId); | |
| 212 | 214 | }else{ |
| 213 | 215 | $(this).data('id', data.ids[index]); |
| 216 | + $(this).attr('data-id', data.ids[index]); | |
| 214 | 217 | } |
| 215 | 218 | }); |
| 216 | 219 | |
| ... | ... | @@ -235,9 +238,11 @@ jQuery(document).ready(function(){ |
| 235 | 238 | data: {structure_id: id}, |
| 236 | 239 | success: function (data) { |
| 237 | 240 | if(data.status == 'ok'){ |
| 238 | - var $newCell = $cell.clone(true); | |
| 241 | + var $newCell = $cell.clone(false); | |
| 239 | 242 | if(data.id == ''){ |
| 240 | - $newCell.data('id', getNextStructureIdGLobal($block.find('.html-content'))); | |
| 243 | + var nextId = getNextStructureIdGLobal($block.find('.html-content')); | |
| 244 | + $newCell.data('id', nextId); | |
| 245 | + $newCell.attr('data-id', nextId); | |
| 241 | 246 | }else{ |
| 242 | 247 | $newCell.data('id', data.id); |
| 243 | 248 | $newCell.attr('data-id', data.id); |
| ... | ... | @@ -352,6 +357,7 @@ jQuery(document).ready(function(){ |
| 352 | 357 | }); |
| 353 | 358 | |
| 354 | 359 | $('#structure_area').find('.col[data-id='+ data.structure_id +'] .col-html').html(data.html); |
| 360 | + $('#structure_area').find('.row-element-block[data-id='+ data.structure_id +'] .col-html').html(data.html); | |
| 355 | 361 | $('#structure_area').slideDown('slow'); |
| 356 | 362 | }); |
| 357 | 363 | }else{ |
| ... | ... | @@ -677,17 +683,18 @@ jQuery(document).ready(function(){ |
| 677 | 683 | if(ui.draggable.hasClass('element-row')){ |
| 678 | 684 | var $newContent = $('<div class="row-fluid row-element-row">' + |
| 679 | 685 | '<div class="row-inner">' + showRowAction('Disable', false) + |
| 680 | - '</div>' + | |
| 686 | + '</div><div class="col-html"></div>' + | |
| 681 | 687 | '</div>'); |
| 682 | 688 | } |
| 683 | 689 | |
| 684 | 690 | if(ui.draggable.hasClass('element-block')){ |
| 685 | 691 | var $newContent = $('<div class="row-fluid row-element-block">' + |
| 686 | 692 | '<div class="row-inner">' + showRowAction('Disable', true) + |
| 687 | - '</div>' + | |
| 693 | + '</div><div class="col-html"></div>' + | |
| 688 | 694 | '</div>'); |
| 689 | 695 | var max_id = getNextStructureId(); |
| 690 | 696 | $newContent.data('id', max_id); |
| 697 | + $newContent.attr('data-id', max_id); | |
| 691 | 698 | } |
| 692 | 699 | |
| 693 | 700 | if ($prevElement == undefined) { | ... | ... |
| ... | ... | @@ -18,7 +18,7 @@ module Kanjai |
| 18 | 18 | if client_view == false and row['attributes']['type'] == 'block' |
| 19 | 19 | html_attributes['data-id'] = row['attributes']['id'] |
| 20 | 20 | page_content = page_data.page_contents.where(:structure_id => row['attributes']['id']).first |
| 21 | - row_html = page_content.nil? ? '' : page_content.get_content | |
| 21 | + row_html = '<div class="col-html">' + (page_content.nil? ? '' : page_content.get_content) + '</div>' | |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | 24 | html += ActionController::Base.helpers.content_tag(:div, '', html_attributes) do | ... | ... |