From e5fd3c38f427d801ea4a4e6d09f9125a073eae07 Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Thu, 31 Jul 2014 14:06:55 -0300 Subject: [PATCH] Fix open external in new tab and fix typo --- js/controllers/addresses.js | 7 ------- js/directives.js | 32 +++++++++++++++++++------------- views/modals/qr-address.html | 4 ++-- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index 907bfc7ef..c81a10fc3 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -20,13 +20,6 @@ angular.module('copayApp.controllers').controller('AddressesController', var ModalInstanceCtrl = function ($scope, $modalInstance, address) { $scope.address = address; - $scope.openExternal = function(address) { - var url = 'bitcoin:' + address; - if (window.cordova) return window.open(url, '_blank'); - - window.location = url; - } - $scope.cancel = function () { $modalInstance.dismiss('cancel'); }; diff --git a/js/directives.js b/js/directives.js index b1d6c3b35..3fac18f34 100644 --- a/js/directives.js +++ b/js/directives.js @@ -198,24 +198,31 @@ angular.module('copayApp.directives') } }; }) -// From https://gist.github.com/asafge/7430497 -.directive('ngReallyClick', [ - - function() { + .directive('openExternal', function() { return { restrict: 'A', link: function(scope, element, attrs) { element.bind('click', function() { - var message = attrs.ngReallyMessage; - if (message && confirm(message)) { - scope.$apply(attrs.ngReallyClick); - } + window.open('bitcoin:'+attrs.address, '_blank'); }); } } - } -]) - + }) + // From https://gist.github.com/asafge/7430497 + .directive('ngReallyClick', [function() { + return { + restrict: 'A', + link: function(scope, element, attrs) { + element.bind('click', function() { + var message = attrs.ngReallyMessage; + if (message && confirm(message)) { + scope.$apply(attrs.ngReallyClick); + } + }); + } + } + } + ]) .directive('match', function () { return { require: 'ngModel', @@ -231,5 +238,4 @@ angular.module('copayApp.directives') }); } }; - }) -; + }); diff --git a/views/modals/qr-address.html b/views/modals/qr-address.html index ca80055e5..7919d1454 100644 --- a/views/modals/qr-address.html +++ b/views/modals/qr-address.html @@ -9,8 +9,8 @@ {{address.balance || 0|noFractionNumber}} {{$root.unitName}}
- -   Open in external aplication + +   Open in external application