|
@@ -156,32 +156,85 @@ jQuery(document).ready(function(){ |
|
@@ -156,32 +156,85 @@ jQuery(document).ready(function(){ |
|
156
|
|
156
|
|
|
157
|
};
|
157
|
};
|
|
158
|
|
158
|
|
|
|
|
159
|
+ var getNextStructureIdGLobal = function($content_block){
|
|
|
|
160
|
+ var max_id = 0;
|
|
|
|
161
|
+ $content_block.find('.col, .row-element-block').each(function(){
|
|
|
|
162
|
+ var id = $(this).data('id');
|
|
|
|
163
|
+ if(id != undefined){
|
|
|
|
164
|
+ id = parseInt(id);
|
|
|
|
165
|
+ if(id > max_id){
|
|
|
|
166
|
+ max_id = id;
|
|
|
|
167
|
+ }
|
|
|
|
168
|
+ }
|
|
|
|
169
|
+
|
|
|
|
170
|
+ });
|
|
|
|
171
|
+ max_id += 1;
|
|
|
|
172
|
+ return max_id;
|
|
|
|
173
|
+ }
|
|
|
|
174
|
+
|
|
159
|
$('.html-generator').on('click', '.col-operation .col-duplicate, .row-operation .col-duplicate', function(){
|
175
|
$('.html-generator').on('click', '.col-operation .col-duplicate, .row-operation .col-duplicate', function(){
|
|
160
|
var $this = $(this);
|
176
|
var $this = $(this);
|
|
161
|
|
177
|
|
|
162
|
- if($this.closest('.row-element-block').length > 0){
|
|
|
|
163
|
- var $cell = $this.closest('.row-element-block');
|
|
|
|
164
|
- }else{
|
|
|
|
165
|
- var $cell = $this.closest('.col')
|
|
|
|
166
|
- }
|
|
|
|
167
|
- var id = $cell.data('id');
|
|
|
|
168
|
- var $block = $cell.closest('.html-generator');
|
|
|
|
169
|
- var duplicate_url = $block.data('duplicate-url');
|
178
|
+ if ($this.closest('.row-element-row').length > 0 && $this.closest('.col').length == 0){
|
|
|
|
179
|
+ var ids = [];
|
|
|
|
180
|
+ var $row = $this.closest('.row-element-row');
|
|
|
|
181
|
+ var $block = $row.closest('.html-generator');
|
|
|
|
182
|
+ var duplicate_url = $block.data('duplicate-url');
|
|
170
|
|
183
|
|
|
|
|
184
|
+ $this.closest('.row-element-row').find('.col').each(function(){
|
|
|
|
185
|
+ ids.push($(this).data('id'));
|
|
|
|
186
|
+ })
|
|
171
|
|
187
|
|
|
172
|
- jQuery.ajax({
|
|
|
|
173
|
- type: 'POST',
|
|
|
|
174
|
- url: duplicate_url,
|
|
|
|
175
|
- data: {structure_id: id},
|
|
|
|
176
|
- success: function (data) {
|
|
|
|
177
|
- if(data.status == 'ok'){
|
|
|
|
178
|
- var $newCell = $cell.clone();
|
|
|
|
179
|
- $newCell.data('id', data.id);
|
|
|
|
180
|
- $cell.after($newCell);
|
|
|
|
181
|
- $block.find('.save').trigger('click');
|
188
|
+ jQuery.ajax({
|
|
|
|
189
|
+ type: 'POST',
|
|
|
|
190
|
+ url: duplicate_url,
|
|
|
|
191
|
+ data: {structure_ids: ids.join(',')},
|
|
|
|
192
|
+ success: function (data) {
|
|
|
|
193
|
+ if(data.status == 'ok'){
|
|
|
|
194
|
+ var $newRow = $row.clone(true);
|
|
|
|
195
|
+ $row.after($newRow);
|
|
|
|
196
|
+
|
|
|
|
197
|
+ $newRow.find('.col').each(function(index){
|
|
|
|
198
|
+ if(data.ids[index] == ''){
|
|
|
|
199
|
+ $(this).data('id', getNextStructureIdGLobal($block.find('.html-content')));
|
|
|
|
200
|
+ }else{
|
|
|
|
201
|
+ $(this).data('id', data.ids[index]);
|
|
|
|
202
|
+ }
|
|
|
|
203
|
+ });
|
|
|
|
204
|
+
|
|
|
|
205
|
+ $block.find('.save').trigger('click');
|
|
|
|
206
|
+ }
|
|
182
|
}
|
207
|
}
|
|
|
|
208
|
+ });
|
|
|
|
209
|
+ }else{
|
|
|
|
210
|
+ if($this.closest('.row-element-block').length > 0){
|
|
|
|
211
|
+ var $cell = $this.closest('.row-element-block');
|
|
|
|
212
|
+ }else{
|
|
|
|
213
|
+ var $cell = $this.closest('.col')
|
|
183
|
}
|
214
|
}
|
|
184
|
- });
|
215
|
+ var id = $cell.data('id');
|
|
|
|
216
|
+ var $block = $cell.closest('.html-generator');
|
|
|
|
217
|
+ var duplicate_url = $block.data('duplicate-url');
|
|
|
|
218
|
+
|
|
|
|
219
|
+
|
|
|
|
220
|
+ jQuery.ajax({
|
|
|
|
221
|
+ type: 'POST',
|
|
|
|
222
|
+ url: duplicate_url,
|
|
|
|
223
|
+ data: {structure_id: id},
|
|
|
|
224
|
+ success: function (data) {
|
|
|
|
225
|
+ if(data.status == 'ok'){
|
|
|
|
226
|
+ var $newCell = $cell.clone(true);
|
|
|
|
227
|
+ if(data.id == ''){
|
|
|
|
228
|
+ $newCell.data('id', getNextStructureIdGLobal($block.find('.html-content')));
|
|
|
|
229
|
+ }else{
|
|
|
|
230
|
+ $newCell.data('id', data.id);
|
|
|
|
231
|
+ }
|
|
|
|
232
|
+ $cell.after($newCell);
|
|
|
|
233
|
+ $block.find('.save').trigger('click');
|
|
|
|
234
|
+ }
|
|
|
|
235
|
+ }
|
|
|
|
236
|
+ });
|
|
|
|
237
|
+ }
|
|
185
|
|
238
|
|
|
186
|
return false;
|
239
|
return false;
|
|
187
|
});
|
240
|
});
|
|
@@ -189,8 +242,8 @@ jQuery(document).ready(function(){ |
|
@@ -189,8 +242,8 @@ jQuery(document).ready(function(){ |
|
189
|
$('.html-generator').on('click', '.col-operation .col-disable, .row-operation .col-disable', function(){
|
242
|
$('.html-generator').on('click', '.col-operation .col-disable, .row-operation .col-disable', function(){
|
|
190
|
var $this = $(this);
|
243
|
var $this = $(this);
|
|
191
|
|
244
|
|
|
192
|
- if($this.closest('.row-element-block').length > 0){
|
|
|
|
193
|
- var $cell = $this.closest('.row-element-block');
|
245
|
+ if($this.closest('.row-element-block, .row-element-row').length > 0){
|
|
|
|
246
|
+ var $cell = $this.closest('.row-element-block, .row-element-row');
|
|
194
|
}else{
|
247
|
}else{
|
|
195
|
var $cell = $this.closest('.col')
|
248
|
var $cell = $this.closest('.col')
|
|
196
|
}
|
249
|
}
|
|
@@ -458,9 +511,10 @@ jQuery(document).ready(function(){ |
|
@@ -458,9 +511,10 @@ jQuery(document).ready(function(){ |
|
458
|
'<div class="row-operation">' +
|
511
|
'<div class="row-operation">' +
|
|
459
|
'<a class="row-remove" href="javascript;void(0);"><i class="glyphicon glyphicon-trash"></i></a>';
|
512
|
'<a class="row-remove" href="javascript;void(0);"><i class="glyphicon glyphicon-trash"></i></a>';
|
|
460
|
|
513
|
|
|
|
|
514
|
+ innerContent += '<a class="col-disable" href="javascript;void(0);"><i class="glyphicon '+ statusClass +'"></i></a>';
|
|
|
|
515
|
+ innerContent += '<a class="col-duplicate" href="javascript;void(0);"><i class="glyphicon glyphicon-file"></i></a>';
|
|
|
|
516
|
+
|
|
461
|
if($(this).hasClass('row-element-block')) {
|
517
|
if($(this).hasClass('row-element-block')) {
|
|
462
|
- innerContent += '<a class="col-disable" href="javascript;void(0);"><i class="glyphicon '+ statusClass +'"></i></a>';
|
|
|
|
463
|
- innerContent += '<a class="col-duplicate" href="javascript;void(0);"><i class="glyphicon glyphicon-file"></i></a>';
|
|
|
|
464
|
innerContent += '<a class="col-content" href="javascript;void(0);"><i class="glyphicon glyphicon-pencil"></i></a>';
|
518
|
innerContent += '<a class="col-content" href="javascript;void(0);"><i class="glyphicon glyphicon-pencil"></i></a>';
|
|
465
|
}
|
519
|
}
|
|
466
|
innerContent += '</div>' +
|
520
|
innerContent += '</div>' +
|
|
@@ -579,6 +633,8 @@ jQuery(document).ready(function(){ |
|
@@ -579,6 +633,8 @@ jQuery(document).ready(function(){ |
|
579
|
var $newContent = $('<div class="row-fluid row-element-row">' +
|
633
|
var $newContent = $('<div class="row-fluid row-element-row">' +
|
|
580
|
'<div class="row-inner">' +
|
634
|
'<div class="row-inner">' +
|
|
581
|
'<div class="row-operation">' +
|
635
|
'<div class="row-operation">' +
|
|
|
|
636
|
+ '<a class="col-disable" href="javascript;void(0);"><i class="glyphicon glyphicon-eye-open"></i></a>' +
|
|
|
|
637
|
+ '<a class="col-duplicate" href="javascript;void(0);"><i class="glyphicon glyphicon-file"></i></a>' +
|
|
582
|
'<a class="row-remove" href="javascript;void(0);"><i class="glyphicon glyphicon-trash"></i></a>' +
|
638
|
'<a class="row-remove" href="javascript;void(0);"><i class="glyphicon glyphicon-trash"></i></a>' +
|
|
583
|
'</div>' +
|
639
|
'</div>' +
|
|
584
|
'</div>' +
|
640
|
'</div>' +
|
|
@@ -630,14 +686,14 @@ jQuery(document).ready(function(){ |
|
@@ -630,14 +686,14 @@ jQuery(document).ready(function(){ |
|
630
|
if($row.hasClass('row-element-block')){
|
686
|
if($row.hasClass('row-element-block')){
|
|
631
|
row_attributes['type'] = 'block';
|
687
|
row_attributes['type'] = 'block';
|
|
632
|
row_attributes['id'] = $row.data('id');
|
688
|
row_attributes['id'] = $row.data('id');
|
|
633
|
- if($row.data('status') == undefined || $row.data('status') == 'enabled'){
|
|
|
|
634
|
- row_attributes['status'] = 'enabled';
|
|
|
|
635
|
- }else{
|
|
|
|
636
|
- row_attributes['status'] = 'disabled';
|
|
|
|
637
|
- }
|
|
|
|
638
|
}else{
|
689
|
}else{
|
|
639
|
row_attributes['type'] = 'row';
|
690
|
row_attributes['type'] = 'row';
|
|
640
|
}
|
691
|
}
|
|
|
|
692
|
+ if($row.data('status') == undefined || $row.data('status') == 'enabled'){
|
|
|
|
693
|
+ row_attributes['status'] = 'enabled';
|
|
|
|
694
|
+ }else{
|
|
|
|
695
|
+ row_attributes['status'] = 'disabled';
|
|
|
|
696
|
+ }
|
|
641
|
|
697
|
|
|
642
|
|
698
|
|
|
643
|
$row.find('.col').each(function(){
|
699
|
$row.find('.col').each(function(){
|