immosquare-cookies 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f3239571812c77453f881005fee3e3d0fe141fe8e95bd6872305d165bbde5db5
4
+ data.tar.gz: 4010bc82fb093844a1b50970ea5c87d9a68089576b40045178c7403aa5473807
5
+ SHA512:
6
+ metadata.gz: 52175f7ef11efcda43f706ee6205b5d209f63d0eb52df181846f08e3c61e0fab1c322a4bb67421805eaca021244fa97396672182303eb0b6a0375e53be459a18
7
+ data.tar.gz: 457db3e1b752edad04ee934012f7a01bb993dcea6b6e81670f51a2ec3394297eaeaf4bb37e0d1ad7d06d074775830425645b50dc764b491a6e5da330511a10c8
@@ -0,0 +1,98 @@
1
+ #immosquare-cookies-container {
2
+ --immmosquare-cookies-height: 33vh;
3
+ --immosquare-cookies-bg-color: #f1f1f1;
4
+ --immosquare-cookies-border-color: #cccccc;
5
+ --immosquare-cookies-border-align: center;
6
+ --immosquare-cookies-btn-color: white;
7
+ --immosquare-cookies-btn-bg-color: green;
8
+
9
+ @keyframes immosquare-cookies-effect {
10
+ 33% {
11
+ transform: translateX(5px);
12
+ }
13
+
14
+ 66% {
15
+ transform: translateX(-5px);
16
+ }
17
+
18
+ 100% {
19
+ transform: translateX(0);
20
+ }
21
+ }
22
+
23
+ position: fixed;
24
+ z-index: 1000000;
25
+ left: 0;
26
+ bottom: 0;
27
+ width: 100%;
28
+ height: var(--immmosquare-cookies-height);
29
+ min-height: 200px;
30
+ background-color: var(--immosquare-cookies-bg-color);
31
+ border-top: 1px solid var(--immosquare-cookies-border-color);
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: var(--immosquare-cookies-border-align);
35
+ padding: 1rem 3rem;
36
+ #immosquare-cookies-title {
37
+ font-size: 1.5rem;
38
+ font-weight: bold;
39
+ margin-bottom: 1rem;
40
+ }
41
+ #immosquare-cookies-refuse {
42
+ text-decoration: underline;
43
+ cursor: pointer;
44
+ &:hover {
45
+ animation: immosquare-cookies-effect 0.5s 1;
46
+ }
47
+ }
48
+ #immosquare-cookies-accept {
49
+ display: inline-block;
50
+ color: var(--immosquare-cookies-btn-color);
51
+ background-color: var(--immosquare-cookies-btn-bg-color);
52
+ border-radius: 2rem;
53
+ cursor: pointer;
54
+ padding: 20px;
55
+ &:hover {
56
+ animation: immosquare-cookies-effect 0.5s 1;
57
+ }
58
+ }
59
+ #immosquare-cookies-actions {
60
+ margin-top: 20px;
61
+ margin-bottom: 20px;
62
+ display: flex;
63
+ justify-content: center;
64
+ align-items: center;
65
+ gap: 20px;
66
+ }
67
+ section {
68
+ text-align: center;
69
+ height: 100%;
70
+ width: 100%;
71
+ overflow-y: auto;
72
+ }
73
+ @media (max-width: 575.98px) {
74
+ section {
75
+ max-width: none;
76
+ }
77
+ }
78
+ @media (min-width: 576px) and (max-width: 767.98px) {
79
+ section {
80
+ max-width: 540px;
81
+ }
82
+ }
83
+ @media (min-width: 768px) and (max-width: 991.98px) {
84
+ section {
85
+ max-width: 720px;
86
+ }
87
+ }
88
+ @media (min-width: 992px) and (max-width: 1199.98px) {
89
+ section {
90
+ max-width: 960px;
91
+ }
92
+ }
93
+ @media (min-width: 1200px) {
94
+ section {
95
+ max-width: 1140px;
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,39 @@
1
+ <% cookie_name = defined?(key) ? key : "_immosquare_consented" %>
2
+
3
+ <%# DIV %>
4
+ <%= content_tag(:div, :id => "immosquare-cookies-container", :data => {:name => cookie_name} ) do %>
5
+ <section>
6
+ <%# Title %>
7
+ <%= content_tag(:div, defined?(document_name) ? document_name : t("immosquare-cookies.document_name"), :id => "immosquare-cookies-title") %>
8
+
9
+ <%# Refuse/Accept %>
10
+ <div id="immosquare-cookies-actions">
11
+ <%= content_tag(:div, defined?(refuse) ? refuse : t("immosquare-cookies.refuse"), :id => "immosquare-cookies-refuse") %>
12
+ <%= content_tag(:div, defined?(accept) ? accept : t("immosquare-cookies.accept"), :id => "immosquare-cookies-accept") %>
13
+ </div>
14
+
15
+ <%# Content %>
16
+ <div>
17
+ <%= content_tag(:span, defined?(text).present? ? text : t("immosquare-cookies.text")) %>
18
+ <% if defined?(link) %>
19
+ <%= content_tag(:span, defined?(link_text) ? link_text : t("immosquare-cookies.link_text"), :style => "margin-right:4px;") %>
20
+ <%= link_to( defined?(document_name) ? document_name : t("immosquare-cookies.document_name"), link, :target => defined?(target) ? target : "_blank") %>
21
+ <% end %>
22
+ </div>
23
+ </section>
24
+ <script>
25
+ document.addEventListener("DOMContentLoaded", function() {
26
+ const cookieContainer = document.getElementById("immosquare-cookies-container");
27
+ const cookieName = cookieContainer.dataset.name;
28
+ const handleCookieConsent = (consentGiven) => {
29
+ cookieContainer.style.display = "none";
30
+ const date = new Date();
31
+ date.setTime(date.getTime() + (365 * 10 * 24 * 60 * 60 * 1000));
32
+ const expires = `;expires=${date.toUTCString()}`;
33
+ document.cookie = `${cookieName}=${consentGiven}${expires}; path=/`;
34
+ };
35
+ document.getElementById("immosquare-cookies-refuse").addEventListener("click", function() { handleCookieConsent(false); });
36
+ document.getElementById("immosquare-cookies-accept").addEventListener("click", function() { handleCookieConsent(true); });
37
+ });
38
+ </script>
39
+ <% end if cookies && cookies[cookie_name].blank? %>
@@ -0,0 +1,8 @@
1
+ fr:
2
+ immosquare-cookies:
3
+ document_name: "Politique de confidentialité."
4
+ text: "Nous et nos partenaires technologiques utilisons des cookies ou des traceurs pour stocker et accéder à des informations sur votre appareil. Ces données nous aident à améliorer votre expérience utilisateur, à mesurer l'audience de notre site, et à faciliter l'interaction avec les réseaux sociaux. En poursuivant votre navigation, vous acceptez l'utilisation de ces traceurs. Si vous n'acceptez pas, certaines fonctionnalités du site pourraient ne pas opérer comme prévu. Vous pouvez modifier vos préférences à tout moment via les paramètres de votre navigateur ou sur notre site."
5
+ link_text: "Plus d'informations :"
6
+ refuse: "Refuser"
7
+ accept: "Accepter"
8
+
@@ -0,0 +1,5 @@
1
+ module ImmosquareCookies
2
+ class Engine < ::Rails::Engine
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ImmosquareCookies
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,6 @@
1
+ require "immosquare-cookies/engine"
2
+
3
+
4
+ module ImmosquareCookies
5
+
6
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: immosquare-cookies
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - IMMO SQUARE
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-09-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Immosquare Cookies Consent Banner allows Rails developers to effortlessly
14
+ integrate a GDPR-compliant cookie consent prompt into their web applications. With
15
+ built-in internationalization support and options to customize the banner's appearance
16
+ and text, it offers a flexible and user-friendly solution for obtaining user consent.
17
+ email:
18
+ - jules@immosquare.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - app/assets/stylesheets/immosquare-cookies.scss
24
+ - app/views/immosquare-cookies/_consent_banner.html.erb
25
+ - config/locales/immosquare-cookies.fr.yml
26
+ - lib/immosquare-cookies.rb
27
+ - lib/immosquare-cookies/engine.rb
28
+ - lib/immosquare-cookies/version.rb
29
+ homepage: https://github.com/IMMOSQUARE/immosquare-cookies
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 2.6.0
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.4.13
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: A customizable cookie consent banner for Rails applications.
52
+ test_files: []