diff options
author | it-gro <13005925+it-gro@users.noreply.github.com> | 2021-06-14 17:44:42 +0300 |
---|---|---|
committer | it-gro <13005925+it-gro@users.noreply.github.com> | 2021-06-14 17:44:42 +0300 |
commit | 4419bf88c71bf2a7f6318274ede07a5babf2a2ac (patch) | |
tree | 406a5ded53b8d95d6b63e5a3c1cc6174eb718178 | |
parent | 8bd9edcd003a085e1d5753dc1a2b2e98b7767e75 (diff) |
Upgrade Formspree to new form url
-rw-r--r-- | layouts/contact/single.html | 2 | ||||
-rw-r--r-- | layouts/partials/contact.form.html | 12 | ||||
-rw-r--r-- | layouts/partials/contact.form.old.html | 35 |
3 files changed, 45 insertions, 4 deletions
diff --git a/layouts/contact/single.html b/layouts/contact/single.html index b1f26a5..3816e87 100644 --- a/layouts/contact/single.html +++ b/layouts/contact/single.html @@ -3,5 +3,5 @@ {{- `<!-- contact/single.html (contactform) -->` | safeHTML }} {{- end}} {{ partial `contact.form.html` . }} - {{ partial `contact.map.html` . }} + {{/* partial `contact.map.html` . */}} {{ end }} diff --git a/layouts/partials/contact.form.html b/layouts/partials/contact.form.html index d1d516d..2590dcc 100644 --- a/layouts/partials/contact.form.html +++ b/layouts/partials/contact.form.html @@ -11,11 +11,14 @@ {{- .Scratch.Set `myMailToEnctype` `text/plain` }} {{- if isset $.Site.Params (lower `formspree` ) }} {{ `<!-- $.Site.Params.formspree ok -->` | safeHTML }} - {{- .Scratch.Set `myFormspreeAction` (printf `https://%s/%s` $.Site.Params.formspree $.Site.Params.email) }} + {{- .Scratch.Set `myFormspreeAction` (printf `https://%s/%s` $.Site.Params.formspreeAction $.Site.Params.formspreForm) }} {{- .Scratch.Set `myFormspreeVia` (printf `https://%s` $.Site.Params.formspree ) }} {{- .Scratch.Set `myFormspreeEnctype` `application/x-www-form-urlencoded` }} {{- end }} <!-- if isset --> -<form class='w3-panel w3-card-4 {{ default `w3-theme-d3` ($.Site.Param `colorContactFormPanel`)}} ' method="post" > +<form class='w3-panel w3-card-4 {{ default `w3-theme-d3` ($.Site.Param `colorContactFormPanel`)}} ' + method="post" + action='{{.Scratch.Get `myFormspreeAction`}}' + > {{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }} {{ `<!-- i18n "contactForm" "contactName" "contactMail" "contactMessage" "contactSend" "contactVia" -->` | safeHTML }} {{- end}} @@ -27,7 +30,10 @@ <p><label>{{ default `Message` (i18n `contactMessage`) }} </label> <textarea class="w3-input w3-border" name="message" required placeholder="Message" ></textarea></p> <p><button class="w3-button" type="submit" formaction='{{.Scratch.Get `myMailToAction`}}' formenctype='{{.Scratch.Get `myMailToEnctype`}}' ><i class="fas fa-at"></i> {{ i18n `contactSend` }} <span class="w3-small">({{ default `via` (i18n `contactVia`) }} {{.Scratch.Get `myMailToVia`}})</span></button> {{- if .Scratch.Get `myFormspreeAction` }} - <button class="w3-button" type="submit" formaction='{{.Scratch.Get `myFormspreeAction`}}' formenctype='{{.Scratch.Get `myFormspreeEnctype`}}' ><i class="far fa-envelope"></i> {{ i18n `contactSend` }} <span class="w3-small">({{ default `via` (i18n `contactVia`) }} {{.Scratch.Get `myFormspreeVia`}})</span></button> + <button class="w3-button" type="submit"> + <i class="far fa-envelope"></i> {{ i18n `contactSend` }} + <span class="w3-small">({{ default `via` (i18n `contactVia`) }} {{.Scratch.Get `myFormspreeVia`}})</span> + </button> {{- end }} </form> diff --git a/layouts/partials/contact.form.old.html b/layouts/partials/contact.form.old.html new file mode 100644 index 0000000..d1d516d --- /dev/null +++ b/layouts/partials/contact.form.old.html @@ -0,0 +1,35 @@ +{{- if or .Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }} + {{ `<!-- partials/contact.form.html -->` | safeHTML }} +{{- end}} +{{- if isset $.Site.Params (lower `email` ) }} +{{- if $.Site.Params.email }} +{{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }} + {{ `<!-- $.Site.Params.email ok -->` | safeHTML }} +{{- end}} +{{- .Scratch.Set `myMailToAction` (printf `mailto:%s` $.Site.Params.email) }} +{{- .Scratch.Set `myMailToVia` `mail` }} +{{- .Scratch.Set `myMailToEnctype` `text/plain` }} +{{- if isset $.Site.Params (lower `formspree` ) }} +{{ `<!-- $.Site.Params.formspree ok -->` | safeHTML }} + {{- .Scratch.Set `myFormspreeAction` (printf `https://%s/%s` $.Site.Params.formspree $.Site.Params.email) }} + {{- .Scratch.Set `myFormspreeVia` (printf `https://%s` $.Site.Params.formspree ) }} + {{- .Scratch.Set `myFormspreeEnctype` `application/x-www-form-urlencoded` }} +{{- end }} <!-- if isset --> +<form class='w3-panel w3-card-4 {{ default `w3-theme-d3` ($.Site.Param `colorContactFormPanel`)}} ' method="post" > +{{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }} + {{ `<!-- i18n "contactForm" "contactName" "contactMail" "contactMessage" "contactSend" "contactVia" -->` | safeHTML }} +{{- end}} + {{- /* <h3> {{ default `Contact` (i18n `contactForm` ) }}</h3> */}} {{/* toc on contact page */}} + <p><label>{{ default `Name` (i18n `contactName` ) }} </label> <input class="w3-input w3-border" name="name" type="text" required placeholder="Name" ></p> + {{- if $.Site.Params.contactFormInclEmail }} + <p><label>{{ default `Mail` (i18n `contactMail` ) }} </label> <input class="w3-input w3-border" name="email" type="text" required placeholder="Mail" ></p> + {{- end }} + <p><label>{{ default `Message` (i18n `contactMessage`) }} </label> <textarea class="w3-input w3-border" name="message" required placeholder="Message" ></textarea></p> + <p><button class="w3-button" type="submit" formaction='{{.Scratch.Get `myMailToAction`}}' formenctype='{{.Scratch.Get `myMailToEnctype`}}' ><i class="fas fa-at"></i> {{ i18n `contactSend` }} <span class="w3-small">({{ default `via` (i18n `contactVia`) }} {{.Scratch.Get `myMailToVia`}})</span></button> + {{- if .Scratch.Get `myFormspreeAction` }} + <button class="w3-button" type="submit" formaction='{{.Scratch.Get `myFormspreeAction`}}' formenctype='{{.Scratch.Get `myFormspreeEnctype`}}' ><i class="far fa-envelope"></i> {{ i18n `contactSend` }} <span class="w3-small">({{ default `via` (i18n `contactVia`) }} {{.Scratch.Get `myFormspreeVia`}})</span></button> + {{- end }} +</form> + +{{- end }} <!-- $.Site.Params.email --> +{{- end }} <!-- if isset email --> |