Revert "Remove draggable for now"

This reverts commit f4c0a68fde99471bd546902ec2b9301ff6cec73a.
This commit is contained in:
Pavel Djundik 2018-08-30 21:12:53 +03:00
parent 9d8f02ce99
commit 5d4400ef90
3 changed files with 14 additions and 12 deletions

View file

@ -7,12 +7,11 @@
<Draggable <Draggable
v-else v-else
:list="networks" :list="networks"
:options="{ handle: '.lobby', draggable: '.network', ghostClass: 'network-placeholder' }" :options="{ handle: '.lobby', draggable: '.network', ghostClass: 'network-placeholder', disabled: isSortingEnabled }"
class="networks" class="networks"
@change="onNetworkSort" @change="onNetworkSort"
@start="onDragStart" @start="onDragStart"
@end="onDragEnd" @end="onDragEnd">
>
<div <div
v-for="network in networks" v-for="network in networks"
:id="'network-' + network.uuid" :id="'network-' + network.uuid"
@ -38,15 +37,15 @@
@toggleJoinChannel="network.isJoinChannelShown = !network.isJoinChannelShown" /> @toggleJoinChannel="network.isJoinChannelShown = !network.isJoinChannelShown" />
<Draggable <Draggable
:options="{ draggable: '.chan', ghostClass: 'chan-placeholder' }" :options="{ draggable: '.chan', ghostClass: 'chan-placeholder', disabled: isSortingEnabled }"
:list="network.channels" :list="network.channels"
class="channels" class="channels"
@change="onChannelSort" @change="onChannelSort"
@start="onDragStart" @start="onDragStart"
@end="onDragEnd" @end="onDragEnd">
>
<Channel <Channel
v-for="channel in getChannelsWithoutLobby(network)" v-for="(channel, index) in network.channels"
v-if="index > 0"
:key="channel.id" :key="channel.id"
:channel="channel" :channel="channel"
:network="network" :network="network"
@ -76,6 +75,14 @@ export default {
activeChannel: Object, activeChannel: Object,
networks: Array, networks: Array,
}, },
computed: {
isSortingEnabled() {
const isTouch = !!("ontouchstart" in window || (window.DocumentTouch && document instanceof window.DocumentTouch));
// TODO: Implement a way to sort on touch devices
return isTouch;
},
},
methods: { methods: {
onDragStart(e) { onDragStart(e) {
e.target.classList.add("ui-sortable-helper"); e.target.classList.add("ui-sortable-helper");

View file

@ -90,7 +90,6 @@
"intersection-observer": "0.5.1", "intersection-observer": "0.5.1",
"istanbul-instrumenter-loader": "3.0.1", "istanbul-instrumenter-loader": "3.0.1",
"jquery": "3.3.1", "jquery": "3.3.1",
"jquery-ui": "1.12.1",
"mini-css-extract-plugin": "0.5.0", "mini-css-extract-plugin": "0.5.0",
"mocha": "5.2.0", "mocha": "5.2.0",
"mocha-loader": "2.0.0", "mocha-loader": "2.0.0",

View file

@ -4115,10 +4115,6 @@ istanbul-reports@^2.1.0:
dependencies: dependencies:
handlebars "^4.0.11" handlebars "^4.0.11"
jquery-ui@1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
jquery@3.3.1: jquery@3.3.1:
version "3.3.1" version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"