From 02e228ffe788a6e5039bd4c7aa6bd20535f3a1bc Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Dec 2014 21:14:56 -0300 Subject: [PATCH] sign and reject more friendly user --- js/controllers/homeWallet.js | 91 +++++++++++++++++------------------ views/modals/txp-details.html | 29 +++++++++-- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/js/controllers/homeWallet.js b/js/controllers/homeWallet.js index d49cf6738..dd4e7e985 100644 --- a/js/controllers/homeWallet.js +++ b/js/controllers/homeWallet.js @@ -6,69 +6,66 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi var w = $rootScope.wallet; if (w.isShared()) $scope.copayers = w.getRegisteredPeerIds(); - }; + }; - $scope.sign = function(ntxid) { - var w = $rootScope.wallet; - $scope.loading = true; - $scope.error = $scope.success = null; - w.signAndSend(ntxid, function(err, id, status) { - $scope.loading = false; - - if (err) - $scope.error = err; - else - txStatus.notify(status); - }); - }; - - $scope.reject = function(ntxid) { - var w = $rootScope.wallet; - w.reject(ntxid, function(err, status) { - if (err) - $scope.error = err; - else - txStatus.notify(status); - }); - }; - - - $scope.broadcast = function(ntxid) { - var w = $rootScope.wallet; - $scope.error = $scope.success = null; - $scope.loading = true; - w.issueTx(ntxid, function(err, txid, status) { - $scope.loading = false; - - if (err) - $scope.error = err; - - txStatus.notify(status); - }); - }; - - - var $outScope = $scope; $scope.openTxModal = function(tx) { var ModalInstanceCtrl = function($scope, $modalInstance) { + var w = $rootScope.wallet; $scope.tx = tx; + $scope.loading = null; + $scope.sign = function(ntxid) { - $outScope.sign(ntxid); - $modalInstance.dismiss('cancel'); + $scope.loading = true; + $timeout(function() { + w.signAndSend(ntxid, function(err, id, status) { + $scope.loading = false; + if (err) + $scope.error = err; + else + $modalInstance.close(status); + }); + }, 100); }; + $scope.reject = function(ntxid) { - $outScope.reject(ntxid); - $modalInstance.dismiss('cancel'); + $scope.loading = true; + $timeout(function() { + w.reject(ntxid, function(err, status) { + $scope.loading = false; + if (err) + $scope.error = err; + else + $modalInstance.close(status); + }); + }, 100); }; + + $scope.broadcast = function(ntxid) { + $scope.loading = true; + $timeout(function() { + w.issueTx(ntxid, function(err, txid, status) { + $scope.loading = false; + if (err) + $scope.error = err; + $modalInstance.close(status); + }); + }, 100); + }; + $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; }; - $modal.open({ + var modalInstance = $modal.open({ templateUrl: 'views/modals/txp-details.html', windowClass: 'medium', controller: ModalInstanceCtrl, }); + + modalInstance.result.then(function(status) { + txStatus.notify(status); + }); + }; }); diff --git a/views/modals/txp-details.html b/views/modals/txp-details.html index e79222faf..f7be43a79 100644 --- a/views/modals/txp-details.html +++ b/views/modals/txp-details.html @@ -58,16 +58,35 @@ + -
+
+
+ +
+ + {{error}} + + × +
+ +
-
-