197 }); |
205 }); |
198 }, |
206 }, |
199 |
207 |
200 deleteRow: function() { |
208 deleteRow: function() { |
201 return function(row) { |
209 return function(row) { |
202 MyAMS.skin.bigBox({ |
210 row = row.objectOrParentWithClass('row'); |
203 title: MyAMS.i18n.WARNING, |
211 var portlets = $('.portlet', row); |
204 content: '<i class="text-danger fa fa-2x fa-bell"></i> ' + MyAMS.i18n.DELETE_WARNING, |
212 if (portlets.exists()) { |
205 status: 'info', |
213 MyAMS.skin.messageBox('error', { |
206 buttons: MyAMS.i18n.BTN_OK_CANCEL |
214 title: MyAMS.i18n.ERROR_OCCURED, |
207 }, function(button) { |
215 content: PyAMS_portal.i18n.CANT_DELETE_ROW_WITH_PORTLETS, |
208 if (button === MyAMS.i18n.BTN_OK) { |
216 icon: 'fa fa-warning animated shake', |
209 if (!row.hasClass('row')) { |
217 timeout: 5000 |
210 row = row.parents('.row'); |
218 }); |
|
219 } else { |
|
220 MyAMS.skin.bigBox({ |
|
221 title: MyAMS.i18n.WARNING, |
|
222 content: '<i class="text-danger fa fa-2x fa-bell"></i> ' + MyAMS.i18n.DELETE_WARNING, |
|
223 status: 'info', |
|
224 buttons: MyAMS.i18n.BTN_OK_CANCEL |
|
225 }, function (button) { |
|
226 if (button === MyAMS.i18n.BTN_OK) { |
|
227 MyAMS.ajax.post('delete-template-row.json', |
|
228 {row_id: row.data('ams-row-id')}, |
|
229 function (result) { |
|
230 if (result.status === 'success') { |
|
231 row.remove(); |
|
232 $('.row', '#portal_config').each(function (index) { |
|
233 $(this).removeData() |
|
234 .attr('data-ams-row-id', index); |
|
235 $('.row_id', $(this)).text(index + 1); |
|
236 }); |
|
237 } |
|
238 }); |
211 } |
239 } |
212 MyAMS.ajax.post('delete-template-row.json', |
240 }); |
213 {row_id: row.data('ams-row-id')}, |
241 } |
214 function(result) { |
|
215 if (result.status === 'success') { |
|
216 row.remove(); |
|
217 $('.row', '#portal_config').each(function (index) { |
|
218 $(this).removeData() |
|
219 .attr('data-ams-row-id', index); |
|
220 $('.row_id', $(this)).text(index+1); |
|
221 }); |
|
222 } |
|
223 }); |
|
224 } |
|
225 }); |
|
226 }; |
242 }; |
227 }, |
243 }, |
228 |
244 |
229 |
245 |
230 /** |
246 /** |
396 } |
412 } |
397 }, |
413 }, |
398 |
414 |
399 deleteSlot: function() { |
415 deleteSlot: function() { |
400 return function(slot) { |
416 return function(slot) { |
401 MyAMS.skin.bigBox({ |
417 slot = slot.objectOrParentWithClass('slot'); |
402 title: MyAMS.i18n.WARNING, |
418 var portlets = $('.portlet', slot); |
403 content: '<i class="text-danger fa fa-2x fa-bell"></i> ' + MyAMS.i18n.DELETE_WARNING, |
419 if (portlets.exists()) { |
404 status: 'info', |
420 MyAMS.skin.messageBox('error', { |
405 buttons: MyAMS.i18n.BTN_OK_CANCEL |
421 title: MyAMS.i18n.ERROR_OCCURED, |
406 }, function(button) { |
422 content: PyAMS_portal.i18n.CANT_DELETE_SLOT_WITH_PORTLETS, |
407 if (button === MyAMS.i18n.BTN_OK) { |
423 icon: 'fa fa-warning animated shake', |
408 if (!slot.hasClass('slot')) { |
424 timeout: 5000 |
409 slot = slot.parents('.slot'); |
425 }); |
|
426 } else { |
|
427 MyAMS.skin.bigBox({ |
|
428 title: MyAMS.i18n.WARNING, |
|
429 content: '<i class="text-danger fa fa-2x fa-bell"></i> ' + MyAMS.i18n.DELETE_WARNING, |
|
430 status: 'info', |
|
431 buttons: MyAMS.i18n.BTN_OK_CANCEL |
|
432 }, function (button) { |
|
433 if (button === MyAMS.i18n.BTN_OK) { |
|
434 MyAMS.ajax.post('delete-template-slot.json', |
|
435 {slot_name: slot.data('ams-slot-name')}, |
|
436 function (result) { |
|
437 if (result.status === 'success') { |
|
438 slot.remove(); |
|
439 $('.slot', '#portal_config').each(function () { |
|
440 $(this).removeData(); |
|
441 }); |
|
442 } |
|
443 }); |
410 } |
444 } |
411 MyAMS.ajax.post('delete-template-slot.json', |
445 }); |
412 {slot_name: slot.data('ams-slot-name')}, |
446 } |
413 function(result) { |
|
414 if (result.status === 'success') { |
|
415 slot.remove(); |
|
416 $('.slot', '#portal_config').each(function() { |
|
417 $(this).removeData(); |
|
418 }); |
|
419 } |
|
420 }); |
|
421 } |
|
422 }); |
|
423 }; |
447 }; |
424 }, |
448 }, |
425 |
449 |
426 |
450 |
427 /** |
451 /** |