Allow icon to be set
This commit is contained in:
@@ -50,6 +50,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
ssoAuth: false,
|
||||
tags: '',
|
||||
label: '',
|
||||
icon: { data: null },
|
||||
|
||||
action: 'general',
|
||||
|
||||
@@ -119,6 +120,22 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
// translate for tag-input
|
||||
$scope.appConfigure.tags = app.tags ? app.tags.join(',') : '';
|
||||
|
||||
$('#iconFileInput').get(0).onchange = function (event) {
|
||||
var fr = new FileReader();
|
||||
fr.onload = function () {
|
||||
$scope.$apply(function () {
|
||||
var tmp = {
|
||||
file: event.target.files[0],
|
||||
data: fr.result,
|
||||
url: null
|
||||
};
|
||||
|
||||
$scope.appConfigure.icon = tmp;
|
||||
});
|
||||
};
|
||||
fr.readAsDataURL(event.target.files[0]);
|
||||
};
|
||||
|
||||
$('#appConfigureModal').modal('show');
|
||||
},
|
||||
|
||||
@@ -179,6 +196,14 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
data.mailboxName = '';
|
||||
}
|
||||
|
||||
if ($scope.appConfigure.icon) {
|
||||
if ($scope.appConfigure.icon.data) {
|
||||
data.icon = $scope.appConfigure.icon.data.replace(/^data:image\/[a-z]+;base64,/, '');
|
||||
} else { // reset the icon
|
||||
data.icon = '';
|
||||
}
|
||||
}
|
||||
|
||||
Client.configureApp($scope.appConfigure.app.id, data, function (error) {
|
||||
let tab = 'advanced'; // the tab to switch to
|
||||
|
||||
@@ -227,6 +252,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
|
||||
$scope.reset();
|
||||
});
|
||||
},
|
||||
|
||||
showCustomIconSelector: function () {
|
||||
$('#iconFileInput').click();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user