-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultiNodeTreePickerEditor.controller.js
45 lines (39 loc) · 1.46 KB
/
MultiNodeTreePickerEditor.controller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
angular.module("umbraco").controller("MultiNodeTreePickerEditor.controller",
function ($scope, assetsService, $http, dialogService) {
if (!angular.isArray($scope.model.value)) {
$scope.model.value = [];
}
// Remove an item from the Multi Node Tree Picker
$scope.remove = function (item) {
$scope.model.value.splice($scope.model.value.indexOf(item), 1);
};
//defines the options for the jquery sortable
$scope.sortableOptions = {
axis: 'y',
cursor: "move",
handle: ".handle",
update: function (ev, ui) {
},
stop: function (ev, ui) {
}
};
//Loading the styles
assetsService.loadCss("/app_plugins/MultiNodeTreePicker/assets/css/MultiNodeTreePickerEditor.css");
// Render the Multi Node Tree Picker
$scope.pickContent = function () {
dialogService.treePicker({
multiPicker: true,
section: "content",
treeAlias: "content",
callback: function (data) {
var links = data.map(function (link) {
return {
id: link.id,
name: link.name
};
});
$scope.model.value = $scope.model.value.concat(links);
}
});
};
});