Fixed language change.
This commit is contained in:
parent
c36993fd18
commit
b531b74bf7
3 changed files with 31 additions and 9 deletions
|
@ -25,7 +25,7 @@ class Index extends App.Controller
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
error = @form.validate(params)
|
error = @form.validate(params)
|
||||||
if error
|
if error
|
||||||
@formValidate( form: e.target, errors: error )
|
@formValidate( form: e.target, errors: error )
|
||||||
return false
|
return false
|
||||||
|
@ -35,13 +35,13 @@ class Index extends App.Controller
|
||||||
# get data
|
# get data
|
||||||
@locale = params['locale']
|
@locale = params['locale']
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'preferences'
|
id: 'preferences'
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
url: @apiPath + '/users/preferences'
|
url: @apiPath + '/users/preferences'
|
||||||
data: JSON.stringify(params)
|
data: JSON.stringify({user:params})
|
||||||
processData: true
|
processData: true
|
||||||
success: @success
|
success: @success
|
||||||
error: @error
|
error: @error
|
||||||
)
|
)
|
||||||
|
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
|
|
@ -509,8 +509,8 @@ curl http://localhost/api/v1/users/preferences.json -v -u #{login}:#{password} -
|
||||||
params[:user].each {|key, value|
|
params[:user].each {|key, value|
|
||||||
current_user.preferences[key.to_sym] = value
|
current_user.preferences[key.to_sym] = value
|
||||||
}
|
}
|
||||||
|
current_user.save
|
||||||
end
|
end
|
||||||
current_user.save
|
|
||||||
render :json => { :message => 'ok' }, :status => :ok
|
render :json => { :message => 'ok' }, :status => :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,31 @@ class PreferencesTest < TestCase
|
||||||
:area => 'body',
|
:area => 'body',
|
||||||
:value => 'Language',
|
:value => 'Language',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:execute => 'select',
|
||||||
|
:css => '.language_item select[name="locale"]',
|
||||||
|
:value => 'Deutsch',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'click',
|
||||||
|
:css => '.content button[type="submit"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'watch_for',
|
||||||
|
:area => 'body',
|
||||||
|
:value => 'Sprache',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'reload',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'watch_for',
|
||||||
|
:area => 'body',
|
||||||
|
:value => 'Sprache',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
browser_signle_test_with_login(tests)
|
browser_signle_test_with_login(tests)
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue