]> git.openstreetmap.org Git - rails.git/blob - app/controllers/accounts/pd_declarations_controller.rb
Add frozen_string_literal comments to ruby files
[rails.git] / app / controllers / accounts / pd_declarations_controller.rb
1 # frozen_string_literal: true
2
3 module Accounts
4   class PdDeclarationsController < ApplicationController
5     layout :site_layout
6
7     before_action :authorize_web
8     before_action :set_locale
9
10     authorize_resource :class => :account_pd_declaration
11
12     def show; end
13
14     def create
15       if current_user.consider_pd
16         flash[:warning] = t(".already_declared")
17       else
18         current_user.consider_pd = params[:consider_pd]
19
20         if current_user.consider_pd
21           flash[:notice] = t(".successfully_declared") if current_user.save
22         else
23           flash[:warning] = t(".did_not_confirm")
24         end
25       end
26
27       redirect_to account_path
28     end
29   end
30 end