Fix placeholder text when empty alias input after generating alias (#4032)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
291d58900f
commit
c619b79276
@@ -86,20 +86,21 @@ angular.module("umbraco.directives")
|
|||||||
function generateAlias(value) {
|
function generateAlias(value) {
|
||||||
|
|
||||||
if (generateAliasTimeout) {
|
if (generateAliasTimeout) {
|
||||||
$timeout.cancel(generateAliasTimeout);
|
$timeout.cancel(generateAliasTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( value !== undefined && value !== "" && value !== null) {
|
if (value !== undefined && value !== "" && value !== null) {
|
||||||
|
|
||||||
scope.alias = "";
|
scope.alias = "";
|
||||||
scope.placeholderText = scope.labels.busy;
|
scope.placeholderText = scope.labels.busy;
|
||||||
|
|
||||||
generateAliasTimeout = $timeout(function () {
|
generateAliasTimeout = $timeout(function () {
|
||||||
updateAlias = true;
|
updateAlias = true;
|
||||||
entityResource.getSafeAlias(value, true).then(function (safeAlias) {
|
entityResource.getSafeAlias(value, true).then(function (safeAlias) {
|
||||||
if (updateAlias) {
|
if (updateAlias) {
|
||||||
scope.alias = safeAlias.alias;
|
scope.alias = safeAlias.alias;
|
||||||
}
|
}
|
||||||
|
scope.placeholderText = scope.labels.idle;
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
@@ -108,7 +109,6 @@ angular.module("umbraco.directives")
|
|||||||
scope.alias = "";
|
scope.alias = "";
|
||||||
scope.placeholderText = scope.labels.idle;
|
scope.placeholderText = scope.labels.idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if alias gets unlocked - stop watching alias
|
// if alias gets unlocked - stop watching alias
|
||||||
@@ -119,17 +119,17 @@ angular.module("umbraco.directives")
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// validate custom entered alias
|
// validate custom entered alias
|
||||||
eventBindings.push(scope.$watch('alias', function(newValue, oldValue){
|
eventBindings.push(scope.$watch('alias', function (newValue, oldValue) {
|
||||||
|
if (scope.alias === "" || scope.alias === null || scope.alias === undefined) {
|
||||||
if(scope.alias === "" && bindWatcher === true || scope.alias === null && bindWatcher === true) {
|
if (bindWatcher === true) {
|
||||||
// add watcher
|
// add watcher
|
||||||
eventBindings.push(scope.$watch('aliasFrom', function(newValue, oldValue) {
|
eventBindings.push(scope.$watch('aliasFrom', function (newValue, oldValue) {
|
||||||
if(bindWatcher) {
|
if (bindWatcher) {
|
||||||
generateAlias(newValue);
|
generateAlias(newValue);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
|||||||
Reference in New Issue
Block a user