1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 08:52:15 -05:00

refactor keyfilBtn for broader usage

This commit is contained in:
Mario Volke 2014-11-20 15:25:32 +01:00 committed by Tankred Hase
parent c7463cd185
commit ac7af7168b
3 changed files with 11 additions and 10 deletions

View File

@ -119,13 +119,4 @@ ngModule.directive('keyfileInput', function() {
};
});
ngModule.directive('keyfileBtn', function() {
return function(scope, elm) {
elm.on('click touchstart', function(e) {
e.preventDefault();
document.querySelector('#keyfile-input').click();
});
};
});
module.exports = ContactsCtrl;

View File

@ -163,4 +163,14 @@ ngModule.directive('woFocusMe', function($timeout, $parse) {
};
});
ngModule.directive('woClickFileInput', function() {
return function(scope, elm, attrs) {
var fileInput = document.querySelector(attrs.woClickFileInput);
elm.on('click touchstart', function(e) {
e.preventDefault();
fileInput.click();
});
};
});
module.exports = ngModule;

View File

@ -9,7 +9,7 @@
<input class="u-hide-visually" id="keyfile-input" type="file" multiple accept=".asc" keyfile-input>
<div class="form-input-with-button u-gap-bottom">
<input class="input-text" type="text" placeholder="Search..." ng-model="searchText">
<button class="btn" ng-class="{'btn--invalid': sendBtnSecure === false}" keyfile-btn>Import keys</button>
<button class="btn" ng-class="{'btn--invalid': sendBtnSecure === false}" wo-click-file-input="#keyfile-input">Import keys</button>
</div>
<p class="typo-paragraph u-text-center" ng-show="!keys.length">