Changeset 3906:67f6a46a8802 for admin/js
- Timestamp:
- 10/23/18 12:10:59 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_index.js
r3905 r3906 237 237 }); 238 238 }; 239 // Wait 5 seconds before activating ordering capabilities on dashboard 240 setTimeout(function() { 241 init_positions('#dashboard-main', 'main_order'); 242 init_positions('#dashboard-boxes', 'boxes_order'); 243 init_positions('#db-items', 'boxes_items_order'); 244 init_positions('#db-contents', 'boxes_contents_order'); 245 }, 5000); 239 const reset_positions = function(sel) { 240 $(sel).sortable('destroy'); 241 }; 242 // List of sortable areas 243 const areas = [ 244 ['#dashboard-main', 'main_order'], 245 ['#dashboard-boxes', 'boxes_order'], 246 ['#db-items', 'boxes_items_order'], 247 ['#db-contents', 'boxes_contents_order'] 248 ]; 249 // Set or reset sortable depending on #dragndrop checbkox value 250 $('#dragndrop').click(function() { 251 if ($(this).is(':checked')) { 252 // Activate sorting feature 253 areas.forEach(element => init_positions(element[0], element[1])); 254 $(this).prop('title', dotclear.dragndrop_on); 255 } else { 256 // Deactivate sorting feature 257 areas.forEach(element => reset_positions(element[0])); 258 $(this).prop('title', dotclear.dragndrop_off); 259 } 260 }); 246 261 } 247 262 });
Note: See TracChangeset
for help on using the changeset viewer.