separate views

This commit is contained in:
Javier 2016-09-05 14:34:32 -03:00
commit 25990e23fe
6 changed files with 306 additions and 348 deletions

View file

@ -10,7 +10,7 @@
<ion-content> <ion-content>
<ion-list> <ion-list>
<a class="item item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="tabs.create.personal"> <a class="item item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="tabs.create">
<h2 translate>Create new wallet</h2> <h2 translate>Create new wallet</h2>
<i class="icon ion-ios-arrow-right nav-item-arrow-right"></i> <i class="icon ion-ios-arrow-right nav-item-arrow-right"></i>
</a> </a>

View file

@ -1,13 +1,22 @@
<ion-view > <ion-view>
<ion-tabs class="tabs-striped tabs-color-positive tabs-color-active-positive tabs-top"> <ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Create new wallet' | translate}}</ion-nav-title>
<ion-nav-back-button>
<i class="icon ion-ios-arrow-thin-left"></i>
</ion-nav-back-button>
</ion-nav-bar>
<ion-tab title="Personal Wallet" ui-sref="tabs.create.personal"> <ion-content ng-controller="createController" ng-init="personal = true">
<ion-nav-view name="tab-create-personal"></ion-nav-view> <div class="row text-center">
</ion-tab> <div class="col" ng-click="personal = true" ng-style="personal && {'border-bottom': '2px solid'}">
<span class="" translate>Personal Wallet</span>
</div>
<div class="col" ng-click="personal = false" ng-style="!personal && {'border-bottom': '2px solid'}">
<span class="" translate>Shared Wallet</span>
</div>
</div>
<ion-tab title="Shared Wallet" ui-sref="tabs.create.shared"> <div ng-include="'views/tab-create-personal.html'" ng-if="personal"></div>
<ion-nav-view name="tab-create-shared"></ion-nav-view> <div ng-include="'views/tab-create-shared.html'" ng-if="!personal"></div>
</ion-tab> </ion-content>
</ion-tabs>
</ion-view> </ion-view>

View file

@ -1,125 +1,109 @@
<ion-view> <form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<ion-nav-bar class="bar-royal">
<ion-nav-buttons side="primary">
<button class="button back-button" ui-sref="tabs.add">
<i class="icon ion-ios-arrow-thin-left"></i>
</button>
</ion-nav-buttons>
<ion-nav-title>{{'Create new wallet' | translate}}</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="createController as create" ng-init="create.setTotalCopayers(1)"> <div class="card list">
<label class="item item-input item-stacked-label">
<span class="input-label" translate>Wallet name</span>
<input type="text"
placeholder="{{'Family vacation funds'|translate}}"
ng-model="walletName"
ng-required="true"
ng-focus="create.formFocus('wallet-name')"
ng-blur="create.formFocus(false)">
</label>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate> <ion-toggle ng-model="showAdv" toggle-class="toggle-stable" ng-change="showAdvChange()">
<span translate ng-show="!showAdv">Show advanced options</span>
<span translate ng-show="showAdv">Hide advanced options</span>
</ion-toggle>
<div class="card list"> <div ng-show="showAdv">
<label ng-hide="create.hideWalletName" class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" translate>Wallet name</span> <span class="input-label">Wallet Service URL</span>
<input type="text" <input type="text" ng-model="bwsurl" placeholder="https://bws.bitpay.com/bws/api">
placeholder="{{'Family vacation funds'|translate}}" </label>
name="walletName"
ng-model="walletName"
ng-required="true"
ng-focus="create.formFocus('wallet-name')"
ng-blur="create.formFocus(false)">
</label>
<ion-toggle ng-model="showAdv" toggle-class="toggle-stable" ng-change="showAdvChange()"> <label class="item item-input item-select">
<span translate ng-show="!showAdv">Show advanced options</span> <div class="input-label" translate>
<span translate ng-show="showAdv">Hide advanced options</span> Wallet Key
</ion-toggle> </div>
<select class="m10t"
ng-model="seedSource"
ng-options="seed as seed.label for seed in create.seedOptions"
ng-change="create.setSeedSource()">
</select>
</label>
<div ng-show="showAdv"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
<span class="input-label" translate>Account Number</span>
<input type="number" id="account" ng-model="account" ignore-mouse-wheel>
</label>
<label class="item item-input item-stacked-label"> <div class="card" ng-show="create.seedSourceId=='new' && createPassphrase">
<span class="input-label">Wallet Service URL</span> <div class="item item-text-wrap" translate>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl"> WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
</label> </div>
</div>
<label class="item item-input item-select"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
<div class="input-label" translate> <span class="input-label" translate>Add a Password</span>
Wallet Key <input type="text"
</div> placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
<select class="m10t" autocapitalize="off"
ng-model="seedSource" name="createPassphrase"
ng-options="seed as seed.label for seed in create.seedOptions" ng-model="createPassphrase">
ng-change="create.setSeedSource()"> </label>
</select>
</label>
<label class="item item-input item-stacked-label"
ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
<span class="input-label" translate>Account Number</span>
<input type="number" id="account" ng-model="account" ignore-mouse-wheel>
</label>
<div class="card" ng-show="create.seedSourceId=='new' && createPassphrase">
<div class="item item-text-wrap" translate>
WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
</div>
</div>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
<span class="input-label" translate>Add a Password</span>
<input type="text"
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
autocapitalize="off"
name="createPassphrase"
ng-model="createPassphrase">
</label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
<span class="input-label" translate>Wallet Recovery Phrase</span> <span class="input-label" translate>Wallet Recovery Phrase</span>
<input id="ext-master" <input id="ext-master"
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}" placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
autocapitalize="off" autocapitalize="off"
type="text" type="text"
name="privateKey" name="privateKey"
ng-model="privateKey"> ng-model="privateKey">
</label> </label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
<span class="input-label" translate>Password</span> <span class="input-label" translate>Password</span>
<input type="text" <input type="text"
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}" placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
autocapitalize="off" autocapitalize="off"
name="passphrase" name="passphrase"
ng-model="passphrase"> ng-model="passphrase">
</label> </label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'">
<span class="input-label" translate>Derivation Path</span> <span class="input-label" translate>Derivation Path</span>
<input type="text" <input type="text"
placeholder="{{'BIP32 path for address derivation'|translate}}" placeholder="{{'BIP32 path for address derivation'|translate}}"
name="derivationPath" name="derivationPath"
ng-model="derivationPath"> ng-model="derivationPath">
</label> </label>
<ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive"> <!-- <ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive"> -->
Testnet <ion-toggle ng-model="testnetEnabled" toggle-class="toggle-positive">
</ion-toggle> Testnet
</ion-toggle>
<ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive"> <ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive">
<span translate>Single Address Wallet</span> <span translate>Single Address Wallet</span>
<small translate>For audit purposes</small> <small translate>For audit purposes</small>
</ion-toggle> </ion-toggle>
</div> <!-- advanced --> </div> <!-- advanced -->
</div> <!-- list --> </div> <!-- list -->
<button type="submit" <button type="submit"
class="button button-block button-positive" class="button button-block button-positive"
ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid"> ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span> <span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
</button> </button>
<button type="submit" <button type="submit"
class="button button-block button-positive" class="button button-block button-positive"
ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid"> ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
<span translate>Create new wallet</span> <span translate>Create new wallet</span>
</button> </button>
</form> </form>
</ion-content>
</ion-view>

View file

@ -1,159 +1,145 @@
<ion-view> <form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<ion-nav-bar class="bar-royal">
<ion-nav-buttons side="primary">
<button class="button back-button" ui-sref="tabs.add">
<i class="icon ion-ios-arrow-thin-left"></i>
</button>
</ion-nav-buttons>
<ion-nav-title>{{'Create new wallet' | translate}}</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="createController as create" ng-init="create.setTotalCopayers(3)"> <div class="card list">
<label ng-hide="create.hideWalletName" class="item item-input item-stacked-label">
<span class="input-label" translate>Wallet name</span>
<input type="text"
placeholder="{{'Family vacation funds'|translate}}"
name="walletName"
ng-model="walletName"
ng-required="true"
ng-focus="create.formFocus('wallet-name')"
ng-blur="create.formFocus(false)">
</label>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate> <label ng-show="totalCopayers != 1" class="item item-input item-stacked-label">
<span class="input-label" translate>Your nickname</span>
<input type="text"
placeholder="{{'John'|translate}}"
name="myName"
ng-model="myName"
ng-required="totalCopayers != 1"
ng-disabled="totalCopayers == 1"
ng-focus="create.formFocus('my-name')"
ng-blur="create.formFocus(false)">
</label>
<div class="card list"> <label ng-show="totalCopayers != 1" class="item item-input item-select">
<label ng-hide="create.hideWalletName" class="item item-input item-stacked-label"> <div class="input-label" translate>
<span class="input-label" translate>Wallet name</span> Total number of copayers
<input type="text" </div>
placeholder="{{'Family vacation funds'|translate}}" <select class="m10t"
name="walletName" ng-model="totalCopayers"
ng-model="walletName" ng-options="totalCopayers as totalCopayers for totalCopayers in create.TCValues"
ng-required="true" ng-change="create.setTotalCopayers(totalCopayers)">
ng-focus="create.formFocus('wallet-name')" </select>
ng-blur="create.formFocus(false)"> </label>
</label>
<label ng-show="totalCopayers != 1" class="item item-input item-stacked-label"> <label ng-show="totalCopayers != 1" class="item item-input item-select">
<span class="input-label" translate>Your nickname</span> <div class="input-label" translate>
<input type="text" Required number of signatures
placeholder="{{'John'|translate}}" </div>
name="myName" <select class="m10t"
ng-model="myName" ng-model="requiredCopayers"
ng-required="totalCopayers != 1" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in create.RCValues"
ng-disabled="totalCopayers == 1" ng-disabled="totalCopayers == 1">
ng-focus="create.formFocus('my-name')" </select>
ng-blur="create.formFocus(false)"> </label>
</label>
<label ng-show="totalCopayers != 1" class="item item-input item-select"> <ion-toggle ng-model="showAdv" toggle-class="toggle-stable" ng-change="showAdvChange()">
<div class="input-label" translate> <span translate ng-show="!showAdv">Show advanced options</span>
Total number of copayers <span translate ng-show="showAdv">Hide advanced options</span>
</div> </ion-toggle>
<select class="m10t"
ng-model="totalCopayers"
ng-options="totalCopayers as totalCopayers for totalCopayers in create.TCValues"
ng-change="create.setTotalCopayers(totalCopayers)">
</select>
</label>
<label ng-show="totalCopayers != 1" class="item item-input item-select"> <div ng-show="showAdv">
<div class="input-label" translate>
Required number of signatures
</div>
<select class="m10t"
ng-model="requiredCopayers"
ng-options="requiredCopayers as requiredCopayers for requiredCopayers in create.RCValues"
ng-disabled="totalCopayers == 1">
</select>
</label>
<ion-toggle ng-model="showAdv" toggle-class="toggle-stable" ng-change="showAdvChange()"> <label class="item item-input item-stacked-label">
<span translate ng-show="!showAdv">Show advanced options</span> <span class="input-label">Wallet Service URL</span>
<span translate ng-show="showAdv">Hide advanced options</span> <input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</ion-toggle> </label>
<div ng-show="showAdv"> <label class="item item-input item-select">
<div class="input-label" translate>
Wallet Key
</div>
<select class="m10t"
ng-model="seedSource"
ng-options="seed as seed.label for seed in create.seedOptions"
ng-change="create.setSeedSource()">
</select>
</label>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label"
<span class="input-label">Wallet Service URL</span> ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl"> <span class="input-label" translate>Account Number</span>
</label> <input type="number" id="account" ng-model="account" ignore-mouse-wheel>
</label>
<label class="item item-input item-select"> <div class="card" ng-show="create.seedSourceId=='new' && createPassphrase">
<div class="input-label" translate> <div class="item item-text-wrap" translate>
Wallet Key WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
</div> </div>
<select class="m10t" </div>
ng-model="seedSource"
ng-options="seed as seed.label for seed in create.seedOptions"
ng-change="create.setSeedSource()">
</select>
</label>
<label class="item item-input item-stacked-label" <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'"> <span class="input-label" translate>Add a Password</span>
<span class="input-label" translate>Account Number</span> <input type="text"
<input type="number" id="account" ng-model="account" ignore-mouse-wheel> placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
</label> autocapitalize="off"
name="createPassphrase"
<div class="card" ng-show="create.seedSourceId=='new' && createPassphrase"> ng-model="createPassphrase">
<div class="item item-text-wrap" translate> </label>
WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
</div>
</div>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
<span class="input-label" translate>Add a Password</span>
<input type="text"
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
autocapitalize="off"
name="createPassphrase"
ng-model="createPassphrase">
</label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
<span class="input-label" translate>Wallet Recovery Phrase</span> <span class="input-label" translate>Wallet Recovery Phrase</span>
<input id="ext-master" <input id="ext-master"
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}" placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
autocapitalize="off" autocapitalize="off"
type="text" type="text"
name="privateKey" name="privateKey"
ng-model="privateKey"> ng-model="privateKey">
</label> </label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
<span class="input-label" translate>Password</span> <span class="input-label" translate>Password</span>
<input type="text" <input type="text"
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}" placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
autocapitalize="off" autocapitalize="off"
name="passphrase" name="passphrase"
ng-model="passphrase"> ng-model="passphrase">
</label> </label>
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'"> <label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'">
<span class="input-label" translate>Derivation Path</span> <span class="input-label" translate>Derivation Path</span>
<input type="text" <input type="text"
placeholder="{{'BIP32 path for address derivation'|translate}}" placeholder="{{'BIP32 path for address derivation'|translate}}"
name="derivationPath" name="derivationPath"
ng-model="derivationPath"> ng-model="derivationPath">
</label> </label>
<ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive"> <ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive">
Testnet Testnet
</ion-toggle> </ion-toggle>
<ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive"> <ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive">
<span translate>Single Address Wallet</span> <span translate>Single Address Wallet</span>
<small translate>For audit purposes</small> <small translate>For audit purposes</small>
</ion-toggle> </ion-toggle>
</div> <!-- advanced --> </div> <!-- advanced -->
</div> <!-- list --> </div> <!-- list -->
<button type="submit" <button type="submit"
class="button button-block button-positive" class="button button-block button-positive"
ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid"> ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span> <span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
</button> </button>
<button type="submit" <button type="submit"
class="button button-block button-positive" class="button button-block button-positive"
ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid"> ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
<span translate>Create new wallet</span> <span translate>Create new wallet</span>
</button> </button>
</form> </form>
</ion-content>
</ion-view>

View file

@ -190,27 +190,6 @@ angular.module('copayApp.controllers').controller('createController',
}, 100); }, 100);
} }
this.formFocus = function(what) {
if (!this.isWindowsPhoneApp) return
if (what && what == 'my-name') {
this.hideWalletName = true;
this.hideTabs = true;
} else if (what && what == 'wallet-name') {
this.hideTabs = true;
} else {
this.hideWalletName = false;
this.hideTabs = false;
}
$timeout(function() {
$rootScope.$digest();
}, 1);
};
$scope.$on("$destroy", function() {
$rootScope.hideWalletNavigation = false;
});
updateSeedSourceSelect(1); updateSeedSourceSelect(1);
self.setSeedSource(); self.setSeedSource();
}); });

View file

@ -301,7 +301,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}) })
.state('tabs.create', { .state('tabs.create', {
url: '/create', url: '/create',
abstract: true, // abstract: true,
templateUrl: 'views/create.html', templateUrl: 'views/create.html',
views: { views: {
'tab-home': { 'tab-home': {
@ -309,22 +309,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}, },
} }
}) })
.state('tabs.create.personal', { // .state('tabs.create.personal', {
url: '/tab-create-personal', // url: '/tab-create-personal',
views: { // views: {
'tab-create-personal': { // 'tab-create-personal': {
templateUrl: 'views/tab-create-personal.html', // templateUrl: 'views/tab-create-personal.html',
}, // },
} // }
}) // })
.state('tabs.create.shared', { // .state('tabs.create.shared', {
url: '/tab-create-shared', // url: '/tab-create-shared',
views: { // views: {
'tab-create-shared': { // 'tab-create-shared': {
templateUrl: 'views/tab-create-shared.html', // templateUrl: 'views/tab-create-shared.html',
}, // },
} // }
}) // })
/* /*
* *
@ -812,21 +812,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicPlatform.registerBackButtonAction(function(e) { $ionicPlatform.registerBackButtonAction(function(e) {
var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : ''; var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : '';
var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : ''; var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : '';
if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) { if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) {
ionic.Platform.exitApp(); ionic.Platform.exitApp();
} else if ($ionicHistory.backView() && !fromTabs) { } else if ($ionicHistory.backView() && !fromTabs) {
$ionicHistory.goBack(); $ionicHistory.goBack();
} else { } else {
$rootScope.backButtonPressedOnceToExit = true; $rootScope.backButtonPressedOnceToExit = true;
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit')); window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
setInterval(function() { setInterval(function() {
$rootScope.backButtonPressedOnceToExit = false; $rootScope.backButtonPressedOnceToExit = false;
}, 5000); }, 5000);
} }
e.preventDefault(); e.preventDefault();
}, 101); }, 101);
$ionicPlatform.on('pause', function() { $ionicPlatform.on('pause', function() {