Skip to content
Browse files

redirect admins to new locale when locale changed

when admins update the default language for a wiki survey, we redirect them to
the selected language after the save.
  • Loading branch information...
1 parent 8b5878d commit 873441e0ac58f8669edc94155da1680193f5511a @lukebaker lukebaker committed
Showing with 5 additions and 3 deletions.
  1. +5 −3 app/controllers/questions_controller.rb
View
8 app/controllers/questions_controller.rb
@@ -1133,12 +1133,14 @@ def update
respond_to do |format|
+ old_lang = @earl.default_lang
if @earl.update_attributes(params[:earl].slice(:pass, :logo, :welcome_message, :default_lang, :flag_enabled, :ga_code, :question_should_autoactivate_ideas))
- logger.info("Saving new information on earl")
flash[:notice] = 'Question settings saved successfully!'
- logger.info("Saved new information on earl")
+ # redirect to new lang if lang was changed
+ if old_lang != @earl.default_lang
+ I18n.locale = @earl.default_lang
+ end
format.html {redirect_to(:action => 'admin', :id => @earl.name) and return }
- # format.xml { head :ok }
else
@partial_results_url = "#{@earl.name}/results"
@choices = Choice.find(:all, :params => {:question_id => @question.id, :include_inactive => true})

0 comments on commit 873441e

Please sign in to comment.
Something went wrong with that request. Please try again.