Merge pull request #186 from cmgustavo/feature/01-spinners-buttons
Feature/01 spinners buttons
This commit is contained in:
commit
660285f924
9 changed files with 54 additions and 20 deletions
|
|
@ -16,12 +16,14 @@ angular.module('copay.addresses').controller('AddressesController',
|
|||
$scope.isMain = isMain;
|
||||
$scope.addrs = Object.keys(balanceByAddr);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.newAddr = function() {
|
||||
$scope.loading = true;
|
||||
w.generateAddress();
|
||||
_updateBalance();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
angular.module('copay.send').controller('SendController',
|
||||
function($scope, $rootScope, $location) {
|
||||
$scope.title = 'Send';
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.unitIds = ['BTC','mBTC'];
|
||||
$scope.selectedUnit = $scope.unitIds[0];
|
||||
|
|
@ -13,20 +14,24 @@ angular.module('copay.send').controller('SendController',
|
|||
return;
|
||||
}
|
||||
|
||||
$scope.loading = true;
|
||||
|
||||
var address = form.address.$modelValue;
|
||||
var amount = (form.amount.$modelValue * 100000000).toString(); // satoshi to string
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
w.createTx( address, amount,function() {
|
||||
|
||||
// reset fields
|
||||
$scope.address = null;
|
||||
$scope.amount = null;
|
||||
form.address.$pristine = true;
|
||||
form.amount.$pristine = true;
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// reset fields
|
||||
$scope.address = null;
|
||||
$scope.amount = null;
|
||||
form.address.$pristine = true;
|
||||
form.amount.$pristine = true;
|
||||
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ angular.module('copay.signin').controller('SigninController',
|
|||
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
|
||||
|
||||
$scope.create = function() {
|
||||
$scope.loading = true;
|
||||
$location.path('setup');
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
var bitcore = require('bitcore');
|
||||
|
||||
$scope.title = 'Transactions';
|
||||
$scope.loading = false;
|
||||
var _updateTxs = function() {
|
||||
var w =$rootScope.wallet;
|
||||
if (!w) return;
|
||||
|
|
@ -34,9 +35,11 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
$scope.txs = txs;
|
||||
w.removeListener('txProposalsUpdated',_updateTxs)
|
||||
w.once('txProposalsUpdated',_updateTxs);
|
||||
$scope.loading = false;
|
||||
};
|
||||
|
||||
$scope.send = function (ntxid) {
|
||||
$scope.loading = true;
|
||||
var w = $rootScope.wallet;
|
||||
w.sendTx(ntxid, function(txid) {
|
||||
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
|
||||
|
|
@ -50,6 +53,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
};
|
||||
|
||||
$scope.sign = function (ntxid) {
|
||||
$scope.loading = true;
|
||||
var w = $rootScope.wallet;
|
||||
var ret = w.sign(ntxid);
|
||||
|
||||
|
|
@ -84,6 +88,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
};
|
||||
|
||||
$scope.reject = function (ntxid) {
|
||||
$scope.loading = true;
|
||||
var w = $rootScope.wallet;
|
||||
w.reject(ntxid);
|
||||
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};
|
||||
|
|
|
|||
|
|
@ -58,5 +58,22 @@ angular.module('copay.directives')
|
|||
}
|
||||
};
|
||||
}])
|
||||
.directive('loading', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attr) {
|
||||
var a = element.html();
|
||||
var text = attr.loading;
|
||||
scope.$watch('loading', function (val) {
|
||||
if (val) {
|
||||
element.html('<img src="img/loading.gif"> ' + text + '...' );
|
||||
}
|
||||
else {
|
||||
element.html(a);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -214,12 +214,12 @@ PublicKeyRing.prototype.getAddresses = function(onlyMain) {
|
|||
var ret = [];
|
||||
|
||||
for (var i=0; i<this.addressIndex; i++) {
|
||||
ret.push(this.getAddress(i,false));
|
||||
ret.unshift(this.getAddress(i,false));
|
||||
}
|
||||
|
||||
if (!onlyMain) {
|
||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||
ret.push(this.getAddress(i,true));
|
||||
ret.unshift(this.getAddress(i,true));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue