diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.controller.js
index 0cd199ae4d..216f1555e2 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.controller.js
@@ -4,6 +4,9 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
$scope.model.value = [];
}
+ $scope.hasError = false;
+ $scope.errorMsg = "";
+
$scope.propertyAliases = [];
$scope.selectedField = null;
$scope.systemFields = [
@@ -45,6 +48,11 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
return alias;
}
+ $scope.changeField = function () {
+ $scope.hasError = false;
+ $scope.errorMsg = "";
+ }
+
$scope.removeField = function(e) {
$scope.model.value = _.reject($scope.model.value, function (x) {
return x.alias === e.alias;
@@ -123,19 +131,34 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
$scope.addField = function () {
var val = $scope.selectedField;
- var isSystem = val.startsWith("_system_");
- if (isSystem) {
- val = val.trimStart("_system_");
- }
+ if (val) {
+ var isSystem = val.startsWith("_system_");
+ if (isSystem) {
+ val = val.trimStart("_system_");
+ }
- var exists = _.find($scope.model.value, function (i) {
- return i.alias === val;
- });
- if (!exists) {
- $scope.model.value.push({
- alias: val,
- isSystem: isSystem ? 1 : 0
+ var exists = _.find($scope.model.value, function (i) {
+ return i.alias === val;
});
+
+ if (!exists) {
+ $scope.hasError = false;
+ $scope.errorMsg = "";
+
+ $scope.model.value.push({
+ alias: val,
+ isSystem: isSystem ? 1 : 0
+ });
+ }
+ else {
+ //there was an error, do the highlight (will be set back by the directive)
+ $scope.hasError = true;
+ $scope.errorMsg = "Property is already added";
+ }
+ }
+ else {
+ $scope.hasError = true;
+ $scope.errorMsg = "No property selected";
}
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.html
index 2e210e635f..749d5b5cb0 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/includeproperties.prevalues.html
@@ -1,7 +1,7 @@
-
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
index 8f9279fb02..03b95b6883 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
@@ -57,24 +57,27 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie
totalPages: 0,
items: []
};
+
+ //when this is null, we don't check permissions
+ $scope.currentNodePermissions = null;
+
+ if ($scope.entityType === "content") {
+ //Just ensure we do have an editorState
+ if (editorState.current) {
+ //Fetch current node allowed actions for the current user
+ //This is the current node & not each individual child node in the list
+ var currentUserPermissions = editorState.current.allowedActions;
- $scope.currentNodePermissions = {}
-
- //Just ensure we do have an editorState
- if (editorState.current) {
- //Fetch current node allowed actions for the current user
- //This is the current node & not each individual child node in the list
- var currentUserPermissions = editorState.current.allowedActions;
-
- //Create a nicer model rather than the funky & hard to remember permissions strings
- $scope.currentNodePermissions = {
- "canCopy": _.contains(currentUserPermissions, 'O'), //Magic Char = O
- "canCreate": _.contains(currentUserPermissions, 'C'), //Magic Char = C
- "canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D
- "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M
- "canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U
- "canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
- };
+ //Create a nicer model rather than the funky & hard to remember permissions strings
+ $scope.currentNodePermissions = {
+ "canCopy": _.contains(currentUserPermissions, 'O'), //Magic Char = O
+ "canCreate": _.contains(currentUserPermissions, 'C'), //Magic Char = C
+ "canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D
+ "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M
+ "canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U
+ "canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
+ };
+ }
}
//when this is null, we don't check permissions
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
index 97500fd7c1..2683317dc1 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
@@ -10,7 +10,7 @@
-
+