Commit 3bfb4be6 authored by Clement Ho's avatar Clement Ho

Create sortableConfig

parent 2cc7e560
/* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */ /* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */
/* global DocumentTouch */ /* global DocumentTouch */
import sortableConfig from '~/sortable_config';
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
...@@ -18,19 +20,15 @@ gl.issueBoards.onEnd = () => { ...@@ -18,19 +20,15 @@ gl.issueBoards.onEnd = () => {
gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
gl.issueBoards.getBoardSortableDefaultOptions = (obj) => { gl.issueBoards.getBoardSortableDefaultOptions = (obj) => {
const defaultSortOptions = {
animation: 200, const defaultSortOptions = Object.assign({}, sortableConfig, {
forceFallback: true,
fallbackClass: 'is-dragging',
fallbackOnBody: true,
ghostClass: 'is-ghost',
filter: '.board-delete, .btn', filter: '.board-delete, .btn',
delay: gl.issueBoards.touchEnabled ? 100 : 0, delay: gl.issueBoards.touchEnabled ? 100 : 0,
scrollSensitivity: gl.issueBoards.touchEnabled ? 60 : 100, scrollSensitivity: gl.issueBoards.touchEnabled ? 60 : 100,
scrollSpeed: 20, scrollSpeed: 20,
onStart: gl.issueBoards.onStart, onStart: gl.issueBoards.onStart,
onEnd: gl.issueBoards.onEnd onEnd: gl.issueBoards.onEnd,
}; })
Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; }); Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; });
return defaultSortOptions; return defaultSortOptions;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import Sortable from 'vendor/Sortable'; import Sortable from 'vendor/Sortable';
import loadingIcon from '~/vue_shared/components/loading_icon.vue'; import loadingIcon from '~/vue_shared/components/loading_icon.vue';
import tooltip from '~/vue_shared/directives/tooltip'; import tooltip from '~/vue_shared/directives/tooltip';
import sortableConfig from '~/sortable_config';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import issueItem from './issue_item.vue'; import issueItem from './issue_item.vue';
import addIssuableForm from './add_issuable_form.vue'; import addIssuableForm from './add_issuable_form.vue';
...@@ -111,12 +112,7 @@ export default { ...@@ -111,12 +112,7 @@ export default {
}, },
mounted() { mounted() {
if (this.canReorder) { if (this.canReorder) {
this.sortable = Sortable.create(this.$refs.list, { this.sortable = Sortable.create(this.$refs.list, Object.assign({}, sortableConfig, {
animation: 200,
forceFallback: true,
fallbackClass: 'is-dragging',
fallbackOnBody: true,
ghostClass: 'is-ghost',
onStart: this.addDraggingCursor, onStart: this.addDraggingCursor,
onEnd: this.reordered, onEnd: this.reordered,
}); });
......
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