add wallet setup view (not integrated)

This commit is contained in:
Manuel Araoz 2014-04-16 17:07:14 -03:00
commit 8478402237
5 changed files with 75 additions and 0 deletions

View file

@ -11,6 +11,7 @@ angular.module('copay',[
'copay.backup',
'copay.walletFactory',
'copay.signin',
'copay.setup',
'copay.peer'
]);
@ -21,5 +22,6 @@ angular.module('copay.send', []);
angular.module('copay.backup', []);
angular.module('copay.walletFactory', []);
angular.module('copay.signin', []);
angular.module('copay.setup', []);
angular.module('copay.peer', []);

View file

@ -7,6 +7,10 @@ var config = {
maxPeers: 3,
debug: 3,
},
limits: {
totalCopayers: 10,
mPlusN: 15
},
wallet: {
requiredCopayers: 2,
totalCopayers: 3,

34
js/controllers/setup.js Normal file
View file

@ -0,0 +1,34 @@
'use strict';
angular.module('copay.setup').controller('SetupController',
function($scope, $rootScope, $location, Network) {
$scope.loading = false;
$scope.selectedWalletId = false;
$scope.totalCopayers = config.wallet.totalCopayers;
$scope.TCValues = [];
for (var n = 1; n <= config.limits.totalCopayers; n++)
$scope.TCValues.push(n);
var updateRCSelect = function(n) {
$scope.requiredCopayers = parseInt(Math.min(n / 2 + 1, config.limits.mPlusN-n));
$scope.RCValues = [];
for (var m = 1; m <= n; m++) {
if (n + m <= config.limits.mPlusN) {
$scope.RCValues.push(m);
}
}
};
updateRCSelect($scope.totalCopayers);
$scope.$watch('totalCopayers', function(tc) {
updateRCSelect(tc);
})
$scope.create = function(totalCopayers, requiredCopayers) {
alert(totalCopayers);
alert(requiredCopayers);
};
});

View file

@ -12,6 +12,9 @@ angular
.when('/signin', {
templateUrl: 'signin.html'
})
.when('/setup', {
templateUrl: 'setup.html'
})
.when('/home', {
templateUrl: 'home.html'
})