Fix preferencesLanguage

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

View File

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

View File

@ -4,7 +4,7 @@
ng-repeat="lang in index.availableLanguages"
ng-click="prefLang.save(lang.isoCode)" class="line-b p20 size-14">
<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 class="extra-margin-bottom"></div>

View File

@ -42,9 +42,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
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) {
$log.debug('onGoingProcess', processName, isOn);
self[processName] = isOn;

View File

@ -1,7 +1,7 @@
'use strict';
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.success = null;
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
this.selectedAlternative = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
};
};
var fc = profileService.focusedClient;
$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() {
unwatch();
});

View File

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