]> git.openstreetmap.org Git - rails.git/blob - app/controllers/accounts/pd_declarations_controller.rb
Merge pull request #5677 from tomhughes/user-list-enhancements
[rails.git] / app / controllers / accounts / pd_declarations_controller.rb
1 module Accounts
2   class PdDeclarationsController < ApplicationController
3     layout "site"
4
5     before_action :authorize_web
6     before_action :set_locale
7
8     authorize_resource :class => :account_pd_declaration
9
10     def show; end
11
12     def create
13       if current_user.consider_pd
14         flash[:warning] = t(".already_declared")
15       else
16         current_user.consider_pd = params[:consider_pd]
17
18         if current_user.consider_pd
19           flash[:notice] = t(".successfully_declared") if current_user.save
20         else
21           flash[:warning] = t(".did_not_confirm")
22         end
23       end
24
25       redirect_to edit_account_path
26     end
27   end
28 end