Skip to content

Instantly share code, notes, and snippets.

@rdallaire
Created November 1, 2012 16:37
Show Gist options
  • Save rdallaire/3994892 to your computer and use it in GitHub Desktop.
Save rdallaire/3994892 to your computer and use it in GitHub Desktop.
CC - Add contact form to About_us
{% unless page.title == "Homepage" %}
<h1 class="pagetitle">{{ page.title }}</h1>
{% endunless %}
{{ page.content }}
{% if site.pagename == "about_us"%}
<h1>Contact Us</h1>
{% if contact_us.success? %}
<h2>{{ "contact_us.success_message" | trans }}</h2>
<p>{{ "contact_us.get_back_to_you" | trans }}</p>
{% endif %}
{% if contact_us.errors? %}
<h2>{{ "contact_us.errors.message" | trans }}</h2>
{% if contact_us.email_invalid? %}
<p>{{ "contact_us.errors.email_invalid" | trans }}</p>
{% endif %}
{% if contact_us.name_blank? %}
<p>{{ "contact_us.errors.name_blank" | trans }}</p>
{% endif %}
{% if contact_us.message_blank? %}
<p>{{ "contact_us.errors.message_blank" | trans }}</p>
{% endif %}
{% endif %}
{% include "recaptcha_errors" %}
{% unless contact_us.success? %}
<form class="contact_us" action="/contact_us" method="POST">
{{ token_tag }}
<p>
<label for="name">{{ "contact_us.your_name" | trans }}</label></br>
<input type="text" id="name" name="name" value="{{ contact_us.name }}" />
</p><p>
<label for="email">{{ "contact_us.your_email" | trans }}</label></br>
<input type="email" id="email" name="email" value="{{ contact_us.email }}" />
</p><p>
<label for="message">{{ "contact_us.your_message" | trans }}</label></br>
<textarea type="message" id="message" name="message">{{ contact_us.message }}</textarea>
</p><p>
{{ "recaptcha.please_verify_your_humanity" | trans }}
{{ site.recaptcha_tags }}
</p>
<p><input type="submit" id="input" value="{{ "buttons.submit" | trans }}" /></p>
</form>
{% else %}
<h3>{{ "contact_us.your_message_as_received" | trans }}</h3>
<dl>
<dt>{{ "contact_us.from" | trans }}</dt>
<dd>{{ contact_us.name }} &lt;{{ contact_us.email }}&gt;</dd>
<dt>{{ "contact_us.message" | trans }}</dt>
<dd><pre>{{ contact_us.message }}</pre></dd>
</dl>
{% endunless %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment