settings: simple insight config controller and view

This commit is contained in:
Manuel Araoz 2014-09-10 11:56:33 -07:00
parent 2aa2d89f92
commit 423348f5ec
2 changed files with 14 additions and 21 deletions

View File

@ -4,10 +4,9 @@ angular.module('copayApp.controllers').controller('SettingsController', function
controllerUtils.redirIfLogged();
$scope.title = 'Settings';
$scope.insightHost = config.network.host;
$scope.insightPort = config.network.port;
$scope.insightSecure = config.network.schema === 'https';
$scope.defaultLanguage = config.defaultLanguage || 'en';
$scope.insightLivenet = config.network.livenet.url;
$scope.insightTestnet = config.network.testnet.url;
$scope.availableLanguages = [{
name: 'English',
@ -24,18 +23,14 @@ angular.module('copayApp.controllers').controller('SettingsController', function
}
}
$scope.changeInsightSSL = function() {
$scope.insightPort = $scope.insightSecure ? 80 : 443;
};
$scope.save = function() {
var network = config.network;
var insightSettings = {
host: $scope.insightHost,
port: $scope.insightPort,
schema: $scope.insightSecure ? 'https' : 'http',
livenet: {
url: $scope.insightLivenet,
},
testnet: {
url: $scope.insightTestnet,
},
}
localStorage.setItem('config', JSON.stringify({

View File

@ -14,16 +14,14 @@
</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 servers</legend>
<label for="insight-livenet">Livenet</label>
<input type="text" ng-model="insightLivenet" class="form-control" name="insight-livenet">
<label for="insight-testnet">Testnet</label>
<input type="text" ng-model="insightTestnet" class="form-control" name="insight-testnet">
<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>
Insight API server is open-source software. You can run your own instances, check <a href="http://insight.is" target="_blank">Insight API Homepage</a>
</p>
</fieldset>
<div class="text-right">