Skip to content

Commit

Permalink
change timelife cookie banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Hasjanov authored and Oleg Hasjanov committed Dec 22, 2023
1 parent 22aae79 commit 3d29e6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions app/controllers/cookies_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
class CookiesController < ApplicationController
def update
session[:cookie_dialog] = 'accepted'
session[:google_analytics] = if params[:cookies] == 'accepted' || params[:analytics_selected] == '1'
'accepted'
else
'declined'
end
cookies[:cookie_dialog] = {
value: "accepted",
expires: 1.year.from_now,
}

cookies[:google_analytics] = if params[:cookies] == 'accepted' || params[:analytics_selected] == '1'
{
value: "accepted",
expires: 1.year.from_now,
}
else
{
value: "declined",
expires: 1.year.from_now,
}
end

redirect_to root_path
end
end
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def end_of_procdure
end

def show_cookie_dialog?
session[:cookie_dialog] != 'accepted'
cookies[:cookie_dialog] != 'accepted'
end

def show_google_analytics?
session[:google_analytics] == 'accepted'
cookies[:google_analytics] == 'accepted'
end

private
Expand Down

0 comments on commit 3d29e6e

Please sign in to comment.