mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-11 05:56:15 +08:00
implemented icon upload in icon-picker
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
parent
67fbba1a84
commit
78c7512200
2 changed files with 34 additions and 7 deletions
|
@ -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';
|
||||
|
|
|
@ -13,17 +13,19 @@
|
|||
</div>
|
||||
<div class="iconModifier">
|
||||
<input id="iconPicker-Search" class="iconSearch" type="text" placeholder="{{ 'pick.icon.search' | translate }}">
|
||||
<input id="iconPicker-CustomIcon" class="iconSearch" type="file"/>
|
||||
<!--
|
||||
<div ng-repeat="(groupName, icons) in iconGroups">
|
||||
<a ng-click="jumpToGroup(groupName)">{{groupName}}</a>
|
||||
</div>-->
|
||||
<div ng-if="selectedIcon">
|
||||
{{ 'selected.icon' | translate}}: <br />
|
||||
<div ng-if="selectedIcon || customIcon">
|
||||
{{ 'selected.icon' | translate}}: <br />
|
||||
|
||||
<img ng-src="{{selectedIcon.url}}" height="32">
|
||||
<br />
|
||||
<button ng-click="useIcon()" ng-if="selectedIcon">{{ 'use.icon' | translate}}</button>
|
||||
</div>
|
||||
<img ng-src="{{selectedIcon.url}}" height="32" ng-if="!customIcon">
|
||||
<img src="{{customIcon.data}}" height="32" ng-if="customIcon">
|
||||
<br />
|
||||
<button ng-click="useIcon()">{{ 'use.icon' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Reference in a new issue