jekyll-theme-drop 0.1.7 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 551aa3cf3e9ea7b098248c27b208696c9f91ef552cfcd2adb22b44d2a4a31586
4
- data.tar.gz: 4c6d77366886d676893448b08a03f50c7362f2c102a62a2655cf22210bc4d2d1
3
+ metadata.gz: dd919f622c27d31afe93bd00ebd3b0785d9cf5ec9f8e6bee001a2680608cc0b3
4
+ data.tar.gz: 8167c84d8dca273313d03dcfbb12650f945a7fd01ad6752b2af26508a9245503
5
5
  SHA512:
6
- metadata.gz: ecbbe58085eb397ada9785ebc3349071a5077fb1e8c154ab45b9c18080f52b539532e1d5cd621a81071a9699218596d7227f4ac68c32d8ff51f7fa5eadb58c0c
7
- data.tar.gz: 98963313465fb06261a454183fc845261f57f352b74e25edb2d595ef72c3392ab87185b7431dc255e1a0a31843ea5d1724197db3e5965277d8806fe8713a9a61
6
+ metadata.gz: 1d7f8ef8922663fd3815c0312b28a84c710b2fc2a9555e145778a2ba6a038d77575350a88b7c461b2ac6f1ffdf83cc17bbbe9da33e97602fa23698287dd070b0
7
+ data.tar.gz: 8c2579863de9a0c48f3bf1a84c67a4be1b5d8a9ed56daf70439f1875c42a9ead8ef59b73276fd6c5a86c22f6c632a5817a63ca9d9eec7a0de6c129fbb11c3528
data/README.md CHANGED
@@ -22,6 +22,10 @@ You can preview the theme [here](https://moodule.github.io/jekyll-theme-drop)
22
22
 
23
23
  > **SEO ready**: sitemap, robots.txt and tags are automatically generated for the website
24
24
 
25
+ > **Light**: svg images, thumbs and lazy loading for raster images, few libraries
26
+
27
+ > **Hardened**: form validation, recaptcha, verified libraries
28
+
25
29
  # Installation
26
30
 
27
31
  Add this line to your Jekyll site's `Gemfile`:
@@ -50,6 +54,11 @@ For those unfamiliar with how Jekyll works, check out [jekyllrb.com](https://jek
50
54
  or read up on just the basics of [front matter](https://jekyllrb.com/docs/frontmatter/), [writing posts](https://jekyllrb.com/docs/posts/),
51
55
  and [creating pages](https://jekyllrb.com/docs/pages/).
52
56
 
57
+ ## Initialization
58
+
59
+ Copy the file `_config.yml` from the theme repository to the root of your website folder tree.
60
+ The following section explains what the settings impact and how to configure `_config.yml` properly.
61
+
53
62
  ## Configuration
54
63
 
55
64
  You can use the following custom parameters in `_config.yml`.
@@ -65,6 +74,12 @@ Social icons will appear for each url your fill in, among `facebook_url` etc.
65
74
  ### Contact
66
75
  Your contact information can be used in contact forms, the footer or anywhere else.
67
76
 
77
+ ### Recaptcha
78
+
79
+ The contact form is validated using [google's recaptcha plugin][recaptcha-documentation].
80
+ First, you need to [sign your website up] to enable the plugin.
81
+ Google will provide you with a **client-side integration key**: copy it to `_config.yml` under `recaptcha.sitekey`.
82
+
68
83
  ## Publication
69
84
 
70
85
  ### On Github Pages
@@ -147,3 +162,5 @@ The theme is available as open source under the terms of the [CC-BY-4.0](LICENSE
147
162
  [cookieconsent]: https://github.com/osano/cookieconsent
148
163
  [html5up]: https://html5up.net/
149
164
  [jekyll-logo]: https://github.com/jekyll/brand
165
+ [recaptcha-documentation]: https://developers.google.com/recaptcha/intro
166
+ [recaptcha-registering]: https://www.google.com/recaptcha/admin
@@ -0,0 +1,13 @@
1
+ {%- assign form_id="contact-form" -%}
2
+ {%- assign name_input_id="contact-name" -%}
3
+ {%- assign email_input_id="contact-email" -%}
4
+ {%- assign message_input_id="contact-message" -%}
5
+ {%- assign submit_input_id="contact-submit-button" -%}
6
+ {%- assign reset_input_id="contact-reset-button" -%}
7
+ {%- assign recaptcha_widget_id="recaptcha-checkbox" -%}
8
+ {%- assign onsubmit_callback="sendContactMessage" -%}
9
+ {%- assign onreset_callback="resetContactForm" -%}
10
+
11
+ {% include contact_form.html form_id=form_id name_input_id=name_input_id email_input_id=email_input_id message_input_id=message_input_id submit_input_id=submit_input_id reset_input_id=reset_input_id recaptcha_widget_id=recaptcha_widget_id onsubmit_callback=onsubmit_callback onreset_callback=onreset_callback %}
12
+
13
+ {% include contact_script.html form_id=form_id name_input_id=name_input_id email_input_id=email_input_id message_input_id=message_input_id submit_input_id=submit_input_id reset_input_id=reset_input_id recaptcha_widget_id=recaptcha_widget_id onsubmit_callback=onsubmit_callback onreset_callback=onreset_callback %}
@@ -0,0 +1,36 @@
1
+ <section>
2
+ <header>
3
+ <h3>Form</h3>
4
+ </header>
5
+ <form id="{{ include.form_id | 'contact-form' }}" method="post" action="#" onsubmit="{{ include.onsubmit_callback | 'sendContactMessage' }}()" onreset="{{ include.onreset_callback | 'resetContactForm' }}()" >
6
+ <div class="row">
7
+ <div class="col-6 col-12-mobile">
8
+ <input class="text" type="text" name="{{ include.name_input_id | 'contact-name' }}" id="{{ include.name_input_id | 'contact-name' }}" value="" placeholder="John Doe" required minlength="4" maxlength="64" />
9
+ </div>
10
+ <div class="col-6 col-12-mobile">
11
+ <input class="text" type="email" name="{{ include.email_input_id | 'contact-email' }}" id="{{ include.email_input_id | 'contact-email' }}" value="" placeholder="johndoe@domain.tld" required minlength="8" maxlength="64" />
12
+ </div>
13
+ <div class="col-12">
14
+ <select name="contact-department" id="contact-department">
15
+ <option value="">Choose a department</option>
16
+ <option value="1">Manufacturing</option>
17
+ <option value="2">Administration</option>
18
+ <option value="3">Support</option>
19
+ </select>
20
+ </div>
21
+ <div class="col-12">
22
+ <input class="text" type="text" name="contact-subject" id="contact-subject" value="" placeholder="Enter your subject" />
23
+ </div>
24
+ <div class="col-12">
25
+ <textarea name="{{ include.message_input_id | 'contact-message' }}" id="{{ include.message_input_id | 'contact-message' }}" placeholder="Enter your message" required minlength="16" maxlength="256" ></textarea>
26
+ </div>
27
+ <div class="col-12">
28
+ <ul class="actions">
29
+ <li><div id="{{ include.recaptcha_widget_id | 'recaptcha-checkbox' }}" ></div></li>
30
+ <li><input type="submit" id="{{ include.submit_input_id | 'contact-submit-button' }}" value="Submit" disabled /></li>
31
+ <li><input type="reset" id="{{ include.reset_input_id | 'contact-reset-button' }}" class="style3" value="Reset" /></li>
32
+ </ul>
33
+ </div>
34
+ </div>
35
+ </form>
36
+ </section>
@@ -0,0 +1,52 @@
1
+ <script type="text/javascript">
2
+ const contactFormElement = document.getElementById("{{ include.form_id | default: 'contact-form' }}");
3
+ const nameInputElement = document.getElementById("{{ include.name_input_id | default: 'contact-name' }}");
4
+ const emailInputElement = document.getElementById("{{ include.email_input_id | default: 'contact-email' }}");
5
+ const messageInputElement = document.getElementById("{{ include.message_input_id | default: 'contact-message' }}");
6
+ const submitInputElement = document.getElementById("{{ include.submit_input_id | default: 'contact-submit-button' }}");
7
+ var recaptchaWidget;
8
+
9
+ const isInputValid = function() {
10
+ return (nameInputElement.checkValidity()
11
+ && emailInputElement.checkValidity()
12
+ && messageInputElement.checkValidity())
13
+ };
14
+
15
+ const isRecaptchaValid = function() {
16
+ var responseToken = grecaptcha.getResponse(recaptchaWidget);
17
+ return true;
18
+ };
19
+
20
+ const disableSubmitInputElement = function (disabled = true) {
21
+ submitInputElement.disabled = disabled;
22
+ }
23
+
24
+ const {{ include.onreset_callback | 'resetContactForm' }} = function() {
25
+ contactFormElement.reset();
26
+ disableSubmitInputElement();
27
+ };
28
+
29
+ const {{ include.onsubmit_callback | 'sendContactMessage()' }} = function() {
30
+ encodeURIComponent(nameInputElement.value);
31
+ encodeURIComponent(emailInputElement.value);
32
+ encodeURIComponent(messageInputElement.value);
33
+ };
34
+
35
+ var onloadCallback = function() {
36
+ var verifyForm = function(response) {
37
+ if (isInputValid() && isRecaptchaValid()) {
38
+ disableSubmitInputElement(false);
39
+ } else {
40
+ disableSubmitInputElement();
41
+ }
42
+ };
43
+ recaptchaWidget = grecaptcha.render('{{ include.recaptcha_widget_id | 'recaptcha-checkbox' }}', {
44
+ 'sitekey' : '{{ site.recaptcha.sitekey }}',
45
+ 'theme' : 'dark',
46
+ 'callback' : verifyForm,
47
+ 'expired-callback': disableSubmitInputElement,
48
+ 'size' : 'compact'
49
+ });
50
+ };
51
+ </script>
52
+ <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
@@ -17,8 +17,6 @@
17
17
 
18
18
  <body class="is-preload">
19
19
 
20
- {% include header.html %}
21
-
22
20
  {{ content }}
23
21
 
24
22
  {% include footer.html %}
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  layout: default
3
3
  ---
4
+ {% include header.html %}
5
+
4
6
  {% include banner.html %}
5
7
 
6
8
  {{ content }}
@@ -1,4 +1,4 @@
1
1
  ---
2
- layout: defaut
2
+ layout: default
3
3
  ---
4
4
  {{ content }}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-drop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Mougeolle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -63,6 +63,9 @@ files:
63
63
  - README.md
64
64
  - _includes/banner.html
65
65
  - _includes/bouncing.svg
66
+ - _includes/contact.html
67
+ - _includes/contact_form.html
68
+ - _includes/contact_script.html
66
69
  - _includes/date.html
67
70
  - _includes/footer.html
68
71
  - _includes/head.html