Merge pull request #1997 from matiu/bug/send-notifications

fix notifications
This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-05 18:11:03 -03:00
commit e485ac18f0
2 changed files with 33 additions and 15 deletions

View file

@ -115,6 +115,10 @@ angular.module('copayApp.controllers').controller('SendController',
if (msg.match('totalNeededAmount')) if (msg.match('totalNeededAmount'))
msg = 'Not enough funds' msg = 'Not enough funds'
if (msg.match('unspent not set'))
msg = 'Not enough funds'
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') + var message = 'The transaction' + (w.isShared() ? ' proposal' : '') +
' could not be created: ' + msg; ' could not be created: ' + msg;
@ -310,15 +314,19 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.notifyStatus = function(status) { $scope.notifyStatus = function(status) {
if (status == copay.Wallet.TX_BROADCASTED) if (status == copay.Wallet.TX_BROADCASTED)
notification.success('Success', 'Transaction broadcasted!'); $scope.success = 'Transaction broadcasted!';
else if (status == copay.Wallet.TX_PROPOSAL_SENT) else if (status == copay.Wallet.TX_PROPOSAL_SENT)
notification.success('Success', 'Transaction proposal created'); $scope.success = 'Transaction proposal created';
else if (status == copay.Wallet.TX_SIGNED) else if (status == copay.Wallet.TX_SIGNED)
notification.success('Success', 'Transaction proposal was signed'); $scope.success = 'Transaction proposal was signed';
else if (status == copay.Wallet.TX_SIGNED_AND_BROADCASTED) else if (status == copay.Wallet.TX_SIGNED_AND_BROADCASTED)
notification.success('Success', 'Transaction signed and broadcasted!'); $scope.success = 'Transaction signed and broadcasted!';
else else
notification.error('Error', 'Unknown error occured'); $scope.error = 'Unknown error occured';
$timeout(function() {
$scope.$digest();
});
}; };
@ -327,6 +335,7 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.loading = true; $scope.loading = true;
$rootScope.txAlertCount = 0; $rootScope.txAlertCount = 0;
w.issueTx(ntxid, function(err, txid, status) { w.issueTx(ntxid, function(err, txid, status) {
$scope.loading = false;
$scope.notifyStatus(status); $scope.notifyStatus(status);
if (cb) return cb(); if (cb) return cb();
}); });

View file

@ -10,16 +10,24 @@
<div class="large-12 columns"> <div class="large-12 columns">
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate> <form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
<div class="panel"> <div class="panel">
<p class="text-warning size-16"
ng-show="error"> <div class="box-notification" ng-show="error">
<i class="fi-alert"></i> <div class="box-icon error">
{{error|translate}} <i class="fi-x size-24"></i>
</p> </div>
<p class="text-success size-16" <span class="text-warning size-14">
ng-show="success"> {{error|translate}}
<i class="fi-check"></i> </span>
{{success|translate}} </div>
</p>
<div class="box-notification" ng-show="success">
<div class="box-icon success">
<i class="fi-check size-24"></i>
</div>
<span class="text-success size-14">
{{success|translate}}
</span>
</div>
<div class="row collapse"> <div class="row collapse">
<label for="address" class="left"> <label for="address" class="left">
@ -180,6 +188,7 @@
</div> </div>
<div class="large-6 medium-6 small-6 columns text-right"> <div class="large-6 medium-6 small-6 columns text-right">
<button type="submit" class="button primary m0" ng-disabled="sendForm.$invalid || loading"> <button type="submit" class="button primary m0" ng-disabled="sendForm.$invalid || loading">
<i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i>
Send Send
</button> </button>
</div> </div>