Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ADD/REMOVE MODULE
- $('.module div').live('click', function () {
- var module_id = $(this).parent().attr('id');
- module_id = module_id.split("_");
- var mod_type = module_id[0];
- var mod_id = module_id[1];
- if ($(this).parent().hasClass('add')){
- $('#module_positioning').prepend('<div class="loading"></div>')
- $.post('/ajax/dashboard/module_add/'+mod_type, '',
- function(response) {
- $('.loading').replaceWith(response);
- var order = $('#module_positioning').sortable('serialize');
- Promo.moduleReposition(order);
- $('#module_positioning_'+mod_id).children().children('on_off').dragToEnvoke(); //<<----This one
- }, 'html');$('#module_positioning').sortable('refresh');
- $(this).parent().addClass('remove');
- $(this).parent().removeClass('add');
- } else if ($(this).parent().hasClass('remove')){
- $.post('/ajax/dashboard/module_remove/'+mod_id, '',
- function(response) {
- $('#module_positioning_'+mod_id).hide("drop", { direction: "down" }, 'slow', function() {$('#module_positioning_'+mod_id).remove();});
- var order = $('#module_positioning').sortable('serialize');
- Promo.moduleReposition(order);
- }, 'html');
- $(this).parent().addClass('add');
- $(this).parent().removeClass('remove');
- }
- });
Add Comment
Please, Sign In to add comment