{% extends "user/user-base.html" %}

{% block title_ruler %}{% endblock %}

{% block title_row %}
  {% set tab = 'bookmark' %}
  {% include "user/user-tabs.html" %}
{% endblock %}

{% block user_content %}
  {% if blogs %}
    <div class="bookmark-group">
      <h3 class="unselectable toggle closed">
        <span class="fa fa-chevron-right fa-fw"></span>{{ _('Posts') }} ({{ blogs|length }})
      </h3>
      <table style="display: none" class="table toggled">
        <tbody>
          {% for post in blogs %}
            {% set object = post.bookmark.linked_object %}
            {% if object %}
              <tr>
                <td class="bookmark-name">
                  <a href="{{ url('blog_post', object.id, object.slug) }}">{{ object.title}} </a>
                </td>
              </tr>
            {% endif %}
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}
  {% if problems %}
    <div class="bookmark-group">
      <h3 class="unselectable toggle closed">
        <span class="fa fa-chevron-right fa-fw"></span>{{ _('Problems') }} ({{ problems|length }})
      </h3>
      <table style="display: none" class="table toggled">
        <tbody>
          {% for problem in problems %}
            {% set object = problem.bookmark.linked_object %}
            {% if object %}
              <tr>
                <td class="bookmark-name">
                  <a href="{{ url('problem_detail', object.code) }}">{{ object.name}} </a>
                </td>
              </tr>
            {% endif %}
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}
  {% if contests %}
    <div class="bookmark-group">
      <h3 class="unselectable toggle closed">
        <span class="fa fa-chevron-right fa-fw"></span>{{ _('Contests') }} ({{ contests|length }})
      </h3>
      <table style="display: none" class="table toggled">
      </thead>
      <tbody>
        {% for contest in contests %}
          {% set object = contest.bookmark.linked_object %}
          {% if object %}
            <tr>
              <td class="bookmark-name">
                <a href="{{ url('contest_view', object.key) }}">{{ object.name}} </a>
              </td>
            </tr>
          {% endif %}
        {% endfor %}
      </tbody>
    </table>
    </div>
  {% endif %}
  {% if solutions %}
    <div class="bookmark-group">
      <h3 class="unselectable toggle closed">
        <span class="fa fa-chevron-right fa-fw"></span>{{ _('Editorials') }} ({{ solutions|length }})
      </h3>
      <table style="display: none" class="table toggled">
      </thead>
      <tbody>
        {% for solution in solutions %}
          {% set object = solution.bookmark.linked_object %}
          {% if object %}
            <tr>
              <td class="bookmark-name">
                <a href="{{ url('problem_editorial', object.problem.code) }}">{{ object.problem.name}} </a>
              </td>
            </tr>
          {% endif %}
        {% endfor %}
      </tbody>
    </table>
    </div>
  {% endif %}

{% endblock %}
