{% extends 'base.html' %}
{% load wagtailcore_tags core_tags wagtailimages_tags static %}
{% wagtail_site as current_site %}
{% block content %}
  {% if page.your_words_competition %}
    <div class="standalone-page your-words your-words{{ page.get_effective_extra_style_hints }}">
      <div class="section-title">
        <h2>{% trans "Share your story" %}</h2>
      </div>
      <h3>{{ page.title }}</h3>
      <p>{{ page.introduction }}</p>
      <img src="{% static 'img/Pencil.png' %}" />
      <div class="content">
        <!-- this needs to be checked -->
        {% for block in form.description %}
          {% if block.block_type == 'heading' %}
              <h5>{{ block.value }}</h5>
          {% elif block.block_type == 'paragraph' %}
              <p>{{ block.value }}</p>
          {% endif %}
        {% endfor %}
      </div>
      {% comment %}
        {% if fields_step and fields_step.paginator.num_pages > 1 %}
        <div class="your-words__pagination your-words__pagination--multi-step">
          <h6 class="your-words__pagination-title">
            {% blocktrans with pages=fields_step.paginator.num_pages %}This competition has {{ pages }} pages{% endblocktrans %}
          </h6>
        </div>
        {% endif %}
      {% endcomment %}
      {% include "forms/form.html" with formtype="competition" formtypeClass="your-words"  %}
    </div>
  {% elif page.display_form_directly %}
    <div class="polls gem-polls">
      <div class="section-title">
        <h4 class="poll__title list-header">{% trans "What's your opinion?" %}</h4>
      </div>
      <div class="list-inline">
        <h2 class="poll__question-title">{{ page.title }}</h2>
        {% if user.is_authenticated and user.is_active or request.is_preview or self.allow_anonymous_submissions %}
          {% if form %}
            {% include "forms/form.html" with formtype="poll" formtypeClass="polls"  %}
          {% else %}
          <p class="error error--poll">{% trans 'You have already completed this poll.' %}</p>
            {% if request.path == "/" %}
              <a href="{%url 'molo.forms:success' form.slug %}" class="button call-to-action__button call-to-action__button--primary">
                {% trans "Show Results" %}
              </a>
            {% else %}
              <a href="{{current_site.root_page.specific.url}}" class="button call-to-action__nav-item call-to-action__nav-item--back-home">
              {% trans "Back home" %}</a>
            {% endif %}
          {% endif %}
        {% endif %}
      </div>
    </div>
  {% else %}
    <div class="surveys surveys{{page.get_parent_section.get_effective_extra_style_hints}}">

      <h1 class="surveys__title">{{ page.title }}</h1>
      <h4 class="surveys__intro">{{ page.introduction }}</h4>
      {% if fields_step and fields_step.paginator.num_pages > 1 %}
      <div class="surveys__pagination surveys__pagination--multi-step">
        <h6 class="surveys__pagination-title">
          {% blocktrans with pages=fields_step.paginator.num_pages %}This survey has {{ pages }} pages{% endblocktrans %}
        </h6>
      </div>
      {% endif %}
      {% if user.is_authenticated and user.is_active or request.is_preview or self.allow_anonymous_submissions %}
        {% include "forms/form.html" with formtype="form" formtypeClass="surveys" %}
      {% else %}
        <div class="call-to-action call-to-action--surveys">
          <a href="{{ LOGIN_URL }}?next={{request.path}}" class="button call-to-action__nav-item call-to-action__nav-item--surveys">{% trans 'Log in to take survey' %}</a>
        </div>
      {% endif %}
    </div>
  {% endif %}
{% endblock %}
