cookie_consent_banner 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +153 -0
- data/Rakefile +8 -0
- data/app/controllers/concerns/cookie_consent_banner/consentable.rb +15 -0
- data/app/controllers/cookie_consent_banner/application_controller.rb +4 -0
- data/app/controllers/cookie_consent_banner/consents_controller.rb +36 -0
- data/app/views/cookie_consent_banner/consents/create.turbo_stream.erb +1 -0
- data/app/views/cookie_consent_banner/consents/new.turbo_stream.erb +3 -0
- data/config/routes.rb +3 -0
- data/lib/cookie_consent_banner/configuration.rb +11 -0
- data/lib/cookie_consent_banner/engine.rb +17 -0
- data/lib/cookie_consent_banner/helper.rb +7 -0
- data/lib/cookie_consent_banner/railtie.rb +9 -0
- data/lib/cookie_consent_banner/version.rb +3 -0
- data/lib/cookie_consent_banner.rb +18 -0
- data/lib/generators/cookie_consent_banner/install_generator.rb +21 -0
- data/lib/generators/cookie_consent_banner/templates/_modal.html.erb +70 -0
- data/lib/generators/cookie_consent_banner/templates/cookie_consent_banner.rb +4 -0
- data/lib/generators/cookie_consent_banner/templates/en.yml +35 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5fa72c6a2694c6c489350e3e105ab14fa9586c6c8d2d8a8cdd306a86039c66a4
|
4
|
+
data.tar.gz: 1b2961cc9d48ee6dcdaae9fa8f95bc5b1fa760b4a1606107f103dd9ca49c0716
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bdfa6c42936ca7f8f4cb152816b1dfe52a19ed5d9f6664a4226f7f53f7be1e5abdb658ad385cf8ed833b97b54774ea019f33e857f9aa9ebfafb6592f013195e5
|
7
|
+
data.tar.gz: dabc9dd6b770ab2e7e310110c4d83f0fcd6e686dcfa25b354d94b40f711ff436218432bccb1d4c67336fd04fd872e24d52c81228bb3d3f0e3db6293135a255cb
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright Dhairya Gabhawala
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
# Cookie Consent Banner Rails Engine
|
2
|
+
**Cookie Consent Banner Rails Engine** is a plug-and-play solution to display, manage, and persist cookie consent preferences in your Rails application.
|
3
|
+
It uses **Turbo Frames** for smooth rendering and updating of the consent popup without full-page reloads.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
* **Quick setup** with Rails generator
|
7
|
+
* **Locale support** for customizing messages
|
8
|
+
* **Turbo Frames** integration for a seamless user experience
|
9
|
+
* Centralized **controller concern** for validating consent across the application
|
10
|
+
* Ready-to-use **view partial** for the cookie consent modal
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "cookie_consent_banner"
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
```bash
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
```bash
|
26
|
+
$ gem install cookie_consent_banner
|
27
|
+
```
|
28
|
+
|
29
|
+
## Setup
|
30
|
+
Run the install generator:
|
31
|
+
```bash
|
32
|
+
rails generate cookie_consent_banner:install
|
33
|
+
```
|
34
|
+
|
35
|
+
This will create:
|
36
|
+
1. **Initializer:** `config/initializers/cookie_consent_banner.rb`
|
37
|
+
Configure cookie consent options, such as expiration time and categories.
|
38
|
+
```ruby
|
39
|
+
# Add symbols for the cookie categories to the below array
|
40
|
+
config.cookie_buckets = []
|
41
|
+
# Update the default cookie expiration below
|
42
|
+
config.cookie_expiration = 1.year
|
43
|
+
```
|
44
|
+
2. **Locale file:** `config/locales/cookie_consent_banner.en.yml`
|
45
|
+
Customize text, labels, and messages for the consent modal.
|
46
|
+
3. **View partial:** `app/views/cookie_consent_banner/_modal.html.erb`
|
47
|
+
The modal that appears to the user requesting their consent.
|
48
|
+
|
49
|
+
## Usage
|
50
|
+
### 1. Mount the engine
|
51
|
+
To enable the controller routes required to send the consents calls, add the following to the routes file:
|
52
|
+
```ruby
|
53
|
+
mount CookieConsentBanner::Engine => "/cookie-consent-banner"
|
54
|
+
```
|
55
|
+
|
56
|
+
### 2. Include the concern
|
57
|
+
To ensure cookie consent is validated regardless of the page the user enters from, include the provided concern in you ApplicationController:
|
58
|
+
```ruby
|
59
|
+
class ApplicationController < ActionController::Base
|
60
|
+
include CookieConsentBanner::Consentable
|
61
|
+
end
|
62
|
+
```
|
63
|
+
This makes the instance variable `@show_cookie_consent_banner` available in your views, which indicates whether the consent modal should be displayed.
|
64
|
+
|
65
|
+
### 3. Display the modal
|
66
|
+
Add the modal partial to your application layout (e.g., `app/views/layouts/application.html.erb`):
|
67
|
+
|
68
|
+
```erb
|
69
|
+
<%= render_cookie_consent_banner_modal if @show_cookie_consent_banner %>
|
70
|
+
```
|
71
|
+
|
72
|
+
Add the turbo frame to your application layout (e.g., `app/views/layouts/application.html.erb`):
|
73
|
+
|
74
|
+
```erb
|
75
|
+
<%= turbo_frame_tag :cookie_consent_banner_modal_container %>
|
76
|
+
```
|
77
|
+
|
78
|
+
### 4. Understanding the YAML File:
|
79
|
+
All items related to the Cookie Consent Modal are nested in the `cookie_consent_banner_modal` object. YAML file will provide support for translating the content into multiple languages.
|
80
|
+
|
81
|
+
Add the cookie categories in the `categories` object. Each category requires the following attributes:
|
82
|
+
1. Name: Readable name of the cookie category. This is used to present it in the modal.
|
83
|
+
2. Description: Description presented under the cookie category in the modal.
|
84
|
+
3. Cookies: Contains the individual list of cookies in the respective categories. Each cookie has following attributes:
|
85
|
+
1. Name: Cookie Name
|
86
|
+
2. Description: What purpose does this cookie serve.
|
87
|
+
3. Domain (Optional): Which domain this cookie is set by.
|
88
|
+
4. Service (Optional): Provide the name of the serice this is related to.
|
89
|
+
*You can add as many attributes as you desire to the cookie object to expose to the user. Make sure to update the view partial to share it with the user.
|
90
|
+
4. Buttons: This contains keys for various buttons in the experience.
|
91
|
+
|
92
|
+
```YAML
|
93
|
+
en:
|
94
|
+
cookie_consent_banner_modal:
|
95
|
+
title: "We use cookies"
|
96
|
+
description: "We use cookies to improve your experience on our website. You can choose which types of cookies to allow."
|
97
|
+
categories:
|
98
|
+
essential:
|
99
|
+
name: "Essential"
|
100
|
+
description: "Required for the site to work."
|
101
|
+
cookies:
|
102
|
+
- name: "_session_id"
|
103
|
+
description: "Maintains your session while you browse the site."
|
104
|
+
- name: "csrf_token"
|
105
|
+
description: "Helps prevent cross-site request forgery attacks."
|
106
|
+
analytics:
|
107
|
+
name: "Analytics"
|
108
|
+
description: "Help us understand how you use the site."
|
109
|
+
cookies:
|
110
|
+
- name: "_session_id"
|
111
|
+
description: "Maintains your session while you browse the site."
|
112
|
+
- name: "csrf_token"
|
113
|
+
description: "Helps prevent cross-site request forgery attacks."
|
114
|
+
marketing:
|
115
|
+
name: "Marketing"
|
116
|
+
description: "Personalize ads and content."
|
117
|
+
cookies:
|
118
|
+
- name: "_session_id"
|
119
|
+
description: "Maintains your session while you browse the site."
|
120
|
+
- name: "csrf_token"
|
121
|
+
description: "Helps prevent cross-site request forgery attacks."
|
122
|
+
buttons:
|
123
|
+
necessary: "Necessary Only"
|
124
|
+
accept_all: "Accept All"
|
125
|
+
save_preferences: "Save Preferences"
|
126
|
+
```
|
127
|
+
|
128
|
+
### 5. How it works
|
129
|
+
* On page load, if the user's cookie consent has not been set, `@show_cookie_consent_banner` will be `true`, triggering the modal.
|
130
|
+
* The modal is rendered inside a **Turbo Frame** from smooth updates.
|
131
|
+
* When the user accepts or changes preferences, the Turbo Frame sends the update to the controller action, which sets the cookie and hides the modal.
|
132
|
+
|
133
|
+
### Customization
|
134
|
+
* **Style:** Update `_modal.html.erb` to match your site's design and configure the default consent, and how obtrusive the experience needs to be.
|
135
|
+
* **Translations:** Edit `config/locales/cookie_consent_banner.en.yml` for copy changes.
|
136
|
+
* **Behavior:** Adjust `config/initializer/cookie_consent_banner.rb` to modify consent handling.
|
137
|
+
|
138
|
+
### Example Flow
|
139
|
+
1. User visits any page.
|
140
|
+
2. concern checks for cookie consent.
|
141
|
+
3. If not set -> Modal appears using Turbo Frame.
|
142
|
+
4. User interacts with modal -> Turbo sends form request.
|
143
|
+
5. Controller updates cookie and hides modal.
|
144
|
+
|
145
|
+
## Requirements
|
146
|
+
1. Rails 7+
|
147
|
+
2. Hotwire/Turbo enabled in your application
|
148
|
+
|
149
|
+
## Contributing
|
150
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/dhairyagabha/cookie_consent_banner](https://github.com/dhairyagabha/cookie_consent_banner). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
|
151
|
+
|
152
|
+
## License
|
153
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module CookieConsentBanner
|
2
|
+
module Consentable
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :set_cookie_consent_banner
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def set_cookie_consent_banner
|
12
|
+
@show_cookie_consent_banner = cookies[:cookie_preferences].blank?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module CookieConsentBanner
|
2
|
+
class ConsentsController < ApplicationController
|
3
|
+
def new
|
4
|
+
respond_to do |format|
|
5
|
+
format.turbo_stream
|
6
|
+
format.html { redirect_to root_path }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
set_consent_cookie
|
12
|
+
|
13
|
+
respond_to do |format|
|
14
|
+
format.turbo_stream
|
15
|
+
format.html { redirect_to root_path }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def set_consent_cookie
|
21
|
+
case params.require(:consent_type)
|
22
|
+
when "required_only"
|
23
|
+
preferences = [ 0 ]
|
24
|
+
when "accept_all"
|
25
|
+
preferences = (0..CookieConsentBanner.configuration.cookie_buckets.length-1).to_a
|
26
|
+
when "customized"
|
27
|
+
preferences = params.require(:cookie_preferences)
|
28
|
+
end
|
29
|
+
|
30
|
+
cookies[:cookie_preferences] = {
|
31
|
+
value: preferences.join(","),
|
32
|
+
expires: CookieConsentBanner.configuration.cookie_expiration.from_now
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= turbo_stream.remove("cookie-consent-modal") %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module CookieConsentBanner
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace CookieConsentBanner
|
4
|
+
|
5
|
+
initializer :append_locales do |app|
|
6
|
+
locales_path = root.join("config", "locales", "**", "*.yml").to_s
|
7
|
+
I18n.load_path += Dir[locales_path]
|
8
|
+
end
|
9
|
+
|
10
|
+
initializer "cookie_consent_banner.helpers" do
|
11
|
+
ActiveSupport.on_load(:action_controller_base) do
|
12
|
+
helper Turbo::StreamsHelper
|
13
|
+
helper CookieConsentBanner::Helper
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "cookie_consent_banner/version"
|
2
|
+
require "cookie_consent_banner/engine"
|
3
|
+
require "cookie_consent_banner/helper"
|
4
|
+
require "cookie_consent_banner/railtie"
|
5
|
+
require "cookie_consent_banner/configuration"
|
6
|
+
require "turbo-rails"
|
7
|
+
|
8
|
+
|
9
|
+
module CookieConsentBanner
|
10
|
+
class << self
|
11
|
+
attr_accessor :configuration
|
12
|
+
|
13
|
+
def configure
|
14
|
+
self.configuration ||= Configuration.new
|
15
|
+
yield(configuration)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
|
3
|
+
module CookieConsentBanner
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
def copy_initializer
|
9
|
+
template "cookie_consent_banner.rb", "config/initializers/cookie_consent_banner.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_locale
|
13
|
+
copy_file "en.yml", "config/locales/cookie_consent_banner.en.yml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def copy_view
|
17
|
+
copy_file "_modal.html.erb", "app/views/cookie_consent_banner/_modal.html.erb"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
<%= turbo_frame_tag "cookie-consent-modal" do %>
|
2
|
+
<% currentPreferences = cookies[:cookie_preferences] ? cookies[:cookie_preferences] : false %>
|
3
|
+
<%= form_with url: cookie_consent_banner.consents_path, method: :post, local: false, html:{class: "divide-y divide-gray-200 overflow-hidden rounded-lg bg-gray-100 shadow-lg max-w-md fixed left-0 bottom-0 z-999 m-4"} do |f| %>
|
4
|
+
<div class="px-4 py-5 sm:px-6 font-semibold">
|
5
|
+
<%= t("cookie_consent_banner_modal.title") %>
|
6
|
+
</div>
|
7
|
+
<div class="px-4 py-5 sm:p-6">
|
8
|
+
<div><%= t("cookie_consent_banner_modal.description")%></div>
|
9
|
+
<% if t("cookie_consent_banner_modal.categories") %>
|
10
|
+
<dl role="list" class="divide-y divide-gray-200">
|
11
|
+
<% t("cookie_consent_banner_modal.categories").each_with_index do |category, index| %>
|
12
|
+
<li class="flex flex-col">
|
13
|
+
<div class="flex flex-grow items-baseline justify-between text-left gap-x-4 py-2">
|
14
|
+
<div class="group grid size-4 grid-cols-1">
|
15
|
+
<%= check_box_tag "cookie_preferences[]", index, ((currentPreferences && currentPreferences.include?(index.to_s)) ? true : (index === 0) ? true : false), id: "cookie_preferences_#{index}", class: "col-start-1 row-start-1 appearance-none rounded-sm border border-gray-300 bg-white checked:border-blue-600 checked:bg-blue-600 indeterminate:border-blue-600 indeterminate:bg-blue-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:checked:bg-gray-100 forced-colors:appearance-auto" %>
|
16
|
+
<svg viewBox="0 0 14 14" fill="none" class="pointer-events-none col-start-1 row-start-1 size-3.5 self-center justify-self-center stroke-white group-has-disabled:stroke-gray-950/25">
|
17
|
+
<path d="M3 8L6 11L11 3.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="opacity-0 group-has-checked:opacity-100" />
|
18
|
+
<path d="M3 7H11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="opacity-0 group-has-indeterminate:opacity-100" />
|
19
|
+
</svg>
|
20
|
+
</div>
|
21
|
+
<div class="flex flex-col flex-grow">
|
22
|
+
<%= label_tag "cookie_preferences_#{index}", category[1][:name], class: "font-medium text-gray-900 select-none cursor-pointer"%>
|
23
|
+
<div class="font-light text-sm"><%= category[1][:description] %></div>
|
24
|
+
</div>
|
25
|
+
<div>
|
26
|
+
<button type="button" command="--toggle" commandfor="cookie_consent_banner_preferences_<%= index %>" class="flex w-full items-start justify-between text-left text-gray-900">
|
27
|
+
<span class="flex h-7 items-center">
|
28
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-slot="icon" aria-hidden="true" class="size-6 in-aria-expanded:hidden">
|
29
|
+
<path d="M12 6v12m6-6H6" stroke-linecap="round" stroke-linejoin="round" />
|
30
|
+
</svg>
|
31
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-slot="icon" aria-hidden="true" class="size-6 not-in-aria-expanded:hidden">
|
32
|
+
<path d="M18 12H6" stroke-linecap="round" stroke-linejoin="round" />
|
33
|
+
</svg>
|
34
|
+
</span>
|
35
|
+
</button>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<el-disclosure id="cookie_consent_banner_preferences_<%= index %>" hidden class="contents">
|
39
|
+
<dd class="my-2 px-8 text-base/7 text-gray-600 flex flex-col">
|
40
|
+
<% t("cookie_consent_banner_modal.categories.#{category[0]}.cookies").each do |cookie| %>
|
41
|
+
<ul class="divide-y divide-gray-200 text-sm">
|
42
|
+
<li class="grid grid-cols-4">
|
43
|
+
<span class="col-start-1 font-medium"><%= cookie[:name] %></span>
|
44
|
+
<span class="col-start-2 col-span-3 font-light"><%= cookie[:description] %></span>
|
45
|
+
</li>
|
46
|
+
</ul>
|
47
|
+
<% end %>
|
48
|
+
</dd>
|
49
|
+
</el-disclosure
|
50
|
+
</li>
|
51
|
+
<% end %>
|
52
|
+
</dl>
|
53
|
+
<% end %>
|
54
|
+
</div>
|
55
|
+
<div class="px-4 py-4 sm:px-6 flex justify-between">
|
56
|
+
<div>
|
57
|
+
<!-- The submit button value of "customized" will take the cookie values based on the checkboxes. -->
|
58
|
+
<%= f.button t("cookie_consent_banner_modal.buttons.save_preferences"), type: :submit, name: :consent_type, value: :customized, class: "rounded-md px-2.5 py-1.5 text-sm font-semibold text-blue-600 hover:bg-gray-200 hover:outline-1 hover:outline-blue-600 cursor-pointer" %>
|
59
|
+
</div>
|
60
|
+
<div>
|
61
|
+
<!-- The submit button value of "required_only" will set the cookie value to be "0" which is usually the index for the required cookies. -->
|
62
|
+
<%= f.button t("cookie_consent_banner_modal.buttons.necessary"), type: :submit, name: :consent_type, value: :required_only, class: "rounded-md px-2.5 py-1.5 text-sm font-semibold text-blue-600 shadow-xs hover:bg-gray-300 outline-1 outline-blue-600 cursor-pointer" %>
|
63
|
+
<!-- The submit button value of "accept_all" will set the cookie value to be an array of all indexes comma separated which will accept all buckets available. -->
|
64
|
+
<%= f.button t("cookie_consent_banner_modal.buttons.accept_all"), type: :submit, name: :consent_type, value: :accept_all, class: "rounded-md bg-blue-500 px-2.5 py-1.5 text-sm font-semibold text-white shadow-xs hover:bg-blue-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 cursor-pointer" %>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
<% end %>
|
68
|
+
|
69
|
+
<script src="https://cdn.jsdelivr.net/npm/@tailwindplus/elements@1" type="module"></script>
|
70
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# config/locales/cookie_consent_banner_modal.en.yml
|
2
|
+
|
3
|
+
en:
|
4
|
+
cookie_consent_banner_modal:
|
5
|
+
title: "We use cookies"
|
6
|
+
description: "We use cookies to improve your experience on our website. You can choose which types of cookies to allow."
|
7
|
+
categories:
|
8
|
+
essential:
|
9
|
+
name: "Essential"
|
10
|
+
description: "Required for the site to work."
|
11
|
+
cookies:
|
12
|
+
- name: "_session_id"
|
13
|
+
description: "Maintains your session while you browse the site."
|
14
|
+
- name: "csrf_token"
|
15
|
+
description: "Helps prevent cross-site request forgery attacks."
|
16
|
+
analytics:
|
17
|
+
name: "Analytics"
|
18
|
+
description: "Help us understand how you use the site."
|
19
|
+
cookies:
|
20
|
+
- name: "_session_id"
|
21
|
+
description: "Maintains your session while you browse the site."
|
22
|
+
- name: "csrf_token"
|
23
|
+
description: "Helps prevent cross-site request forgery attacks."
|
24
|
+
marketing:
|
25
|
+
name: "Marketing"
|
26
|
+
description: "Personalize ads and content."
|
27
|
+
cookies:
|
28
|
+
- name: "_session_id"
|
29
|
+
description: "Maintains your session while you browse the site."
|
30
|
+
- name: "csrf_token"
|
31
|
+
description: "Helps prevent cross-site request forgery attacks."
|
32
|
+
buttons:
|
33
|
+
necessary: "Necessary Only"
|
34
|
+
accept_all: "Accept All"
|
35
|
+
save_preferences: "Save Preferences"
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cookie_consent_banner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dhairya Gabhawala
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rails
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '7.0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '7.0'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: turbo-rails
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
description: A Rails engine providing cookie consent modal, preferences management,
|
41
|
+
and localization using Turbo Streams.
|
42
|
+
email:
|
43
|
+
- gabhawaladhairya@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/controllers/concerns/cookie_consent_banner/consentable.rb
|
52
|
+
- app/controllers/cookie_consent_banner/application_controller.rb
|
53
|
+
- app/controllers/cookie_consent_banner/consents_controller.rb
|
54
|
+
- app/views/cookie_consent_banner/consents/create.turbo_stream.erb
|
55
|
+
- app/views/cookie_consent_banner/consents/new.turbo_stream.erb
|
56
|
+
- config/routes.rb
|
57
|
+
- lib/cookie_consent_banner.rb
|
58
|
+
- lib/cookie_consent_banner/configuration.rb
|
59
|
+
- lib/cookie_consent_banner/engine.rb
|
60
|
+
- lib/cookie_consent_banner/helper.rb
|
61
|
+
- lib/cookie_consent_banner/railtie.rb
|
62
|
+
- lib/cookie_consent_banner/version.rb
|
63
|
+
- lib/generators/cookie_consent_banner/install_generator.rb
|
64
|
+
- lib/generators/cookie_consent_banner/templates/_modal.html.erb
|
65
|
+
- lib/generators/cookie_consent_banner/templates/cookie_consent_banner.rb
|
66
|
+
- lib/generators/cookie_consent_banner/templates/en.yml
|
67
|
+
homepage: https://www.dhairyagabhawala.com/projects/ruby-gem-cookie-consent-banner
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata:
|
71
|
+
homepage_uri: https://www.dhairyagabhawala.com/projects/ruby-gem-cookie-consent-banner
|
72
|
+
source_code_uri: https://github.com/dhairyagabha/cookie_consent_banner
|
73
|
+
changelog_uri: https://github.com/dhairyagabha/cookie_consent_banner/blob/main/CHANGELOG.md
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubygems_version: 3.6.9
|
89
|
+
specification_version: 4
|
90
|
+
summary: Rails engine for managing cookie consent with Turbo Streams.
|
91
|
+
test_files: []
|