Skip to content

Commit

Permalink
removing customised Formspree POST URL handling from the contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
Szasza committed Nov 13, 2020
1 parent eb206a0 commit 84c04e2
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion assets/js/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const validatorConfig = {
);
},
onSuccess: function(e, form) {
if (form.dataset.hasNetlify || form.dataset.hasFormspree) {
if (form.dataset.hasNetlify) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/syna-contact.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions exampleSite/content/dev/blog/_global/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ form_name = "defaultContact"
title = "Comment using the Contact fragment"
subtitle = "*not working on demo page*"

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/colors/dev-contact/contact-dark.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/colors/dev-contact/contact-light.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/colors/dev-contact/contact-primary.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/colors/dev-contact/contact-white.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/contact/contact-netlify.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ form_name = "contact-form-netlify"
title = "Contact fragment with Netlify support"
subtitle = "*not working on demo page*"

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
netlify = true
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/contact/contact-recaptcha.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ form_name = "contact-form-recaptcha"
title = "Contact fragment with ReCaptcha support"
subtitle = "*not working on demo page*"

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/contact/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ form_name = "contact-form"
title = "Contact fragment"
subtitle = "*not working on demo page*"

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/dev/events/payment/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/fragments/contact/code-contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center
# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/fragments/contact/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title = "Contact fragment"
subtitle = "*not working on demo page*"
#title_align = "left" # Default is center, can be left, right or center

# PostURL can be used with backends such as mailout from caddy
post_url = "https://example.com/mailout" #default: formspree.io
# PostURL can be used with backends such as formspree, or mailout from caddy
post_url = "https://example.com/mailout"
email = "[email protected]"
button_text = "Send Button" # defaults to theme default
#netlify = false
Expand Down
2 changes: 0 additions & 2 deletions exampleSite/content/fragments/contact/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ Unique name for the form used to identify the form in scripts and on the page.

#### post_url
*type: string*
*default: formspree.io*
*Requires email to be set*

URL to your own backend or a service you are using.

Expand Down
3 changes: 1 addition & 2 deletions exampleSite/content/fragments/contact/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Contact fragment renders a form with a maximum of 4 fields:

This fragment supports validations and thus can have customized error messages.
Recaptcha and Netlify (with Netlify auto Recaptcha) support is also available.
With a [Formspree](https://formspree.io) account you can simply enter your
email. Other options are using a custom server or other form submission handlers
Other options are using a custom server or other form submission handlers such as [Formspree](https://formspree.io).
7 changes: 2 additions & 5 deletions layouts/partials/fragments/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
{{- if .Params.netlify -}}
{{- safeHTMLAttr (print " data-has-netlify=\"true\" netlify") -}}
{{- else -}}
{{- safeHTMLAttr (printf " action=\"%s\"" (.Params.post_url | default (printf "https://formspree.io/%s" .Params.email))) -}}
{{- end -}}
{{- if and (isset .Params "email") -}}
{{- safeHTMLAttr (print " data-has-formspree=\"true\"") -}}
{{- end }}>
{{- safeHTMLAttr (printf " action=\"%s\"" .Params.post_url) -}}
{{- end -}}>
<div class="row py-3 should-fade">
<div class="col-md-6">
{{- with .Params.fields.name }}
Expand Down

0 comments on commit 84c04e2

Please sign in to comment.