mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #988 from yemel/fix/open-external
Fix open external in new tab and fix typo
This commit is contained in:
commit
2784e19cb2
|
@ -20,13 +20,6 @@ angular.module('copayApp.controllers').controller('AddressesController',
|
||||||
var ModalInstanceCtrl = function ($scope, $modalInstance, address) {
|
var ModalInstanceCtrl = function ($scope, $modalInstance, address) {
|
||||||
$scope.address = 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 () {
|
$scope.cancel = function () {
|
||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
|
|
|
@ -198,24 +198,31 @@ angular.module('copayApp.directives')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
// From https://gist.github.com/asafge/7430497
|
.directive('openExternal', function() {
|
||||||
.directive('ngReallyClick', [
|
|
||||||
|
|
||||||
function() {
|
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
element.bind('click', function() {
|
element.bind('click', function() {
|
||||||
var message = attrs.ngReallyMessage;
|
window.open('bitcoin:'+attrs.address, '_blank');
|
||||||
if (message && confirm(message)) {
|
|
||||||
scope.$apply(attrs.ngReallyClick);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
])
|
// 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 () {
|
.directive('match', function () {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
|
@ -231,5 +238,4 @@ angular.module('copayApp.directives')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
;
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
{{address.balance || 0|noFractionNumber}} {{$root.unitName}}
|
{{address.balance || 0|noFractionNumber}} {{$root.unitName}}
|
||||||
</span>
|
</span>
|
||||||
<div style="margin-top:10px;">
|
<div style="margin-top:10px;">
|
||||||
<span class="label pointer" ng-click="openExternal(address.address)">
|
<span class="label pointer" open-external address="{{address.address}}">
|
||||||
<i class="fi-link"> </i> Open in external aplication
|
<i class="fi-link"> </i> Open in external application
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue