middleman-gdpr 0.1.0 → 0.2.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 +4 -4
- data/README.md +8 -1
- data/lib/middleman-gdpr/extension.rb +23 -16
- data/lib/middleman-gdpr/version.rb +1 -1
- data/source/gdpr/_cookie_consent.html.erb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be520ef04f3b04c32e8c4b7016e2066c9ebd7260bb20ce84c23dea7334345cb3
|
4
|
+
data.tar.gz: 33fb71074ba4b54234b98619d7b62f09dc8afbc047ba8f8e628a4c461a16e13b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba6f87b7f5edcf4f07eab964bc8ab6714d351aa0d615d031d5b70cdc24832dfcbab49284b37229656d7a0b2d3ef913f3ed3f59f551c2e6627842f5e471e2877d
|
7
|
+
data.tar.gz: 9883c6af14e9355467cbf38e7cb203cb169cf7deca90fde4c6211d51c1f1ee94d512dfd2cefccbe7659d7e982ac24e9f9e7919d58bb4fcadceb73439de6b86f8
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ activate :i18n
|
|
27
27
|
|
28
28
|
Add this to the layout:
|
29
29
|
```ruby
|
30
|
-
<%= gdpr %>
|
30
|
+
<%= gdpr :cookie_consent %>
|
31
31
|
```
|
32
32
|
|
33
33
|
Add this to javascripts:
|
@@ -40,6 +40,13 @@ Add this to stylesheets:
|
|
40
40
|
@import 'gdpr/cookie_consent'
|
41
41
|
```
|
42
42
|
|
43
|
+
If your site isn't localized but you want gdpr messages to be in a given language (default: English), just add the corresponding option when activating I18n:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# config.rb
|
47
|
+
activate :i18n, langs: [:fr]
|
48
|
+
```
|
49
|
+
|
43
50
|
Set the privacy policy url in the locales.
|
44
51
|
|
45
52
|
## Checklist
|
@@ -6,8 +6,8 @@ module Middleman
|
|
6
6
|
# end
|
7
7
|
|
8
8
|
def after_configuration
|
9
|
-
puts "\e[91mGDPR: Sprockets extension not found, GDPR extension has not been activated\e[39m" and return if sprockets.blank?
|
10
|
-
puts "\e[91mGDPR: I18n extension not found, GDPR extension has not been activated\e[39m" and return if i18n.blank?
|
9
|
+
puts "\e[91mGDPR: Sprockets extension not found, GDPR extension has not been activated. Please activate Sprockets in config.rb:\nactivate :sprockets\e[39m\n" and return if sprockets.blank?
|
10
|
+
puts "\e[91mGDPR: I18n extension not found, GDPR extension has not been activated. Please activate I18n in config.rb:\nactivate :i18n\e[39m\n" and return if i18n.blank?
|
11
11
|
|
12
12
|
['source/stylesheets', 'source/javascripts', 'node_modules'].each do |path|
|
13
13
|
sprockets.environment.append_path root + path
|
@@ -17,23 +17,30 @@ module Middleman
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def root
|
20
|
-
|
20
|
+
self.class.root
|
21
21
|
end
|
22
22
|
|
23
23
|
helpers do
|
24
|
-
def gdpr
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
24
|
+
def gdpr(partial)
|
25
|
+
template = Middleman::Gdpr::Extension.template_for partial
|
26
|
+
raise "GDPR: \"#{partial}\" partial doesn't exist" if template.blank?
|
27
|
+
return ERB.new(template).result binding
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def root
|
33
|
+
Pathname.new(__dir__) + '../..'
|
34
|
+
end
|
35
|
+
|
36
|
+
def template_for(partial)
|
37
|
+
partial = File.basename(partial.to_s)
|
38
|
+
.sub(/\A_/, '')
|
39
|
+
.sub(/\.(html|erb|html\.erb)\z/, '')
|
40
|
+
|
41
|
+
path = root + "source/gdpr/_#{partial}.html.erb"
|
42
|
+
|
43
|
+
return File.read path if File.exists? path
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="gdpr__cookie_consent js-gdpr__cookie_consent">
|
2
|
+
<div class="gdpr__cookie_consent__text">
|
3
|
+
<%= t 'gdpr.cookie_consent.text' %>
|
4
|
+
<br />
|
5
|
+
<%= t 'gdpr.cookie_consent.learn_more_html', link: t('gdpr.privacy_policy') %>
|
6
|
+
</div>
|
7
|
+
<div class="gdpr__cookie_consent__buttons">
|
8
|
+
<button class="gdpr__cookie_consent__buttons__ok js-gdpr__cookie_consent__buttons__ok"> <%= t 'gdpr.cookie_consent.button' %></button>
|
9
|
+
</div>
|
10
|
+
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-gdpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Levy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-07-
|
13
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- node_modules/js-cookie/SERVER_SIDE.md
|
83
83
|
- node_modules/js-cookie/package.json
|
84
84
|
- node_modules/js-cookie/src/js.cookie.js
|
85
|
+
- source/gdpr/_cookie_consent.html.erb
|
85
86
|
- source/javascripts/gdpr/cookie_consent.js
|
86
87
|
- source/stylesheets/gdpr/cookie_consent.sass
|
87
88
|
homepage: https://github.com/lespoupeesrusses/middleman-gdpr
|