reverting custom logo

This commit is contained in:
jaredevantabor
2017-02-21 16:30:45 -08:00
parent 578988f2e4
commit 198fa2740a
2 changed files with 12 additions and 4 deletions

View File

@@ -297,10 +297,12 @@ export default [
$scope[key] = $scope.configDataResolve[key].default; $scope[key] = $scope.configDataResolve[key].default;
if($scope[key + '_field'].type === "select"){ if($scope[key + '_field'].type === "select"){
// We need to re-instantiate the Select2 element // We need to re-instantiate the Select2 element
// after resetting the value. Example: // after resetting the value. Example:
// `$scope.$broadcast(AD_HOC_COMMANDS_populated)`
$scope.$broadcast(key+'_populated', null, false); $scope.$broadcast(key+'_populated', null, false);
} }
if($scope[key + '_field'].reset === "CUSTOM_LOGO"){
$scope.$broadcast(key+'_reverted');
}
loginUpdate(); loginUpdate();
}) })
.catch(function(error) { .catch(function(error) {

View File

@@ -168,12 +168,18 @@ function(ConfigurationUtils, i18n, $rootScope) {
scope.imageData = $rootScope.custom_logo; scope.imageData = $rootScope.custom_logo;
}); });
scope.update = function(e) { scope.$on(fieldKey+'_reverted', function(e) {
if(scope.$parent[fieldKey]) { scope.update(e, true);
});
scope.update = function(e, flag) {
if(scope.$parent[fieldKey] || flag ) {
e.preventDefault(); e.preventDefault();
scope.$parent[fieldKey] = ''; scope.$parent[fieldKey] = '';
filePickerButton.html(browseText); filePickerButton.html(browseText);
filePickerText.val(''); filePickerText.val('');
filePicker.value = "";
scope.imagePresent = false;
} }
else { else {
// Nothing exists so open file picker // Nothing exists so open file picker