From 9854ca1464773299dd42949639afca08d373aca3 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 12 Feb 2015 12:14:37 -0300 Subject: [PATCH] Added link to blockchain after sent a txp --- js/controllers/homeWallet.js | 41 ++++++++++++++++++++-------- views/modals/tx-details.html | 2 +- views/modals/txp-details.html | 50 ++++++++++++++++++++--------------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/js/controllers/homeWallet.js b/js/controllers/homeWallet.js index 9f7bb5e72..ec102f953 100644 --- a/js/controllers/homeWallet.js +++ b/js/controllers/homeWallet.js @@ -5,44 +5,63 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi $scope.openTxModal = function(tx) { var ModalInstanceCtrl = function($scope, $modalInstance) { var w = $rootScope.wallet; + $scope.error = null; $scope.tx = tx; $scope.registeredCopayerIds = w.getRegisteredCopayerIds(); $scope.loading = null; + $scope.getShortNetworkName = function() { + var w = $rootScope.wallet; + return w.getNetworkName().substring(0, 4); + }; + $scope.sign = function(ntxid) { $scope.loading = true; + $scope.error = null; $timeout(function() { w.signAndSend(ntxid, function(err, id, status) { $scope.loading = false; - if (err) - $scope.error = err; - else - $modalInstance.close(status); + if (err) { + $scope.error = 'Transaction could not send. Please try again.'; + $scope.$digest(); + } + else { + $modalInstance.close(status); + } }); }, 100); }; $scope.reject = function(ntxid) { $scope.loading = true; + $scope.error = null; $timeout(function() { w.reject(ntxid, function(err, status) { $scope.loading = false; - if (err) - $scope.error = err; - else - $modalInstance.close(status); + if (err) { + $scope.error = err; + $scope.$digest(); + } + else { + $modalInstance.close(status); + } }); }, 100); }; $scope.broadcast = function(ntxid) { $scope.loading = true; + $scope.error = null; $timeout(function() { w.issueTx(ntxid, function(err, txid, status) { $scope.loading = false; - if (err) - $scope.error = err; - $modalInstance.close(status); + if (err) { + $scope.error = 'Transaction could not send. Please try again.'; + $scope.$digest(); + } + else { + $modalInstance.close(status); + } }); }, 100); }; diff --git a/views/modals/tx-details.html b/views/modals/tx-details.html index 45ae1c5ab..848f795c6 100644 --- a/views/modals/tx-details.html +++ b/views/modals/tx-details.html @@ -73,7 +73,7 @@ ID: {{btx.txid}}
- + See it on the blockchain
diff --git a/views/modals/txp-details.html b/views/modals/txp-details.html index f41396c64..3b6ccca2e 100644 --- a/views/modals/txp-details.html +++ b/views/modals/txp-details.html @@ -81,15 +81,14 @@ {{error}} - × -
-
-
-
- -
-
- Transaction sent! -
-
- Transaction finally rejected +
+
+ +
+
+ + See it on the blockchain + +
Transaction sent!
+
+
+ Transaction finally rejected +