Commit fe2611907121e03708d8df679ada7246f679b59d

Authored by Karpikau Andrei
1 parent 28f9e0b6

check duplicate function, and set name for block after change it

@@ -203,14 +203,17 @@ jQuery(document).ready(function(){ @@ -203,14 +203,17 @@ jQuery(document).ready(function(){
203 data: {structure_ids: ids.join(',')}, 203 data: {structure_ids: ids.join(',')},
204 success: function (data) { 204 success: function (data) {
205 if(data.status == 'ok'){ 205 if(data.status == 'ok'){
206 - var $newRow = $row.clone(true); 206 + var $newRow = $row.clone(false);
207 $row.after($newRow); 207 $row.after($newRow);
208 208
209 $newRow.find('.col').each(function(index){ 209 $newRow.find('.col').each(function(index){
210 if(data.ids[index] == ''){ 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 }else{ 214 }else{
213 $(this).data('id', data.ids[index]); 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,9 +238,11 @@ jQuery(document).ready(function(){
235 data: {structure_id: id}, 238 data: {structure_id: id},
236 success: function (data) { 239 success: function (data) {
237 if(data.status == 'ok'){ 240 if(data.status == 'ok'){
238 - var $newCell = $cell.clone(true); 241 + var $newCell = $cell.clone(false);
239 if(data.id == ''){ 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 }else{ 246 }else{
242 $newCell.data('id', data.id); 247 $newCell.data('id', data.id);
243 $newCell.attr('data-id', data.id); 248 $newCell.attr('data-id', data.id);
@@ -352,6 +357,7 @@ jQuery(document).ready(function(){ @@ -352,6 +357,7 @@ jQuery(document).ready(function(){
352 }); 357 });
353 358
354 $('#structure_area').find('.col[data-id='+ data.structure_id +'] .col-html').html(data.html); 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 $('#structure_area').slideDown('slow'); 361 $('#structure_area').slideDown('slow');
356 }); 362 });
357 }else{ 363 }else{
@@ -677,17 +683,18 @@ jQuery(document).ready(function(){ @@ -677,17 +683,18 @@ jQuery(document).ready(function(){
677 if(ui.draggable.hasClass('element-row')){ 683 if(ui.draggable.hasClass('element-row')){
678 var $newContent = $('<div class="row-fluid row-element-row">' + 684 var $newContent = $('<div class="row-fluid row-element-row">' +
679 '<div class="row-inner">' + showRowAction('Disable', false) + 685 '<div class="row-inner">' + showRowAction('Disable', false) +
680 - '</div>' + 686 + '</div><div class="col-html"></div>' +
681 '</div>'); 687 '</div>');
682 } 688 }
683 689
684 if(ui.draggable.hasClass('element-block')){ 690 if(ui.draggable.hasClass('element-block')){
685 var $newContent = $('<div class="row-fluid row-element-block">' + 691 var $newContent = $('<div class="row-fluid row-element-block">' +
686 '<div class="row-inner">' + showRowAction('Disable', true) + 692 '<div class="row-inner">' + showRowAction('Disable', true) +
687 - '</div>' + 693 + '</div><div class="col-html"></div>' +
688 '</div>'); 694 '</div>');
689 var max_id = getNextStructureId(); 695 var max_id = getNextStructureId();
690 $newContent.data('id', max_id); 696 $newContent.data('id', max_id);
  697 + $newContent.attr('data-id', max_id);
691 } 698 }
692 699
693 if ($prevElement == undefined) { 700 if ($prevElement == undefined) {
@@ -18,7 +18,7 @@ module Kanjai @@ -18,7 +18,7 @@ module Kanjai
18 if client_view == false and row['attributes']['type'] == 'block' 18 if client_view == false and row['attributes']['type'] == 'block'
19 html_attributes['data-id'] = row['attributes']['id'] 19 html_attributes['data-id'] = row['attributes']['id']
20 page_content = page_data.page_contents.where(:structure_id => row['attributes']['id']).first 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 end 22 end
23 23
24 html += ActionController::Base.helpers.content_tag(:div, '', html_attributes) do 24 html += ActionController::Base.helpers.content_tag(:div, '', html_attributes) do
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.170" 2 + VERSION = "0.0.171"
3 end 3 end