Dotclear


Ignore:
Timestamp:
08/31/18 11:42:03 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Some refinements for sortable area on dashboard, and some code refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_index.js

    r3833 r3839  
    220220    $.post('services.php', params, function() {}); 
    221221  }; 
    222   // Wait 5 seconds before activating ordering capabilities on dashboard 
    223   setTimeout(function() { 
    224     $('#dashboard-main').sortable({ 
     222  var init_positions = function(sel, id) { 
     223    $(sel).sortable({ 
    225224      cursor: 'move', 
    226225      opacity: 0.5, 
    227226      tolerance: "pointer", 
    228227      update: function() { 
    229         set_positions(this, 'main_order'); 
    230       } 
    231     }); 
    232     $('#dashboard-boxes').sortable({ 
    233       cursor: 'move', 
    234       opacity: 0.5, 
    235       tolerance: "pointer", 
    236       update: function() { 
    237         set_positions(this, 'boxes_order'); 
    238       } 
    239     }); 
    240     $('#db-items').sortable({ 
    241       cursor: 'move', 
    242       opacity: 0.5, 
    243       tolerance: "pointer", 
    244       update: function() { 
    245         set_positions(this, 'boxes_items_order'); 
    246       } 
    247     }); 
    248     $('#db-contents').sortable({ 
    249       cursor: 'move', 
    250       opacity: 0.5, 
    251       tolerance: "pointer", 
    252       update: function() { 
    253         set_positions(this, 'boxes_contents_order'); 
    254       } 
    255     }); 
     228        set_positions(sel, id); 
     229      }, 
     230      start: function() { 
     231        $(sel).addClass('sortable-area'); 
     232      }, 
     233      stop: function() { 
     234        $(sel).removeClass('sortable-area'); 
     235      } 
     236    }); 
     237  }; 
     238  // Wait 5 seconds before activating ordering capabilities on dashboard 
     239  setTimeout(function() { 
     240    init_positions('#dashboard-main', 'main_order'); 
     241    init_positions('#dashboard-boxes', 'boxes_order'); 
     242    init_positions('#db-items', 'boxes_items_order'); 
     243    init_positions('#db-contents', 'boxes_contents_order'); 
    256244  }, 5000); 
    257245 
Note: See TracChangeset for help on using the changeset viewer.

Sites map