From 9edcbc89cd228f44c7365c8cff7d1aab20daa9e6 Mon Sep 17 00:00:00 2001 From: David Darnes Date: Sun, 2 Sep 2018 12:53:50 +0100 Subject: [PATCH 1/4] Cater form for optional usage with Netlify Forms --- _includes/site-form.html | 66 ++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/_includes/site-form.html b/_includes/site-form.html index b99745b6b..d5374bf29 100644 --- a/_includes/site-form.html +++ b/_includes/site-form.html @@ -1,27 +1,53 @@ -
-
- - +{% if include.name %} + {% assign name = include.name %} +{% else %} + {% assign name = "Contact" %} +{% endif %} - - +{% assign name_id = name | downcase | replace: " ", "-" %} - - +{% if include.thanks_url %} + {% assign thanks_url = include.thanks_url %} +{% else %} + {% assign thanks_url = "/thanks/" %} +{% endif %} + + +
+ {{ name }} + + + + + + + +
* indicates a required field - - - - -
- - + {% if include.netlify_form %} + + {% else %} + + + + {% endif %} + + +{% unless include.netlify_form %} + + +{% endunless %} From d8a97c379e876efa8df0b4a5782f06f69a65d37f Mon Sep 17 00:00:00 2001 From: David Darnes Date: Sun, 2 Sep 2018 12:54:20 +0100 Subject: [PATCH 2/4] Spacing below forms, hide new legend element --- _sass/_theme.scss | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/_sass/_theme.scss b/_sass/_theme.scss index 21a101dd6..9bb68d1bb 100644 --- a/_sass/_theme.scss +++ b/_sass/_theme.scss @@ -260,7 +260,8 @@ img { .figure, .video, -.map { +.map, +.form { margin-bottom: .8rem; } @@ -271,6 +272,18 @@ video { // Form elements and buttons +.form { + position: relative; + &__legend { + font-style: italic; + color: $captionColour; + position: absolute; + overflow: hidden; + right: 0; + clip: rect(0 0 0 0); + } +} + button, .button, input[type="text"], From 77b71aabdf5895efd97cf3e69e97ab200491b0ef Mon Sep 17 00:00:00 2001 From: David Darnes Date: Sun, 2 Sep 2018 12:54:37 +0100 Subject: [PATCH 3/4] Document new form include options --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88d689a8e..dfd6964de 100644 --- a/README.md +++ b/README.md @@ -219,11 +219,16 @@ Available options: - `id`: The map ID for the video _required_ ### `site-form.html` -Adds a contact form to the page. +Adds a contact form to the page. This can be used with [Formspree](https://formspree.io/) or [Netlify Forms](https://www.netlify.com/docs/form-handling/) depending on your setup. Example usage: `{% include site-form.html %}` -This include has no options. Use the `email` option in the `/_config.yml` to change to the desired email. +Available options: +- `netlify_form=true`: Set whether you would like to use Netlify Forms, otherwise the form will default to Formspree +- `name`: Give the form a name, by default the form is called "Contact". The name will be reflected when form submissions come through in Netlify or in your email client. The name is also used in the label and input elements for accessibility + + +Use the `email` option in the `/_config.yml` to change to the desired email. ### `site-search.html` Adds a search form to the page. From 3314e4b286df95a08d9c48cb21b0f2c2691f8832 Mon Sep 17 00:00:00 2001 From: David Darnes Date: Sun, 2 Sep 2018 12:56:31 +0100 Subject: [PATCH 4/4] Add Netlify Forms option to features list --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfd6964de..340d7fff8 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ - Modular Jekyll components - Post category support in the form of a single post index page grouped by category - Built in live search using JavaScript -- **Contact form** built in using [Formspree](https://formspree.io/) +- **Contact form** built in using [Formspree](https://formspree.io/) or [Netlify Forms](https://www.netlify.com/features/#forms) - Designed with **[Siteleaf](http://www.siteleaf.com/)** in mind - Has 9 of the most popular networks as performant sharing buttons - Has documentation