Created default sortable options to be shared between the lists & the cards
Added full vue.js source
This commit is contained in:
parent
a3831192d9
commit
f1242c17a5
|
@ -4,6 +4,7 @@
|
|||
//= require_tree ./models
|
||||
//= require_tree ./stores
|
||||
//= require_tree ./services
|
||||
//= require_tree ./mixins
|
||||
//= require_tree ./components
|
||||
|
||||
$(function () {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
getFilterData: function () {
|
||||
const queryData = this.board.canSearch() ? { search: this.query } : {};
|
||||
|
||||
return _.extend(this.filters, queryData);
|
||||
return _.extend(queryData, this.filters);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -39,27 +39,17 @@
|
|||
}
|
||||
},
|
||||
ready: function () {
|
||||
Sortable.create(this.$el.parentNode, {
|
||||
const options = _.extend({
|
||||
group: 'boards',
|
||||
animation: 150,
|
||||
draggable: '.is-draggable',
|
||||
handle: '.js-board-handle',
|
||||
filter: '.board-delete',
|
||||
forceFallback: true,
|
||||
fallbackClass: 'is-dragging',
|
||||
ghostClass: 'is-ghost',
|
||||
scrollSensitivity: 150,
|
||||
scrollSpeed: 50,
|
||||
onUpdate: function (e) {
|
||||
BoardsStore.moveList(e.oldIndex, e.newIndex);
|
||||
},
|
||||
onStart: function () {
|
||||
document.body.classList.add('is-dragging');
|
||||
},
|
||||
onEnd: function () {
|
||||
document.body.classList.remove('is-dragging');
|
||||
}
|
||||
});
|
||||
}, gl.boardSortableDefaultOptions);
|
||||
|
||||
Sortable.create(this.$el.parentNode, options);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -35,29 +35,20 @@
|
|||
},
|
||||
},
|
||||
ready: function () {
|
||||
Sortable.create(this.$els.list, {
|
||||
const options = _.extend({
|
||||
sort: false,
|
||||
group: 'issues',
|
||||
disabled: this.disabled,
|
||||
scrollSensitivity: 150,
|
||||
scrollSpeed: 50,
|
||||
forceFallback: true,
|
||||
fallbackClass: 'is-dragging',
|
||||
ghostClass: 'is-ghost',
|
||||
onAdd: function (e) {
|
||||
const fromListId = parseInt(e.from.getAttribute('data-board')),
|
||||
toListId = parseInt(e.to.getAttribute('data-board')),
|
||||
issueId = parseInt(e.item.getAttribute('data-issue'));
|
||||
|
||||
BoardsStore.moveCardToList(fromListId, toListId, issueId);
|
||||
},
|
||||
onStart: function () {
|
||||
document.body.classList.add('is-dragging');
|
||||
},
|
||||
onEnd: function () {
|
||||
document.body.classList.remove('is-dragging');
|
||||
}
|
||||
});
|
||||
}, gl.boardSortableDefaultOptions);
|
||||
|
||||
Sortable.create(this.$els.list, options);
|
||||
|
||||
// Scroll event on list to load more
|
||||
this.$els.list.onscroll = () => {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
(function (w) {
|
||||
if (!window.gl) {
|
||||
window.gl = {};
|
||||
}
|
||||
|
||||
gl.boardSortableDefaultOptions = {
|
||||
animation: 150,
|
||||
forceFallback: true,
|
||||
fallbackClass: 'is-dragging',
|
||||
ghostClass: 'is-ghost',
|
||||
scrollSensitivity: 150,
|
||||
scrollSpeed: 50,
|
||||
onStart: function () {
|
||||
document.body.classList.add('is-dragging');
|
||||
},
|
||||
onEnd: function () {
|
||||
document.body.classList.remove('is-dragging');
|
||||
}
|
||||
};
|
||||
})(window);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue