fix autocomple ssl / port

This commit is contained in:
Matias Alejo Garcia 2014-06-27 16:31:45 -03:00
parent 7e70541487
commit 1ff057f892
2 changed files with 8 additions and 11 deletions

View File

@ -839,7 +839,7 @@
<div class="small-12 medium-6 medium-centered large-6 large-centered columns">
<fieldset>
<legend>Bitcoin Network</legend>
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="livenet" ng-false-value="testnet" class="form-control">
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="livenet" ng-false-value="testnet" class="form-control" ng-click="changeNetwork()">
<label for="network-name">Livenet</label>
</fieldset>
<fieldset>
@ -859,7 +859,7 @@
<input type="text" ng-model="insightHost" class="form-control" name="insight-host">
<label for="insight-port">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">
<input id="insight-secure" type="checkbox" ng-model="insightSecure" class="form-control" ng-click="changeInsightSSL()">
<label for="insight-secure">Use SSL</label>
</fieldset>

View File

@ -3,7 +3,6 @@
angular.module('copayApp.controllers').controller('SettingsController',
function($scope, $rootScope, $window, $location) {
$scope.title = 'Settings';
$scope.networkName = config.networkName;
$scope.insightHost = config.blockchain.host;
$scope.insightPort = config.blockchain.port;
@ -39,16 +38,14 @@ angular.module('copayApp.controllers').controller('SettingsController',
}
}
$scope.$watch('networkName', function(net) {
if (net !== config.networkName)
$scope.insightHost = net === 'testnet' ? 'test-insight.bitpay.com' : 'insight.bitpay.com';
});
$scope.changeNetwork = function() {
$scope.insightHost = $scope.networkName === 'testnet' ? 'test-insight.bitpay.com' : 'insight.bitpay.com';
};
var l2 = $scope.$watch('insightSecure', function(ssl) {
if (ssl !== config.insightSecure)
$scope.insightPort = ssl ? 443 : 80;
});
$scope.changeInsightSSL = function() {
$scope.insightPort = $scope.insightSecure ? 443 : 80;
};
$scope.save = function() {