This commit is contained in:
Matias Alejo Garcia 2014-05-15 16:39:22 -03:00
commit d8c3d08582
11 changed files with 478 additions and 31 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copay.header').controller('HeaderController',
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
function($scope, $rootScope, $location, $notification, walletFactory, controllerUtils) {
$scope.menu = [
{
'title': 'Addresses',
@ -27,6 +27,15 @@ angular.module('copay.header').controller('HeaderController',
}
});
// Initialize alert notification (not show when init wallet)
$rootScope.txAlertCount = 0;
$notification.enableHtml5Mode(); // for chrome: if support, enable it
$rootScope.$watch('txAlertCount', function(txAlertCount) {
if (txAlertCount && txAlertCount > 0) {
$notification.info('New Transaction', ($rootScope.txAlertCount == 1) ? 'You have a pending transaction proposal' : 'You have ' + $rootScope.txAlertCount + ' pending transaction proposals', txAlertCount);
}
});
$scope.isActive = function(item) {
if (item.link && item.link.replace('#','') == $location.path()) {
return true;

View file

@ -2,8 +2,13 @@
angular.module('copay.signin').controller('SigninController',
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
var cmp = function(o1, o2){
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
return v1 > v2 ? 1 : ( v1 < v2 ) ? -1 : 0;
};
$scope.loading = false;
$scope.wallets = walletFactory.getWallets();
$scope.wallets = walletFactory.getWallets().sort(cmp);
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
$scope.openPassword = '';

View file

@ -8,6 +8,7 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.send = function (ntxid) {
$scope.loading = true;
$rootScope.txAlertCount = 0;
var w = $rootScope.wallet;
w.sendTx(ntxid, function(txid) {
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
@ -65,6 +66,7 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.reject = function (ntxid) {
$scope.loading = true;
$rootScope.txAlertCount = 0;
var w = $rootScope.wallet;
w.reject(ntxid);
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};