Added cookies banner.

Commit
0c35617343964ad97d3ee21faf5ff5e5b1088e94
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
app/assets/stylesheets/components/cookies_banner.css
index 00000000..b675e823 000000..100644
@@ -0,0 +1,16 @@
1 Added: #cookies-banner {
2 Added: position: fixed;
3 Added: bottom: 0;
4 Added: height: 30%;
5 Added: width: 100%;
6 Added: background-color: darkred;
7 Added: color: white;
8 Added: text-align: center;
9 Added: padding: 1em;
10 Added: font-family: 'Arial', sans-serif;
11 Added: }
12 Added:
13 Added: #cookies-banner p {
14 Added: /* margin: 0; */
15 Added: font-weight: bold;
16 Added: }
app/controllers/sessions_controller.rb
index 9785c923..fad2c4be 100644..100644
@@ -1,5 +1,5 @@
1 1 class SessionsController < ApplicationController
2 Removed: allow_unauthenticated_access only: %i[ new create ]
2 Added: allow_unauthenticated_access only: %i[ new create dismiss_banner ]
3 3 rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." }
4 4
5 5 def new
@@ -17,5 +17,10 @@
17 17 def destroy
18 18 terminate_session
19 19 redirect_to new_session_path
20 Added: end
21 Added:
22 Added: def dismiss_banner
23 Added: session[:dismissed_banner] = true
24 Added: redirect_to root_path
20 25 end
21 26 end
app/views/layouts/_cookies.html.erb
index 00000000..0e6949ac 000000..100644
@@ -0,0 +1,8 @@
1 Added: <div id="cookies-banner">
2 Added: <p>
3 Added: Acceptez les cookies ou contribuer 2 € à la tartiflette de
4 Added: Nicolas 💸
5 Added: </p>
6 Added: <%= button_to "Accepter les cookies", dismiss_banner_path %>
7 Added: <%= button_to "Faire un don", dismiss_banner_path %>
8 Added: </div>
app/views/layouts/application.html.erb
index 680dec1f..c9ca629c 100644..100644
@@ -29,5 +29,6 @@
29 29 <%= yield %>
30 30 </main>
31 31 <%= render "layouts/footer" %>
32 Added: <%= render "layouts/cookies" unless session[:dismissed_banner] %>
32 33 </body>
33 34 </html>
config/routes.rb
index efa95892..2f18da01 100644..100644
@@ -12,6 +12,10 @@
12 12 to: "code_of_honor#toggle",
13 13 as: :toggle_code_of_honor
14 14
15 Added: post '/dismiss_banner',
16 Added: to: 'sessions#dismiss_banner',
17 Added: as: :dismiss_banner
18 Added:
15 19 resources :tartiflettes do
16 20 get "scores/edit",
17 21 to: "scores#edit_all",