Fix preferencesLanguage

This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-22 15:47:14 -03:00
commit 764caffd74
5 changed files with 10 additions and 7 deletions

View file

@ -31,7 +31,7 @@
<span translate>Language</span> <span translate>Language</span>
<span class="right text-gray"> <span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i> <i class="icon-arrow-right3 size-24 right"></i>
{{index.defaultLanguageName}} {{preferences.getDefaultLanguageName(index.availableLanguages)}}
</span> </span>
</li> </li>

View file

@ -4,7 +4,7 @@
ng-repeat="lang in index.availableLanguages" ng-repeat="lang in index.availableLanguages"
ng-click="prefLang.save(lang.isoCode)" class="line-b p20 size-14"> ng-click="prefLang.save(lang.isoCode)" class="line-b p20 size-14">
<span>{{lang.name}}</span> <span>{{lang.name}}</span>
<i class="fi-check size-16 right" ng-show="index.defaultLanguage == lang.isoCode"></i> <i class="fi-check size-16 right" ng-show="prefLang.defaultLanguage == lang.isoCode"></i>
</div> </div>
</div> </div>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View file

@ -42,9 +42,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
isoCode: 'ja', isoCode: 'ja',
}]; }];
self.defaultLanguage = configService.getSync().wallet.settings.defaultLanguage || 'en';
self.defaultLanguageName = lodash.result(lodash.find(this.availableLanguages, { 'isoCode': self.defaultLanguage }), 'name');
self.setOngoingProcess = function(processName, isOn) { self.setOngoingProcess = function(processName, isOn) {
$log.debug('onGoingProcess', processName, isOn); $log.debug('onGoingProcess', processName, isOn);
self[processName] = isOn; self[processName] = isOn;

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesController', angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, configService, profileService) { function($scope, $rootScope, $filter, $timeout, $modal, $log, lodash, configService, profileService) {
this.error = null; this.error = null;
this.success = null; this.success = null;
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
this.selectedAlternative = { this.selectedAlternative = {
name: config.wallet.settings.alternativeName, name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode isoCode: config.wallet.settings.alternativeIsoCode
}; };
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
$scope.encrypt = fc.hasPrivKeyEncrypted(); $scope.encrypt = fc.hasPrivKeyEncrypted();
@ -48,6 +48,11 @@ angular.module('copayApp.controllers').controller('preferencesController',
} }
}); });
this.getDefaultLanguageName = function(availableLanguages) {
var defaultLanguage = config.wallet.settings.defaultLanguage || 'en';
return lodash.result(lodash.find(availableLanguages, { 'isoCode': defaultLanguage }), 'name');
};
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
unwatch(); unwatch();
}); });

View file

@ -2,6 +2,7 @@
angular.module('copayApp.controllers').controller('preferencesLanguageController', angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $timeout, configService, applicationService) { function($scope, $timeout, configService, applicationService) {
this.defaultLanguage = configService.getSync().wallet.settings.defaultLanguage || 'en';
this.save = function(newLang) { this.save = function(newLang) {
var opts = { var opts = {