Permalink
Browse files

Update contact page

  • Loading branch information...
mgrachev committed Jan 6, 2016
1 parent 6a3051a commit 541052a9363aeb1bfc4a4b4372941ae1bf1fb037
Showing with 21 additions and 12 deletions.
  1. +10 −0 _config.yml
  2. +3 −3 _includes/ajaxify_content_form.html
  3. +7 −8 contact.html
  4. +1 −1 thanks.md
View
@@ -77,6 +77,16 @@ text:
related_posts: 'Related Posts'
index:
coming_soon: 'Coming soon...'
contact:
email: 'Email Address'
content: 'What would you like to say?'
subject: 'New submission!'
submit: 'Say Hello'
ajax:
sending: 'sending..'
sent: 'Message sent!'
error: 'Error!'
thanks: 'Thanks for contacting us. We will reply as soon as possible.'
# Build settings
@@ -7,7 +7,7 @@
sendButton.addEventListener('click', function(event){
event.preventDefault();
sendButton.innerHTML = 'sending..';
sendButton.innerHTML = '{{ site.text.contact.ajax.sending }}';
var xhr = new XMLHttpRequest();
xhr.open('POST', '//formspree.io/{{ site.email }}', true);
@@ -20,10 +20,10 @@
xhr.onloadend = function (res) {
if (res.target.status === 200){
sendButton.innerHTML = 'Message sent!';
sendButton.innerHTML = '{{ site.text.contact.ajax.sent }}';
}
else {
sendButton.innerHTML = 'Error!';
sendButton.innerHTML = '{{ site.text.contact.ajax.error }}';
}
}
});
View
@@ -8,20 +8,19 @@
<div class="py2">
{% if site.ajaxify_contact_form %}
<form class="form-stacked">
<input type="text" name="email" class="field-light" placeholder="Email Address">
<textarea type="text" name="content" class="field-light" rows="5" placeholder="What would you like to say?"></textarea>
<input type="hidden" name="_subject" value="New submission!" />
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email }}">
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content }}"></textarea>
<input type="text" name="_gotcha" style="display:none" />
<button type='submit' class="button button-blue button-big mobile-block">Say Hello</button>
<button type='submit' class="button button-blue button-big mobile-block">{{ site.text.contact.submit }}</button>
</form>
{% else %}
<form action="https://formspree.io/{{ site.email }}" method="POST" class="form-stacked">
<input type="text" name="email" class="field-light" placeholder="Email Address">
<textarea type="text" name="content" class="field-light" rows="5" placeholder="What would you like to say?"></textarea>
<input type="text" name="email" class="field-light" placeholder="{{ site.text.contact.email }}">
<textarea type="text" name="content" class="field-light" rows="5" placeholder="{{ site.text.contact.content }}"></textarea>
<input type="hidden" name="_next" value="{{ site.baseurl }}/thanks/" />
<input type="hidden" name="_subject" value="New submission!" />
<input type="hidden" name="_subject" value="{{ site.text.contact.subject }}" />
<input type="text" name="_gotcha" style="display:none" />
<input type="submit" class="button button-blue button-big mobile-block" value="Say Hello">
<input type="submit" class="button button-blue button-big mobile-block" value="{{ site.text.contact.submit }}">
</form>
{% endif %}
</div>
View
@@ -3,4 +3,4 @@ layout: page
title: Thanks For Your Message
permalink: /thanks/
---
Thanks for contacting us. We will reply as soon as possible.
{{ site.text.thanks }}

0 comments on commit 541052a

Please sign in to comment.