{% comment %}
  Password message which you can edit on http://www.shopify.com/admin/online_store/preferences
{% endcomment %}
{% unless shop.password_message == blank %}
  <div class="password-message">
    {{ shop.password_message }}
  </div>
{% endunless %}

{% if section.settings.newsletter_enable %}
  {% form 'customer' %}
    {{ form.errors | default_errors }}
    {% if form.posted_successfully? %}
      <ul class="form--success">
        <li>{{ 'general.password_page.signup_form_success' | t }}</li>
      </ul>
    {% else %}
      <p class="password__form-heading h4">
        {{ section.settings.newsletter_form_heading | escape }}
      </p>
      <input type="hidden" name="contact[tags]" value="prospect, password page">
      <label for="email" class="label--hidden">{{ 'general.password_page.signup_form_email_label' | t }}</label>
      <div class="input-group password__input-group">
        <input type="email" name="contact[email]" id="Email" class="input-group__field" placeholder="{{ section.settings.newsletter_placeholder | escape }}">
        <span class="input-group__btn">
          <button type="submit" name="commit" class="btn">
            <span>{{ section.settings.newsletter_button_text | escape }}</span>
          </button>
        </span>
      </div>
    {% endif %}
  {% endform %}
{% endif %}

{% schema %}
  {
    "name": "Content",
    "settings": [
      {
        "type": "checkbox",
        "id": "newsletter_enable",
        "label": "Show newsletter signup",
        "default": true
      },
      {
        "type": "text",
        "id": "newsletter_form_heading",
        "label": "Newsletter form heading",
        "default": "Be the first to know when we launch.",
        "info": "[Tell your visitors about a launch day discount](https://www.shopify.com/blog/15514000-14-ways-to-use-offers-coupons-discounts-and-deals-to-drive-revenue-and-customer-loyalty)."
      },
      {
        "type": "text",
        "id": "newsletter_placeholder",
        "label": "Newsletter placeholder text",
        "default": "Email address"
      },
      {
        "type": "text",
        "id": "newsletter_button_text",
        "label": "Newsletter button text",
        "default": "Notify me"
      }
    ]
  }
{% endschema %}
