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'))
msg = 'Not enough funds'
if (msg.match('unspent not set'))
msg = 'Not enough funds'
var message = 'The transaction' + (w.isShared() ? ' proposal' : '') +
' could not be created: ' + msg;
@ -310,15 +314,19 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.notifyStatus = function(status) {
if (status == copay.Wallet.TX_BROADCASTED)
notification.success('Success', 'Transaction broadcasted!');
$scope.success = 'Transaction broadcasted!';
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)
notification.success('Success', 'Transaction proposal was signed');
$scope.success = 'Transaction proposal was signed';
else if (status == copay.Wallet.TX_SIGNED_AND_BROADCASTED)
notification.success('Success', 'Transaction signed and broadcasted!');
$scope.success = 'Transaction signed and broadcasted!';
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;
$rootScope.txAlertCount = 0;
w.issueTx(ntxid, function(err, txid, status) {
$scope.loading = false;
$scope.notifyStatus(status);
if (cb) return cb();
});

View file

@ -10,16 +10,24 @@
<div class="large-12 columns">
<form name="sendForm" ng-submit="submitForm(sendForm)" novalidate>
<div class="panel">
<p class="text-warning size-16"
ng-show="error">
<i class="fi-alert"></i>
{{error|translate}}
</p>
<p class="text-success size-16"
ng-show="success">
<i class="fi-check"></i>
{{success|translate}}
</p>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
</div>
<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">
<label for="address" class="left">
@ -180,6 +188,7 @@
</div>
<div class="large-6 medium-6 small-6 columns text-right">
<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
</button>
</div>