Guest User

Untitled

a guest
Feb 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ADD/REMOVE MODULE
  2.         $('.module div').live('click', function () {
  3.             var module_id = $(this).parent().attr('id');
  4.             module_id = module_id.split("_");
  5.             var mod_type = module_id[0];
  6.             var mod_id = module_id[1];
  7.             if ($(this).parent().hasClass('add')){
  8.                 $('#module_positioning').prepend('<div class="loading"></div>')
  9.                 $.post('/ajax/dashboard/module_add/'+mod_type, '',
  10.                 function(response) {
  11.                     $('.loading').replaceWith(response);
  12.                     var order = $('#module_positioning').sortable('serialize');
  13.                     Promo.moduleReposition(order);
  14.                    
  15.                     $('#module_positioning_'+mod_id).children().children('on_off').dragToEnvoke();      //<<----This one           
  16.                    
  17.                    
  18.                 }, 'html');$('#module_positioning').sortable('refresh');
  19.                 $(this).parent().addClass('remove');
  20.                 $(this).parent().removeClass('add');
  21.             } else if ($(this).parent().hasClass('remove')){
  22.                
  23.                 $.post('/ajax/dashboard/module_remove/'+mod_id, '',
  24.                 function(response) {
  25.                     $('#module_positioning_'+mod_id).hide("drop", { direction: "down" }, 'slow', function() {$('#module_positioning_'+mod_id).remove();});
  26.                     var order = $('#module_positioning').sortable('serialize');
  27.                     Promo.moduleReposition(order);
  28.                 }, 'html');
  29.                 $(this).parent().addClass('add');
  30.                 $(this).parent().removeClass('remove');
  31.             }
  32.         });
Add Comment
Please, Sign In to add comment