mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 01:21:42 +00:00
table dragger a webpack
This commit is contained in:
parent
b019d95e94
commit
c00a827cb0
3 changed files with 16 additions and 15 deletions
|
@ -1,6 +1,5 @@
|
|||
//= require rails-ujs
|
||||
//= require turbolinks
|
||||
//= require input-tag/input-tag.js
|
||||
//= require table-dragger/dist/table-dragger
|
||||
//= require zepto/dist/zepto.min.js
|
||||
//= require_tree .
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
$(document).on('turbolinks:load', function() {
|
||||
var table = document.querySelector('.table-draggable');
|
||||
|
||||
if (table == null) return;
|
||||
|
||||
tableDragger(table, {
|
||||
mode: 'row',
|
||||
onlyBody: true,
|
||||
dragHandler: '.handle'
|
||||
}).on('drop', function(from, to, el, mode) {
|
||||
$('.reorder').val(function(i,v) { return i; });
|
||||
$('.submit-reorder').removeClass('d-none');
|
||||
});
|
||||
});
|
|
@ -17,3 +17,19 @@
|
|||
|
||||
require("trix")
|
||||
require("@rails/actiontext")
|
||||
import tableDragger from 'table-dragger'
|
||||
|
||||
document.addEventListener('turbolinks:load', () => {
|
||||
const table = document.querySelector('.table-draggable');
|
||||
|
||||
if (table == null) return;
|
||||
|
||||
tableDragger(table, {
|
||||
mode: 'row',
|
||||
onlyBody: true,
|
||||
dragHandler: '.handle'
|
||||
}).on('drop', (from, to, el, mode) => {
|
||||
$('.reorder').val((i,v) => i);
|
||||
$('.submit-reorder').removeClass('d-none');
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue