Bug in exclude - Dialogoption.filter

This commit is contained in:
Nathalie Festin
2018-03-11 20:41:51 +01:00
parent 304e574bbc
commit 38e9a3d2ee

View File

@@ -20,16 +20,16 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
selectedSearchResults: []
}
$scope.model.selection = [];
//Used for toggling an empty-state message
$scope.model.selection = [];
//Used for toggling an empty-state message
//Some trees can have no items (dictionary & forms email templates)
$scope.hasItems = true;
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
//This is called from ng-init
//it turns out it is called from the angular html : / Have a look at views/common / overlays / contentpicker / contentpicker.html you'll see ng-init.
//This is called from ng-init
//it turns out it is called from the angular html : / Have a look at views/common / overlays / contentpicker / contentpicker.html you'll see ng-init.
//this is probably an anti pattern IMO and shouldn't be used
$scope.init = function (contentType) {
@@ -109,7 +109,8 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
else {
if (dialogOptions.filter.startsWith("!")) {
dialogOptions.filterExclude = true;
dialogOptions.filter = dialogOptions.filter.substring(1);
//dialogOptions.filter = dialogOptions.filter.substring(1); // Can't substring the value on dialogoptions.filter as it then keeps it's modified value next time the dialog opens
dialogOptions.filterTypes = dialogOptions.filter.substring(1);
}
//used advanced filtering
@@ -157,8 +158,8 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
//gets the tree object when it loads
function treeLoadedHandler(ev, args) {
//args.tree contains children (args.tree.root.children)
$scope.hasItems = args.tree.root.children.length > 0;
//args.tree contains children (args.tree.root.children)
$scope.hasItems = args.tree.root.children.length > 0;
tree = args.tree;
}
@@ -215,7 +216,7 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
icon: "icon-folder",
id: id,
name: text
};
};
if ($scope.multiPicker) {
if (entity) {
@@ -315,7 +316,7 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
}
});
} else {
var a = dialogOptions.filter.toLowerCase().replace(/\s/g, '').split(',');
var a = dialogOptions.filterTypes.toLowerCase().replace(/\s/g, '').split(',');
angular.forEach(nodes, function (value, key) {
var found = a.indexOf(value.metaData.contentType.toLowerCase()) >= 0;