added updating of translation when user changes profile language
This commit is contained in:
parent
6a992d74ad
commit
ff509f2b5c
@ -6,7 +6,7 @@ angular.module('core').config(['$translateProvider', function ($translateProvide
|
||||
MENU: 'MENU',
|
||||
SIGNUP_TAB: 'Créer un Compte',
|
||||
SIGNIN_TAB: 'Connexion',
|
||||
SIGNOUT_TAB: 'Créer un compte',
|
||||
SIGNOUT_TAB: 'Déconnexion',
|
||||
EDIT_PROFILE: 'Modifier Mon Profil',
|
||||
MY_SETTINGS: 'Mes Paramètres',
|
||||
CHANGE_PASSWORD: 'Changer mon Mot de Pass',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('SettingsController', ['$scope', '$rootScope', '$http', '$state', 'Users', 'Auth', 'currentUser', 'USERS_URL',
|
||||
function($scope, $rootScope, $http, $state, Users, Auth, currentUser, USERS_URL) {
|
||||
angular.module('users').controller('SettingsController', ['$scope', '$rootScope', '$http', '$state', 'Users', 'Auth', 'currentUser', 'USERS_URL', '$translate',
|
||||
function($scope, $rootScope, $http, $state, Users, Auth, currentUser, USERS_URL, $translate) {
|
||||
|
||||
$scope.user = currentUser;
|
||||
|
||||
@ -18,6 +18,9 @@ angular.module('users').controller('SettingsController', ['$scope', '$rootScope'
|
||||
$scope.success = true;
|
||||
$scope.error = null;
|
||||
$scope.user = response.data;
|
||||
|
||||
$translate.use($scope.user.language);
|
||||
Auth.update($scope.user);
|
||||
}, function(error) {
|
||||
$scope.success = null;
|
||||
$scope.error = 'Could not update your profile due to an error with the server. Sorry about this!'
|
||||
|
||||
@ -56,6 +56,10 @@ angular.module('users').factory('Auth', ['$window', '$q', 'User',
|
||||
this._currentUser = new_user;
|
||||
},
|
||||
|
||||
update: function(new_user) {
|
||||
this._currentUser = new_user;
|
||||
},
|
||||
|
||||
logout: function() {
|
||||
$window.user = null;
|
||||
userState.isLoggedIn = false;
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<h4>{{ 'FIRST_NAME_LABEL' | translate }}</h4>
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" data-ng-model="user.firstName" ng-pattern="/^[\w0-9 \-.]*$/">
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="user.firstName" ng-pattern="/^[\w0-9 \-.]*$/">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
@ -27,7 +27,7 @@
|
||||
<h4>{{ 'LAST_NAME_LABEL' | translate }}</h4>
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" ng-pattern="/^[\w0-9 \-.]*$/">
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="user.lastName" ng-pattern="/^[\w0-9 \-.]*$/">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -56,7 +56,7 @@
|
||||
<h4>{{ 'USERNAME_LABEL' | translate }}</h4>
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input type="text" id="username" name="username" class="form-control" data-ng-model="user.username">
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="user.username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
<h4>{{ 'EMAIL_LABEL' | translate }}</h4>
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input type="email" id="email" name="email" class="form-control" data-ng-model="user.email">
|
||||
<input type="email" id="email" name="email" class="form-control" ng-model="user.email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user