finishes i18n set_locale with user settings
This commit is contained in:
parent
5b7ec86ed6
commit
2c1d9aeb9c
4 changed files with 7 additions and 1 deletions
|
@ -16,6 +16,7 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def update_profile
|
def update_profile
|
||||||
if @current_user.update_attributes(params[:user])
|
if @current_user.update_attributes(params[:user])
|
||||||
|
session[:locale] = @current_user.locale
|
||||||
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
||||||
else
|
else
|
||||||
render :profile
|
render :profile
|
||||||
|
|
|
@ -58,6 +58,7 @@ class LoginController < ApplicationController
|
||||||
if @user.save
|
if @user.save
|
||||||
Membership.new(:user => @user, :group => @invite.group).save!
|
Membership.new(:user => @user, :group => @invite.group).save!
|
||||||
@invite.destroy
|
@invite.destroy
|
||||||
|
session[:locale] = @user.locale
|
||||||
redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
|
redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,6 +57,10 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locale
|
||||||
|
settings.profile['language']
|
||||||
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
[first_name, last_name].join(" ")
|
[first_name, last_name].join(" ")
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Foodsoft
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_settings_language
|
def user_settings_language
|
||||||
current_user.settings.profile['language'] if current_user
|
current_user.locale if current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
def session_language
|
def session_language
|
||||||
|
|
Loading…
Reference in a new issue