Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/devcows/hugo-universal-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/partials/contact.html2
-rw-r--r--static/js/front.js7
4 files changed, 8 insertions, 5 deletions
diff --git a/README.md b/README.md
index 6c2cc43..3d3db9d 100644
--- a/README.md
+++ b/README.md
@@ -140,11 +140,12 @@ You can optionally add the google maps widget defining latitude and longitude in
Since this Hugo sites are static, the contact form uses [Formspree](https://formspree.io/) as a proxy. The form makes a POST request to their servers to send the actual email. Visitors can send up to a 1000 emails each month for free.
-To enable the form in the contact page, just type your Formspree email in the `config.toml` file.
+To enable the form in the contact page, just type your Formspree email in the `config.toml` file, and specify whether to use ajax(paid) to send request or plain HTTP POST(free).
```yaml
[params]
email = "your@email.com"
+contact_form_ajax = false
```
### Menu
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 0d53d69..6653731 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -90,6 +90,7 @@ paginate = 10
#
# Enable the contact form by entering your Formspree.io email
email = "your@email.com"
+ contact_form_ajax = false
about_us = "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>"
copyright = "Copyright (c) 2015 - 2016, YourCompany; all rights reserved."
diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html
index af97f15..96c89f0 100644
--- a/layouts/partials/contact.html
+++ b/layouts/partials/contact.html
@@ -15,7 +15,7 @@
<div id="contact-message"></div>
- <form class="contact-form" method="post" action="https://formspree.io/{{ .Site.Params.email }}">
+ <form {{ with .Site.Params.contact_form_ajax }}class="contact-form-ajax"{{ else }}{{ end }} method="post" action="https://formspree.io/{{ .Site.Params.email }}">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
diff --git a/static/js/front.js b/static/js/front.js
index 9e62ae7..14ee525 100644
--- a/static/js/front.js
+++ b/static/js/front.js
@@ -19,12 +19,13 @@ $(function () {
animations()
counters()
demo()
- contactForm()
+ contactFormAjax()
})
// Ajax contact
-function contactForm () {
- var form = $('.contact-form')
+function contactFormAjax () {
+ var form = $('.contact-form-ajax')
+ if (typeof form === 'undefined') return false
form.submit(function () {
$this = $(this)
$.post($(this).attr('action'),