diff options
Diffstat (limited to 'js/components/avatar/avatar_directive.js')
-rw-r--r-- | js/components/avatar/avatar_directive.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/js/components/avatar/avatar_directive.js b/js/components/avatar/avatar_directive.js deleted file mode 100644 index 542f0702..00000000 --- a/js/components/avatar/avatar_directive.js +++ /dev/null @@ -1,36 +0,0 @@ -angular.module('contactsApp') -.directive('avatar', function(ContactService) { - return { - scope: { - contact: '=data' - }, - controller: 'avatarCtrl', - controllerAs: 'ctrl', - bindToController: { - contact: '=data' - }, - link: function(scope, element) { - var input = element.find('input'); - input.bind('change', function() { - var file = input.get(0).files[0]; - if (file.size > 1024*1024) { // 1 MB - OC.Notification.showTemporary(t('contacts', 'The selected image is too big (max 1MB)')); - } else { - var reader = new FileReader(); - - reader.addEventListener('load', function () { - scope.$apply(function() { - scope.contact.photo(reader.result); - ContactService.update(scope.contact); - }); - }, false); - - if (file) { - reader.readAsDataURL(file); - } - } - }); - }, - templateUrl: OC.linkTo('contacts', 'templates/avatar.html') - }; -}); |