Fix open external in new tab and fix typo

This commit is contained in:
Yemel Jardi 2014-07-31 14:06:55 -03:00
parent 010c13fa4f
commit e5fd3c38f4
3 changed files with 21 additions and 22 deletions

View File

@ -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');
};

View File

@ -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')
});
}
};
})
;
});

View File

@ -9,8 +9,8 @@
{{address.balance || 0|noFractionNumber}} {{$root.unitName}}
</span>
<div style="margin-top:10px;">
<span class="label pointer" ng-click="openExternal(address.address)">
<i class="fi-link">&nbsp;</i> Open in external aplication
<span class="label pointer" open-external address="{{address.address}}">
<i class="fi-link">&nbsp;</i> Open in external application
</span>
</div>
</div>