{% 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 survey.allow_anonymous_submissions %}
<div class="adv_wrapper adv_wrapper--surveys adv_wrapper{{survey.get_effective_extra_style_hints}}">
  <aside>
    {% if survey.image %}
      {% image survey.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=survey.title %}
    {%  if survey.homepage_introduction %}
        {% include "patterns/basics/headings/sp_variations/heading.html" with type="subheading" htmltag="p" title=survey.homepage_introduction|smarttruncatechars:100|safe %}
    {% endif %}
  </section>
  <nav>
    {% trans "Take Survey" as buttontext %}
    {% with trans_buttontext=survey.homepage_button_text|default:buttontext %}
        {% pageurl survey.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 %}
