{% load wagtailcore_tags wagtailimages_tags static tip_tags core_tags i18n %}
{% block content %}
{% get_your_tip as your_tip %}
<div class="yourtips">
{% if most_popular_tip and your_tip.get_number_of_popular_tips %}
  <h2 class="heading heading--yourtips-title heading--line-break">
    {% trans "Most popular tip" %}</h2>
  <div class="yourtips-list">
    <div class="yourtips-list__item">
    <!--START -->
    {% if settings.core.SiteSettings.enable_clickable_tags %}
      {% if most_popular_tip.tags_list|first %}
      <div class="yourtips__label">
        {% if most_popular_tip.image %}
          {% image most_popular_tip.image width-20 jpegquality-70 as yourtips_article_icon %}
          <img src="{{ yourtips_article_icon.url }}" class="yourtips__article-icon"/>
        {% endif %}
        {% for tag in most_popular_tip.tags_list %}
          {% if forloop.first %}
            <a class="yourtips__article-anchor">{{tag}}</a>
          {% endif %}
        {% endfor %}
      </div>
      {% endif %}
    {% endif %}
    <!--END -->
  {% for block in most_popular_tip.body %}
    {% include "patterns/basics/promoted-tips/yourtips-on-submission-form.html" %}
  {% endfor %}
  </div>
</div>
{% endif %}
{% if most_recent_tip and your_tip.get_number_of_tips %}
  <h2 class="heading heading--yourtips-title">{% trans "Most recent tip" %}</h2>
  <div class="yourtips-list">
    <div class="yourtips-list__item">
    <!--START -->
    {% if settings.core.SiteSettings.enable_clickable_tags %}
      {% if most_recent_tip.tags_list|first %}
      <div class="yourtips__label">
        {% if most_recent_tip.image %}
          {% image most_recent_tip.image width-20 jpegquality-70 as yourtips_article_icon %}
          <img src="{{ yourtips_article_icon.url }}" class="yourtips__article-icon"/>
        {% endif %}
        {% for tag in most_recent_tip.tags_list %}
          {% if forloop.first %}
            <a class="yourtips__article-anchor">{{tag}}</a>
          {% endif %}
        {% endfor %}
      </div>
      {% endif %}
    {% endif %}
    <!--END -->
  {% for block in most_recent_tip.body %}
    {% include "patterns/basics/promoted-tips/yourtips-on-submission-form.html" %}
  {% endfor %}
    </div>
  </div>
  <a href="{% url 'molo.yourtips:recent_tips' %}" class="call-to-action__nav-item">
    {% trans "See more Tips" %}
  </a>
{% endif %}
</div>
{% endblock %}
