Merge pull request #2640 from matiu/feat/modal2

Feat/modal2
This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-27 10:12:45 -03:00
commit 6bd35493de
9 changed files with 67 additions and 64 deletions

View file

@ -14,7 +14,7 @@
</div>
<form name="setupForm" ng-submit="create.create(setupForm)" ng-show="!create.loading" novalidate>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<div class="row">
<div class="large-12 columns">
<div class="box-notification" ng-show="create.error">

View file

@ -19,7 +19,7 @@
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis" ng-style="{'color':index.backgroundColor}">
<h1 class="title ellipsis" ng-style="{'color': noColor ? '#4B6178' : index.backgroundColor}">
{{(titleSection|translate) || index.walletName}}
</h1>
</section>

View file

@ -12,7 +12,7 @@
</div>
</div>
<div class="row" ng-show="!join.loading">
<div class="row">
<div class="large-12 columns">
<div class="box-notification" ng-show="join.error ">

View file

@ -39,7 +39,7 @@
</div>
</div>
<div class="onGoingProcess" ng-show="home.onGoingProcess && !index.anyOnGoingProcess">
<div class="onGoingProcess" ng-show="home.onGoingProcess && !index.anyOnGoingProces && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
@ -189,32 +189,29 @@
<!-- Address-->
<div class="large-12 columns">
<h2 class="text-center m10t" translate>My Bitcoin address</h2>
<div ng-show="!home.generatingAddress">
<div >
<div class="text-center" ng-click="home.copyAddress(home.addr)">
<qrcode size="220" data="bitcoin:{{home.addr}}"></qrcode>
<div class="m10t">
<h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">{{home.addr}}</h4>
</div>
</div>
</div>
<div ng-show="home.generatingAddress">
<div class="text-center" style="margin-bottom:14px;">
<div style="height:220px; width:220px; margin:auto; background: url(img/qr.png) white">
<div class="spinner" style="margin-top:80px">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
<div ng-show="home.generatingAddress" style="position:relative; top:-226px; height:0px">
<div style="height:220px; width:220px; margin:auto; background: url(img/qr.png) white">
<div class="spinner" style="margin-top:80px">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
</div>
<div class="m10t">
<h4 class="size-12">...</h4>
<div class="m10t" >
<h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">
{{home.generatingAddress ? '...' : home.addr}}
</h4>
</div>
</div>
</div>
<div class="m10t text-center" ng-show="index.isCordova">
<span class="button outline dark-gray tiny"
ng-click="home.shareAddress(home.addr)">
@ -265,7 +262,7 @@
</div>
<div class="row m20t">
<div class="large-12 large-centered columns">
<form ng-show="!home.onGoingProcess" name="sendForm" ng-submit="home.submitForm()" ng-disabled="home.blockUx" novalidate>
<form name="sendForm" ng-submit="home.submitForm()" ng-disabled="home.blockUx || home.onGoingProcess" novalidate>
<div class="box-notification" ng-show="home.error" ng-click="home.resetError()">
<span class="text-warning">
{{home.error|translate}}

View file

@ -649,7 +649,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateAll();
$timeout(function() {
self.updateTxHistory();
}, 5000);
}, 3000);
});
});

View file

@ -145,14 +145,15 @@ angular.module('copayApp.controllers').controller('joinController',
extendedPrivateKey: form.privateKey.$modelValue,
myName: form.myName.$modelValue
}, function(err) {
self.loading = false;
if (err) {
self.loading = false;
self.error = 'Could not join wallet: ' + (err.message ? err.message : err);
$rootScope.$apply();
return
}
else {
$timeout(function() {
go.walletHome();
}
}, 2000);
});
}, 100);
}

View file

@ -486,17 +486,18 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
message: comment,
payProUrl: paypro ? paypro.url : null,
}, function(err, txp) {
self.setOngoingProcess();
if (err) {
self.setOngoingProcess();
profileService.lockFC();
return self.setError(err);
}
self.signAndBroadcast(txp, function(err) {
profileService.lockFC();
if (err) {
self.setOngoingProcess();
return self.setError(err);
}
self.resetForm();
});
});
@ -509,43 +510,37 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess('Signing transaction');
fc.signTxProposal(txp, function(err, signedTx) {
profileService.lockFC();
self.setOngoingProcess();
if (err) {
self.setOngoingProcess();
return cb(err);
}
if (signedTx.status == 'accepted') {
self.setOngoingProcess('Broadcasting transaction');
fc.broadcastTxProposal(signedTx, function(err, btx) {
self.setOngoingProcess();
if (err) {
self.setOngoingProcess();
$scope.error = 'Transaction not broadcasted. Please try again.';
$scope.$digest();
} else {
txStatus.notify(btx);
$scope.$emit('Local/TxProposalAction');
return;
}
return cb();
$scope.$emit('Local/TxProposalAction');
txStatus.notify(btx, function() {
self.setOngoingProcess();
return cb();
});
});
} else {
txStatus.notify(signedTx);
$scope.$emit('Local/TxProposalAction');
return cb();
txStatus.notify(signedTx, function() {
self.setOngoingProcess();
return cb();
});
}
});
};
this.setTopAmount = function() {
throw new Error('todo: setTopAmount');
var form = $scope.sendForm;
if (form) {
form.amount.$setViewValue(w.balanceInfo.topAmount);
form.amount.$render();
form.amount.$isValid = true;
}
};
this.setForm = function(to, amount, comment) {
var form = $scope.sendForm;
if (to) {

View file

@ -30,11 +30,15 @@ angular
var orig = $delegate[level];
$delegate[level] = function() {
var args = [].slice.call(arguments);
if (!Array.isArray(args)) args = [args];
args = args.map(function(v) {
try {
if (typeof v == 'undefined') v = 'undefined';
if (typeof v == 'object') {
v = JSON.stringify(v);
if (v.message)
v = v.message;
else
v = JSON.stringify(v);
}
v = v.toString();
if (v.length > 200)
@ -48,7 +52,7 @@ angular
try {
if (window.cordova)
console.log(args.join(' '));
orig.apply(null, args)
orig.apply(null, args);
historicLog.add(level, args.join(' '));
} catch (e) {
console.log('Error at log decorator:', e);
@ -96,6 +100,7 @@ angular
templateUrl: 'views/createProfile.html',
controller: function($scope) {
$scope.mainDark = true;
$scope.noColor = true;
}
}
}
@ -120,6 +125,7 @@ angular
templateUrl: 'views/includes/topbar.html',
controller: function($scope) {
$scope.goBackToState = 'walletHome';
$scope.noColor = true;
}
}
},
@ -142,6 +148,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Join shared wallet';
$scope.goBackToState = 'add';
$scope.noColor = true;
}
}
}
@ -158,6 +165,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Import wallet';
$scope.goBackToState = 'add';
$scope.noColor = true;
}
}
}
@ -179,6 +187,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Import legacy wallet';
$scope.goBackToState = 'add';
$scope.noColor = true;
}
}
}
@ -197,6 +206,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Create new wallet';
$scope.goBackToState = 'add';
$scope.noColor = true;
}
}
}
@ -213,12 +223,6 @@ angular
}
}
})
.state('profile', {
url: '/profile',
controller: 'profileController',
templateUrl: 'views/profile.html',
needProfile: true
})
.state('preferences', {
url: '/preferences',
templateUrl: 'views/preferences.html',
@ -250,6 +254,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Language';
$scope.goBackToState = 'preferences';
$scope.noColor = true;
}
}
}
@ -268,6 +273,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Unit';
$scope.goBackToState = 'preferences';
$scope.noColor = true;
}
}
}
@ -305,6 +311,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Alternative Currency';
$scope.goBackToState = 'preferences';
$scope.noColor = true;
}
}
}
@ -323,6 +330,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Bitcore Wallet Service';
$scope.goBackToState = 'preferences';
$scope.noColor = true;
}
}
}
@ -359,6 +367,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'About';
$scope.goBackToState = 'preferences';
$scope.noColor = true;
}
}
}
@ -377,6 +386,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Logs';
$scope.goBackToState = 'about';
$scope.noColor = true;
}
}
}
@ -424,6 +434,7 @@ angular
controller: function($scope) {
$scope.titleSection = 'Add wallet';
$scope.closeToHome = true;
$scope.noColor = true;
}
}
}

View file

@ -1,18 +1,17 @@
'use strict';
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService) {
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout) {
var root = {};
root.notify = function(txp) {
root.notify = function(txp, cb) {
var fc = profileService.focusedClient;
var msg;
var status = txp.status;
if (status == 'broadcasted') {
msg = 'Transaction broadcasted';
}
else {
} else {
var action = lodash.find(txp.actions, {
copayerId: fc.credentials.copayerId
});
@ -25,16 +24,16 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
}
}
if (msg)
root.openModal(msg);
root.openModal(msg, cb);
};
root.openModal = function(statusStr) {
root.openModal = function(statusStr, cb) {
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.statusStr = statusStr;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
if (cb) $timeout(cb, 100);
};
$modal.open({
templateUrl: 'views/modals/tx-status.html',