byceps/byceps

View on GitHub
byceps/blueprints/site/board/templates/site/board/topic_index.html

Summary

Maintainability
Test Coverage
{% extends 'layout/base.html' %}
{% from 'macros/board.html' import render_flag_new %}
{% from 'macros/icons.html' import render_icon %}
{% from 'macros/pagination.html' import render_pagination_nav %}
{% from 'macros/subnav.html' import render_subnav_for_menu_id %}
{% from 'macros/user.html' import render_user_avatar_and_name %}
{% set current_page = 'board' %}
{% set page_title = _('Board') %}

{% block subnav %}
  {%- if subnav_menu_id|default %}
{{ render_subnav_for_menu_id(subnav_menu_id, current_page) }}
  {%- endif %}
{% endblock %}

{% block body %}

  <h1 class="title">{{ _('Board') }}</h1>

  {%- if topics.items %}
  <table class="itemlist is-vcentered is-wide board-topic-index">
    <thead>
      <tr>
        <th>{{ _('Topic') }}</th>
        <th class="centered">{{ _('Replies') }}</th>
        <th>{{ _('Latest post') }}</th>
      </tr>
    </thead>
    <tbody>
      {%- for topic in topics.items %}
      <tr id="topic-{{ topic.id }}"{% if topic.hidden %} class="dimmed"{% endif %}>
        <td>
          <a class="board-index-item-link disguised" href="{{ url_for('.topic_view', topic_id=topic.id) }}">
            <div class="board-index-item-title">
              {%- if topic.contains_unseen_postings %} {{ render_flag_new() }}{% endif %}
              {%- if topic.hidden %}<span class="tag tag--outlined">{{ render_icon('hidden', title='%s (%s %s)'|format(_('hidden'), _('by'), topic.hidden_by.screen_name)) }}</span> {% endif -%}
              {%- if topic.locked %}<span class="tag tag--outlined">{{ render_icon('lock', title=_('locked')) }}</span> {% endif -%}
              {%- if topic.pinned %}<span class="tag tag--outlined">{{ render_icon('pin', title=_('pinned')) }}</span> {% endif -%}
              <strong>{{ topic.title }}</strong>
            </div>
            <div class="board-index-item-meta">
              <span class="board-category-tag">{{ topic.category.title }}</span>
              &middot;
              {{ _('started by') }} {{ render_user_avatar_and_name(topic.creator, size=16) }}
            </div>
          </a>
        </td>
        <td class="centered bignumber">{{ topic.reply_count|numberformat }}</td>
        <td class="nowrap">{{ topic.last_updated_at|dateformat }}, {{ topic.last_updated_at|timeformat('short') }}<br>{{ _('by') }} {{ render_user_avatar_and_name(topic.last_updated_by, size=16) }}</td>
      </tr>
      {%- endfor %}
    </tbody>
  </table>
  {%- else %}
  <div class="main-body-box">
    <p class="dimmed">{{ _('No topics exist in this category.') }}</p>
  </div>
  {%- endif %}

{{ render_pagination_nav(topics, 'board.topic_index') }}

{%- endblock %}