]> git.openstreetmap.org Git - rails.git/blob - app/controllers/preferences/preferences_controller.rb
Merge remote-tracking branch 'upstream/pull/6102'
[rails.git] / app / controllers / preferences / preferences_controller.rb
1 module Preferences
2   class PreferencesController < ApplicationController
3     layout "site"
4
5     before_action :authorize_web
6     before_action :set_locale
7
8     authorize_resource :class => :preferences
9
10     before_action :check_database_readable
11     before_action :check_database_writable, :only => :update
12
13     def show; end
14
15     def update
16       if update_preferences
17         # Use a partial so that it is rendered during the next page load in the correct language.
18         flash[:notice] = { :partial => "update_success_flash" }
19         redirect_to :action => :show
20       else
21         flash.now[:error] = t "failure", :scope => "preferences.preferences.update"
22         render :show
23       end
24     end
25   end
26 end