You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
563 B
25 lines
563 B
8 years ago
|
# frozen_string_literal: true
|
||
|
|
||
2 years ago
|
class Settings::Preferences::BaseController < Settings::BaseController
|
||
8 years ago
|
def show; end
|
||
8 years ago
|
|
||
|
def update
|
||
8 years ago
|
if current_user.update(user_params)
|
||
8 years ago
|
I18n.locale = current_user.locale
|
||
6 years ago
|
redirect_to after_update_redirect_path, notice: I18n.t('generic.changes_saved_msg')
|
||
8 years ago
|
else
|
||
8 years ago
|
render :show
|
||
8 years ago
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
6 years ago
|
def after_update_redirect_path
|
||
2 years ago
|
raise 'Override in controller'
|
||
6 years ago
|
end
|
||
|
|
||
8 years ago
|
def user_params
|
||
2 years ago
|
params.require(:user).permit(:locale, chosen_languages: [], settings_attributes: UserSettings.keys)
|
||
8 years ago
|
end
|
||
|
end
|