Browse Source

replace the sortable jquery plugin with html5sortable

pull/74/head
Simon Vieille 3 weeks ago
parent
commit
db2220e745
  1. 8
      css/admin.css
  2. 20
      src/admin.js
  3. 1
      templates/settings/admin-form.php
  4. 2
      vendor/html5sortable.min.js

8
css/admin.css

@ -20,7 +20,7 @@
margin: 10px 0 10px 0;
}
#side-menu-section input[type="checkbox"] {
#-dropside-menu-section input[type="checkbox"] {
vertical-align: middle;
}
@ -81,6 +81,12 @@
cursor: pointer;
}
.side-menu-setting-list-drop {
background: yellow;
border-color: yellow;
height: 34px;
}
.side-menu-setting.arrow {
color: #ccc;
padding-right: 5px;

20
src/admin.js

@ -186,17 +186,17 @@ document.addEventListener('DOMContentLoaded', () => {
})
}
jQuery("#categories-list .side-menu-setting-list").sortable({
forcePlaceholderSize: true,
placeholder: 'placeholder',
stop: function (event, ui) {
let value = []
for (let item of document.querySelectorAll('#categories-list .side-menu-setting-list-item')) {
value.push(item.getAttribute('data-id'))
}
sortable('#categories-list .side-menu-setting-list', {
placeholderClass: 'side-menu-setting-list-drop'
})
document.querySelector('input[name="categories-order"]').value = JSON.stringify(value)
sortable('#categories-list .side-menu-setting-list')[0].addEventListener('sortstop', (e) => {
let value = []
for (let item of document.querySelectorAll('#categories-list .side-menu-setting-list-item')) {
value.push(item.getAttribute('data-id'))
}
document.querySelector('input[name="categories-order"]').value = JSON.stringify(value)
})
})

1
templates/settings/admin-form.php

@ -20,6 +20,7 @@ use OCP\IURLGenerator;
use OCP\IConfig;
use OCA\SideMenu\AppInfo\Application;
vendor_script('side_menu', 'html5sortable.min');
script('side_menu', 'admin');
style('side_menu', 'admin');

2
vendor/html5sortable.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save