Skip to content

Instantly share code, notes, and snippets.

@svilpikas
Created July 29, 2015 06:40
Show Gist options
  • Save svilpikas/38c84bb35d6520b9758b to your computer and use it in GitHub Desktop.
Save svilpikas/38c84bb35d6520b9758b to your computer and use it in GitHub Desktop.
wqwq
angular.module('starter.controllers')
.controller('dragAndDropCtrl', function ($scope, $ionicPopup) {
//$scope.help = function () {
// var helpUp = $ionicPopup.show({
// title: '',
// templateUrl: "templates/statisticsHelpPopup.html",
// cssClass: 'statisticsHelpPopup',
// scope: $scope,
// buttons: [
// {
// text: 'Close'
// }
// ]
//
// });
// $scope.close = function () {
// helpUp.close();
// };
//
//};
//$scope.help();
$(function () {
$("#sortable, #sortable2").sortable({
appendTo: 'body',
tolerance: 'pointer',
connectWith: '.connectedSortable',
revert: 'invalid',
forceHelperSize: true,
helper: 'clone',
scroll: true
}).disableSelection();
});
$scope.centerAnchor = true;
$scope.toggleCenterAnchor = function () {
$scope.centerAnchor = !$scope.centerAnchor
};
$scope.droppedObjects1 = [{name: 'Sales % all'}, {name: 'Closes dialogue'}, {name: 'Hours'}, {name: 'Sales % dialogue'}];
$scope.droppedObjects2 = [{name: 'Closes'}, {name: 'Hitrate'}, {name: 'Sales'}, {name: 'Sales sum'}, {name: 'Contact %'},
{name: 'Successes'}, {name: 'Success % all'}, {name: 'Success % dialogue'}, {name: 'Calls'}];
$scope.onDropComplete1 = function (data, evt) {
var index = $scope.droppedObjects1.indexOf(data);
if (index == -1)
$scope.droppedObjects1.push(data);
}
$scope.onDragSuccess1 = function (data, evt) {
console.log("133", "$scope", "onDragSuccess1", "", evt);
var index = $scope.droppedObjects1.indexOf(data);
if (index > -1) {
$scope.droppedObjects1.splice(index, 1);
}
}
$scope.onDragSuccess2 = function (data, evt) {
var index = $scope.droppedObjects2.indexOf(data);
if (index > -1) {
$scope.droppedObjects2.splice(index, 1);
}
}
$scope.onDropComplete2 = function (data, evt) {
var index = $scope.droppedObjects2.indexOf(data);
if (index == -1) {
$scope.droppedObjects2.push(data);
}
}
var inArray = function (array, obj) {
var index = array.indexOf(obj);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment