Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-12-15 15:59:21 +0300
committerfnuesse <felix.nuesse@t-online.de>2018-12-15 15:59:21 +0300
commit78c7512200608cf0c4f24287b792b51e314a007e (patch)
tree126fb3a6a6b7404aca90226f4c8d59172aeeead1 /js/app/directives/iconpicker.js
parent67fbba1a84fb863377b637ed0dc905ef5924bd08 (diff)
implemented icon upload in icon-picker
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
Diffstat (limited to 'js/app/directives/iconpicker.js')
-rw-r--r--js/app/directives/iconpicker.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/js/app/directives/iconpicker.js b/js/app/directives/iconpicker.js
index 2fabf176..bf2e8c03 100644
--- a/js/app/directives/iconpicker.js
+++ b/js/app/directives/iconpicker.js
@@ -93,7 +93,32 @@
return false;
};
- scope.useIcon = function() {
+ $('#iconPicker-CustomIcon').on('change', function(ev) {
+
+ console.log("upload");
+ scope.customIcon = {};
+
+ var f = ev.target.files[0];
+ var fr = new FileReader();
+
+ fr.onload = function(ev2) {
+ scope.customIcon.data=ev2.target.result;
+ scope.$apply();
+ };
+
+ fr.readAsDataURL(f);
+ });
+
+ scope.useIcon = function() {
+
+ if(scope.customIcon){
+ var data = scope.customIcon.data;
+ scope.credential.icon.type = data.substring(data.lastIndexOf(":")+1,data.lastIndexOf(";"));
+ scope.credential.icon.content = data.substring(data.lastIndexOf(",")+1, data.length);
+ $('#iconPicker').dialog('close');
+ return;
+ }
+
$http.get(scope.selectedIcon.url).then(function(result) {
var base64Data = window.btoa(result.data);
var mimeType = 'svg+xml';