Fix all drag and drop issues in channel and filler lists.
This commit is contained in:
parent
88c9c8e17d
commit
61e9f0cc67
@ -110,18 +110,23 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
scope._selectedProgram = null
|
||||
updateChannelDuration()
|
||||
}
|
||||
scope.dropFunction = (dropIndex, index, program) => {
|
||||
if (scope.channel.programs[index].start == program.start) {
|
||||
return false;
|
||||
scope.dropFunction = (dropIndex, program) => {
|
||||
let y = program.$index;
|
||||
let z = dropIndex + scope.currentStartIndex - 1;
|
||||
scope.channel.programs.splice(y, 1);
|
||||
if (z >= y) {
|
||||
z--;
|
||||
}
|
||||
|
||||
setTimeout( () => {
|
||||
scope.channel.programs.splice(dropIndex + index, 0, program);
|
||||
updateChannelDuration()
|
||||
scope.$apply();
|
||||
}, 1);
|
||||
return true;
|
||||
scope.channel.programs.splice(z, 0, program );
|
||||
updateChannelDuration();
|
||||
$timeout();
|
||||
return false;
|
||||
}
|
||||
scope.setUpWatcher = function setupWatchers() {
|
||||
this.$watch('vsRepeat.startIndex', function(val) {
|
||||
scope.currentStartIndex = val;
|
||||
});
|
||||
};
|
||||
|
||||
let fixFillerCollection = (f) => {
|
||||
return {
|
||||
|
||||
@ -26,16 +26,15 @@ module.exports = function ($timeout) {
|
||||
}
|
||||
|
||||
scope.dropFunction = (dropIndex, program) => {
|
||||
setTimeout( () => {
|
||||
if (program.$index < dropIndex) {
|
||||
scope.content.splice(scope.currentStartIndex + dropIndex-2, 0, program);
|
||||
} else {
|
||||
scope.content.splice(scope.currentStartIndex + dropIndex-1, 0, program);
|
||||
}
|
||||
refreshContentIndexes();
|
||||
scope.$apply();
|
||||
}, 1);
|
||||
return true;
|
||||
let y = program.$index;
|
||||
let z = dropIndex + scope.currentStartIndex - 1;
|
||||
scope.content.splice(y, 1);
|
||||
if (z >= y) {
|
||||
z--;
|
||||
}
|
||||
scope.content.splice(z, 0, program );
|
||||
$timeout();
|
||||
return false;
|
||||
}
|
||||
scope.setUpWatcher = function setupWatchers() {
|
||||
this.$watch('vsRepeat.startIndex', function(val) {
|
||||
@ -44,7 +43,7 @@ module.exports = function ($timeout) {
|
||||
};
|
||||
|
||||
scope.movedFunction = (index) => {
|
||||
scope.content.splice(index, 1);
|
||||
console.log("movedFunction(" + index + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -432,11 +432,12 @@
|
||||
|
||||
</div>
|
||||
<div class="list-group list-group-root">
|
||||
<div vs-repeat="options" style='max-height: 30em; overflow-y: auto;'>
|
||||
<div ng-repeat="x in channel.programs track by x.$index" ng-click="selectProgram(x.$index)" dnd-list="" dnd-drop="dropFunction(index , x.$index, item)" style="height: 1.5em; overflow:hidden">
|
||||
<div vs-repeat style='max-height: 30em; overflow-y: auto;' ng-init="setUpWatcher()" dnd-list="" dnd-drop="dropFunction(index , item)" ng-if="true" >
|
||||
<div ng-repeat="x in channel.programs track by x.$index" ng-click="selectProgram(x.$index)" style="height: 1.5em; overflow:hidden"
|
||||
dnd-draggable="x" dnd-moved="" dnd-effect-allowed="move"
|
||||
>
|
||||
|
||||
<div class="list-group-item flex-container program-row" dnd-draggable="x" dnd-moved="channel.programs.splice(x.$index, 1);" dnd-effect-allowed="move"
|
||||
>
|
||||
<div class="list-group-item flex-container program-row" >
|
||||
|
||||
<div class="program-start">
|
||||
{{ dateForGuide(x.start) }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user