Commit f1242c17 authored by Phil Hughes's avatar Phil Hughes

Created default sortable options to be shared between the lists & the cards

Added full vue.js source
parent a3831192
......@@ -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 = () => {
......
(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);
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment