create view and controller refactor
This commit is contained in:
parent
b148332d9d
commit
d55e756e6a
6 changed files with 33 additions and 30 deletions
|
|
@ -19,18 +19,18 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
12: 1,
|
12: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.init = function(tc) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.formData = {};
|
$scope.formData = {};
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
|
var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers;
|
||||||
$scope.formData.account = 1;
|
$scope.formData.account = 1;
|
||||||
$scope.formData.bwsurl = defaults.bws.url;
|
$scope.formData.bwsurl = defaults.bws.url;
|
||||||
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
||||||
$scope.formData.totalCopayers = defaults.wallet.totalCopayers;
|
|
||||||
$scope.formData.derivationPath = derivationPathHelper.default;
|
$scope.formData.derivationPath = derivationPathHelper.default;
|
||||||
$scope.setTotalCopayers(tc);
|
$scope.setTotalCopayers(tc);
|
||||||
updateRCSelect(tc);
|
updateRCSelect(tc);
|
||||||
resetPasswordFields();
|
resetPasswordFields();
|
||||||
};
|
});
|
||||||
|
|
||||||
$scope.showAdvChange = function() {
|
$scope.showAdvChange = function() {
|
||||||
$scope.showAdv = !$scope.showAdv;
|
$scope.showAdv = !$scope.showAdv;
|
||||||
|
|
@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
};
|
};
|
||||||
|
|
||||||
function resetPasswordFields() {
|
function resetPasswordFields() {
|
||||||
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null;
|
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
};
|
};
|
||||||
|
|
||||||
function resetPasswordFields() {
|
function resetPasswordFields() {
|
||||||
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null;
|
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/create-personal',
|
url: '/create-personal',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
templateUrl: 'views/tab-create-personal.html'
|
templateUrl: 'views/tab-create-personal.html',
|
||||||
|
controller: 'createController'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -349,7 +350,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/create-shared',
|
url: '/create-shared',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
templateUrl: 'views/tab-create-shared.html'
|
templateUrl: 'views/tab-create-shared.html',
|
||||||
|
controller: 'createController'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content ng-init="init()">
|
<ion-content>
|
||||||
|
|
||||||
<form name="setupForm" ng-submit="join()" novalidate>
|
<form name="setupForm" ng-submit="join()" novalidate>
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<label class="item item-input item-stacked-label no-border">
|
<label class="item item-input item-stacked-label no-border">
|
||||||
<span class="input-label" translate>Your nickname</span>
|
<span class="input-label" translate>Your nickname</span>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="{{'John'|translate}}"
|
placeholder="Satoshi"
|
||||||
name="myName"
|
name="myName"
|
||||||
ng-model="formData.myName"
|
ng-model="formData.myName"
|
||||||
required>
|
required>
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
name="createPassphrase"
|
name="createPassphrase"
|
||||||
ng-model="formData.createPassphrase"
|
ng-model="formData.createPassphrase"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSourceId == 'set'"
|
<input ng-show="seedSourceId == 'set'"
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
name="passphrase"
|
name="passphrase"
|
||||||
ng-model="formData.passphrase"
|
ng-model="formData.passphrase"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -113,16 +113,16 @@
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSource.id == 'set'"
|
<input ng-show="seedSource.id == 'set'"
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="createController" ng-init="init(1);">
|
<ion-content>
|
||||||
<form name="setupForm" ng-submit="create()" novalidate>
|
<form name="setupForm" ng-submit="create()" novalidate>
|
||||||
<div class="list settings-list settings-input-group">
|
<div class="list settings-list settings-input-group">
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
ng-model="formData.walletName"
|
ng-model="formData.walletName"
|
||||||
ng-required="true"
|
ng-required="true"
|
||||||
ng-focus="formFocus('wallet-name')"
|
ng-focus="formFocus('wallet-name')"
|
||||||
ng-blur="formFocus(false)">
|
ng-blur="formFocus(false)"
|
||||||
|
required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="item item-divider"></div>
|
<div class="item item-divider"></div>
|
||||||
|
|
@ -67,7 +68,7 @@
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.createPassphrase"
|
ng-model="formData.createPassphrase"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSource.id == 'set'"
|
<input ng-show="seedSource.id == 'set'"
|
||||||
|
|
@ -75,7 +76,7 @@
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.passphrase"
|
ng-model="formData.passphrase"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
<div class="item item-input" ng-show="encrypt">
|
<div class="item item-input" ng-show="encrypt">
|
||||||
|
|
@ -83,16 +84,16 @@
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSource.id == 'set'"
|
<input ng-show="seedSource.id == 'set'"
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="createController" ng-init="init(3);">
|
<ion-content>
|
||||||
<form name="setupForm" ng-submit="create()" novalidate>
|
<form name="setupForm" ng-submit="create()" novalidate>
|
||||||
<div class="list settings-list settings-input-group">
|
<div class="list settings-list settings-input-group">
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.createPassphrase"
|
ng-model="formData.createPassphrase"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSource.id == 'set'"
|
<input ng-show="seedSource.id == 'set'"
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.passphrase"
|
ng-model="formData.passphrase"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
<div class="item item-input" ng-show="encrypt">
|
<div class="item item-input" ng-show="encrypt">
|
||||||
|
|
@ -113,16 +113,16 @@
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
|
|
||||||
<input ng-show="seedSource.id == 'set'"
|
<input ng-show="seedSource.id == 'set'"
|
||||||
placeholder="{{'Repeat password'|translate}}"
|
placeholder="{{'Repeat password'|translate}}"
|
||||||
type="password"
|
type="password"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
ng-model="formData.repeatpassword"
|
ng-model="formData.repeatPassword"
|
||||||
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
|
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
|
||||||
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue