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;
if($scope[key + '_field'].type === "select"){
// We need to re-instantiate the Select2 element
// after resetting the value. Example:
// `$scope.$broadcast(AD_HOC_COMMANDS_populated)`
// after resetting the value. Example:
$scope.$broadcast(key+'_populated', null, false);
}
if($scope[key + '_field'].reset === "CUSTOM_LOGO"){
$scope.$broadcast(key+'_reverted');
}
loginUpdate();
})
.catch(function(error) {

View File

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