diff --git a/css/main.css b/css/main.css
index 6ab5b4587..b94ef5b83 100644
--- a/css/main.css
+++ b/css/main.css
@@ -248,6 +248,10 @@ button.secondary { background-color: #FAE448 !important; }
button.primary:hover { background-color: #333;}
button.secondary:hover { background-color: #FFDF00 !important;}
+[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ display: none !important;
+}
+.dn {display: none;}
.text-gray { color: #999 !important;}
.pr {position: relative;}
.m0 {margin: 0;}
diff --git a/img/loading.gif b/img/loading.gif
new file mode 100644
index 000000000..c14d37553
Binary files /dev/null and b/img/loading.gif differ
diff --git a/index.html b/index.html
index 5da820527..47dae5ca9 100644
--- a/index.html
+++ b/index.html
@@ -93,7 +93,7 @@
-
+
@@ -110,7 +110,7 @@
Create a New Wallet
-
+
@@ -125,7 +125,7 @@
+ ng-click="open(selectedWalletId)" ng-disabled="loading" loading="Opening">Open
@@ -139,7 +139,7 @@
+ ng-click="join(connectionId)" ng-disabled="loading" loading="Joining">Join
@@ -148,7 +148,7 @@
Create a New Address
-
+
@@ -316,10 +316,10 @@
Signed by you already
-
@@ -331,7 +331,7 @@
Transaction ready.
-
+
Broadcast Transaction
@@ -443,8 +443,8 @@
-
-
+
+
Send
diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js
index af3a7ee01..6b2ee0e3c 100644
--- a/js/controllers/addresses.js
+++ b/js/controllers/addresses.js
@@ -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();
};
diff --git a/js/controllers/send.js b/js/controllers/send.js
index 820a42f85..bdad886a8 100644
--- a/js/controllers/send.js
+++ b/js/controllers/send.js
@@ -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;
+
+ };
});
diff --git a/js/controllers/signin.js b/js/controllers/signin.js
index 0a0c80070..e2a8a1790 100644
--- a/js/controllers/signin.js
+++ b/js/controllers/signin.js
@@ -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');
};
diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js
index fed674948..c34221bfd 100644
--- a/js/controllers/transactions.js
+++ b/js/controllers/transactions.js
@@ -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'};
diff --git a/js/directives.js b/js/directives.js
index 991ed318f..9dd48091c 100644
--- a/js/directives.js
+++ b/js/directives.js
@@ -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('
' + text + '...' );
+ }
+ else {
+ element.html(a);
+ }
+ });
+ }
+ }
+ })
;