settings: refactor views

This commit is contained in:
Manuel Araoz 2014-09-03 11:27:31 -03:00
parent 5a001c8737
commit e992b976e0
4 changed files with 63 additions and 73 deletions

View File

@ -4,8 +4,8 @@ angular.module('copayApp.controllers').controller('MoreController',
function($scope, $rootScope, $location, backupService, walletFactory, controllerUtils, notification) {
var w = $rootScope.wallet;
$scope.hideAdv=true;
$scope.hidePriv=true;
$scope.hideAdv = true;
$scope.hidePriv = true;
if (w)
$scope.priv = w.privateKey.toObj().extendedPrivateKeyString;
@ -24,7 +24,7 @@ angular.module('copayApp.controllers').controller('MoreController',
$scope.purge = function(deleteAll) {
var w = $rootScope.wallet;
var removed = w.purgeTxProposals(deleteAll);
if (removed){
if (removed) {
controllerUtils.updateBalance();
}
notification.info('Tx Proposals Purged', removed + ' transaction proposal purged');
@ -32,14 +32,14 @@ angular.module('copayApp.controllers').controller('MoreController',
$scope.updateIndexes = function() {
var w = $rootScope.wallet;
notification.info('Scaning for transactions','Using derived addresses from your wallet');
notification.info('Scaning for transactions', 'Using derived addresses from your wallet');
w.updateIndexes(function(err) {
notification.info('Scan Ended', 'Updating balance');
if (err) {
notification.error('Error', 'Error updating indexes: ' + err);
}
controllerUtils.updateAddressList();
controllerUtils.updateBalance(function(){
controllerUtils.updateBalance(function() {
notification.info('Finished', 'The balance is updated using the derived addresses');
w.sendIndexes();
});

View File

@ -4,11 +4,9 @@ angular.module('copayApp.controllers').controller('SettingsController', function
controllerUtils.redirIfLogged();
$scope.title = 'Settings';
$scope.networkName = config.networkName;
$scope.insightHost = config.blockchain.host;
$scope.insightPort = config.blockchain.port;
$scope.insightSecure = config.blockchain.schema === 'https';
$scope.forceNetwork = config.forceNetwork;
$scope.defaultLanguage = config.defaultLanguage || 'en';
$scope.availableLanguages = [{

View File

@ -1,62 +1,79 @@
<div class="backup" ng-controller="MoreController">
<h1 translate>Settings </h1>
<div class="oh large-12 columns panel">
<h3><i class="fi-download m10r"></i> <span translate>Backup</span> </h3>
<p translate class="large-8 columns text-gray">It's important to backup your wallet so that you can recover it in case of disaster</p>
<div class="large-4 columns">
<a translate class="button primary expand" ng-click="downloadBackup()">Download File</a>
</div>
<div class="oh large-12 columns panel">
<h3><i class="fi-download m10r"></i> <span translate>Backup</span> </h3>
<p translate class="large-8 columns text-gray">It's important to backup your wallet so that you can recover it in case of disaster</p>
<div class="large-4 columns">
<a translate class="button primary expand" ng-click="downloadBackup()">Download File</a>
</div>
<div class="large-12 columns line-dashed-h m15b"> </div>
</div>
<div class="large-12 columns line-dashed-h m15b"></div>
<form name="settingsForm">
<fieldset>
<legend translate>Wallet Unit</legend>
<select class="form-control" ng-model="selectedUnit" ng-options="o.name for o in unitOpts" required>
</select>
</fieldset>
<fieldset>
<legend translate>Alternative Currency</legend>
<select class="form-control" ng-model="selectedAlternative" ng-options="alternative.name for alternative in alternativeOpts" required>
</select>
</fieldset>
<div class="text-right">
<button translate type="submit" class="button primary m0 ng-binding" ng-disabled="setupForm.$invalid || loading" disabled="disabled" ng-click="save()">
Save
</button>
</div>
</form>
<div class="large-12 columns line-dashed-h m15b"></div>
<div>
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i>
<span translate>Delete Wallet</span> </h3>
<p translate class="large-8 columns text-gray">If all funds have been removed from your wallet and you do not wish to have the wallet data stored on your computer anymore, you can delete your wallet.</p>
<h3><i class="fi-minus-circle m10r"></i> <span translate> Delete Wallet </span></h3>
<p translate class="large-8 columns text-gray">If all funds have been removed from your wallet and you do not wish to have the wallet data stored on your computer anymore, you can delete your wallet.</p>
<div class="large-4 columns">
<a translate class="button warning expand"
ng-really-message="'Are you sure to delete this wallet from this computer?'|translate" ng-really-click="deleteWallet()"> Delete</a>
<a translate class="button warning expand" ng-really-message="'Are you sure to delete this wallet from this computer?'|translate" ng-really-click="deleteWallet()"> Delete</a>
</div>
</div>
</div>
<p>
<a class="expand small" ng-click="hideAdv=!hideAdv">
<span translate ng-hide="!hideAdv">Show</span>
<span translate ng-hide="hideAdv">Hide</span>
<span translate>advanced options</span>
</a>
<a class="expand small" ng-click="hideAdv=!hideAdv">
<span translate ng-hide="!hideAdv">Show</span>
<span translate ng-hide="hideAdv">Hide</span>
<span translate>advanced options</span>
</a>
<div ng-hide="hideAdv">
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i>
<div ng-hide="hideAdv">
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i>
<span translate>Master Private Key</span> </h3>
<p translate class="large-8 columns text-gray">
Your master private key contains the information to sign <b>any</b> transaction on this wallet. Handle with care.
</p>
<div class="large-4 columns">
<a class="button primary expand" ng-click="hidePriv=!hidePriv">
<a class="button primary expand" ng-click="hidePriv=!hidePriv">
<span translate ng-hide="!hidePriv">Show</span>
<span translate ng-hide="hidePriv">Hide</span>
</a>
</div>
<textarea ng-hide="hidePriv" readonly>{{priv}}</textarea>
</div>
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i> <span translate>Scan Wallet Addresses</span> </h3>
</div>
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i> <span translate>Scan Wallet Addresses</span> </h3>
<p translate class="large-8 columns text-gray">
This will scan the blockchain looking for addresses derived from your wallet, in case you have funds in addresses not yet generated (e.g.: you restored an old backup). This will also trigger a syncronization of addresses to other connected peers.
This will scan the blockchain looking for addresses derived from your wallet, in case you have funds in addresses not yet generated (e.g.: you restored an old backup). This will also trigger a syncronization of addresses to other connected peers.
</p>
<div class="large-4 columns">
<a translate class="button primary expand" ng-click="updateIndexes()">
<a translate class="button primary expand" ng-click="updateIndexes()">
Scan
</a>
</div>
</div>
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i> <span translate>Purge Pending Transaction Proposals</span> </h3>
</div>
<div class="oh large-12 columns panel">
<h3><i class="fi-minus-circle m10r"></i> <span translate>Purge Pending Transaction Proposals</span> </h3>
<p translate class="large-8 columns text-gray">
Pending Transactions Proposals will be discarted. This need to be done on <b>ALL<b> peers of a wallet, to prevent the old proposals to be resynced again.
Pending Transactions Proposals will be discarted. This need to be done on <b>ALL<b> peers of a wallet, to prevent the old proposals to be resynced again.
</p>
<div class="large-4 columns">
<a translate class="button warning expand" ng-click="purge()">
@ -78,4 +95,3 @@
</div>
</div>

View File

@ -10,45 +10,22 @@
<form name="settingsForm">
<fieldset>
<legend translate>Language</legend>
<select class="form-control" ng-model="selectedLanguage"
ng-options="o.name for o in availableLanguages" required>
<select class="form-control" ng-model="selectedLanguage" ng-options="o.name for o in availableLanguages" required>
</select>
</fieldset>
<fieldset>
<legend translate>Bitcoin Network</legend>
<input id="network-name" type="checkbox" ng-model="networkName"
ng-true-value="livenet" ng-false-value="testnet" class="form-control" ng-click="changeNetwork()"
ng-disabled="forceNetwork"
ng-checked="networkName == 'livenet' ? true : false">
<label for="network-name">Livenet</label>
<div translate ng-show="forceNetwork">
Network has been fixed to <strong>{{networkName}}</strong> in this setup. See <a href="https://copay.io">copay.io</a> for options to use Copay on both livenet and testnet.
</div>
</fieldset>
<fieldset>
<legend translate>Wallet Unit</legend>
<select class="form-control" ng-model="selectedUnit" ng-options="o.name for o in unitOpts" required>
</select>
</fieldset>
<fieldset>
<legend translate>Alternative Currency</legend>
<select class="form-control" ng-model="selectedAlternative" ng-options="alternative.name for alternative in alternativeOpts" required>
</select>
</fieldset>
<fieldset>
<legend translate>Insight API server</legend>
<label for="insight-host">Host</label>
<input type="text" ng-model="insightHost" class="form-control" name="insight-host">
<label for="insight-port" translate>Port</label>
<input type="number" ng-model="insightPort" class="form-control" name="insight-port">
<input id="insight-secure" type="checkbox" ng-model="insightSecure" class="form-control" ng-click="changeInsightSSL()">
<label for="insight-secure" translate>Use SSL</label>
<legend translate>Insight API server</legend>
<label for="insight-host">Host</label>
<input type="text" ng-model="insightHost" class="form-control" name="insight-host">
<label for="insight-port" translate>Port</label>
<input type="number" ng-model="insightPort" class="form-control" name="insight-port">
<input id="insight-secure" type="checkbox" ng-model="insightSecure" class="form-control" ng-click="changeInsightSSL()">
<label for="insight-secure" translate>Use SSL</label>
<p translate class="small">
Insight API server is open-source software. You can run your own instance, check <a href="http://insight.is" target="_blank">Insight API Homepage</a></p>
<p translate class="small">
Insight API server is open-source software. You can run your own instance, check <a href="http://insight.is" target="_blank">Insight API Homepage</a>
</p>
</fieldset>
<div class="text-right">
<a class="back-button text-white m20r" href="#!/">&laquo; <span translate>Back</span></a>
<button translate type="submit" class="button primary m0 ng-binding" ng-disabled="setupForm.$invalid || loading" disabled="disabled" ng-click="save()">
@ -60,4 +37,3 @@
</div>
</div>
</div>