{% load wagtailimages_tags wagtailcore_tags static gem_tags %}
{% comment %}
    If  User is not authenticated OR
    anonymous_submissions is not set
    AND join banner is not set
      Normal surveys do not show? Desired behavior?
{% endcomment %}
{% if user.is_authenticated and user.is_active or request.is_preview or form_page.allow_anonymous_submissions %}
<div class="adv_wrapper adv_wrapper--surveys adv_wrapper{{form_page.get_effective_extra_style_hints}}">
  <aside>
    {% if form_page.image %}
      {% image form_page.image width-165 as icon_small %}
      <img src="{{ icon_small.url }}" alt="{{ self.title }}" class="adv_wrapper__item-thumb" />
    {% else %}
      <img src="{% static 'img/icons/think_purple_HR.png' %}" alt="Think Icon" width="115" class="adv_wrapper__item-icon" />
    {% endif %}
  </aside>
  <section>
    {% include "patterns/basics/headings/sp_variations/heading.html" with type="component" htmltag="h1" title=form_page.title %}
    {%  if form_page.homepage_introduction %}
        {% include "patterns/basics/headings/sp_variations/heading.html" with type="subheading" htmltag="p" title=form_page.homepage_introduction|smarttruncatechars:100|safe %}
    {% endif %}
  </section>
  <nav>
    {% trans "Take Survey" as buttontext %}
    {% with trans_buttontext=form_page.homepage_button_text|default:buttontext %}
        {% pageurl form_page.specific as the_url %}
        {% include "patterns/basics/buttons/sp_variations/button.html" with type="primary" hyperlink=the_url text=trans_buttontext %}
    {% endwith %}
  </nav>
</div>
{% else %}
    {% include "patterns/components/banners/join-banner.html" %}
{% endif %}
