Dotclear

Changeset 3839:783854ebd4ce for admin/js


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

Location:
admin/js
Files:
2 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 
  • admin/js/common.js

    r3820 r3839  
    135135    $(ctarget).click(function(e) { 
    136136      if (p.user_pref && set_user_pref) { 
    137         if (p.hide ^ p.reverse_user_pref) { 
    138           jQuery.post('services.php', { 
    139             'f': 'setSectionFold', 
    140             'section': p.user_pref, 
    141             'value': 1, 
    142             xd_check: dotclear.nonce 
    143           }, function() {}); 
    144         } else { 
    145           jQuery.post('services.php', { 
    146             'f': 'setSectionFold', 
    147             'section': p.user_pref, 
    148             'value': 0, 
    149             xd_check: dotclear.nonce 
    150           }, function() {}); 
    151         } 
     137        jQuery.post('services.php', { 
     138          'f': 'setSectionFold', 
     139          'section': p.user_pref, 
     140          'value': (p.hide ^ p.reverse_user_pref ? 1 : 0), 
     141          xd_check: dotclear.nonce 
     142        }, function() {}); 
    152143        jQuery.cookie(p.user_pref, '', { 
    153144          expires: -1 
Note: See TracChangeset for help on using the changeset viewer.

Sites map