byceps/byceps

View on GitHub
byceps/blueprints/admin/board/templates/admin/board/board_index_for_brand.html

Summary

Maintainability
Test Coverage
{% extends 'layout/admin/base.html' %}
{% from 'macros/admin.html' import render_extra_in_heading %}
{% from 'macros/icons.html' import render_icon %}
{% from 'macros/misc.html' import render_tag %}
{% set current_page = 'board_admin' %}
{% set current_page_brand = brand %}
{% set page_title = [_('Boards'), brand.title] %}

{% block body %}

  <div class="row row--space-between block">
    <div>
      <h1 class="title">{{ _('Boards') }} {{ render_extra_in_heading(boards|length) }}</h1>
    </div>
  {%- if has_current_user_permission('board.create') %}
    <div>
      <div class="button-row is-right-aligned">
        <a class="button" href="{{ url_for('.board_create_form', brand_id=brand.id) }}">{{ render_icon('add') }} <span>{{ _('Create board') }}</span></a>
      </div>
    </div>
  {%- endif %}
  </div>

  {%- if boards %}
  <table class="itemlist is-vcentered is-wide">
    <thead>
      <tr>
        <th>{{ _('ID') }}</th>
        <th class="centered">{{ _('Categories') }}</th>
        <th class="centered">{{ _('Topics') }}</th>
        <th class="centered">{{ _('Postings') }}</th>
      </tr>
    </thead>
    <tbody>
    {%- for board in boards|sort(attribute='id') %}
      <tr>
        <td>
          <a href="{{ url_for('.board_view', board_id=board.id) }}"><strong>{{ board.id }}</strong></a>
          {%- if board.access_restricted %}
          <br>{{ render_tag(_('restricted access')) }}
          {%- endif %}
        </td>
        {%- with stats = stats_by_board_id[board.id] %}
        <td class="centered bignumber">{{ stats.category_count }}</td>
        <td class="centered bignumber">{{ stats.topic_count|numberformat }}</td>
        <td class="centered bignumber">{{ stats.posting_count|numberformat }}</td>
        {%- endwith %}
      </tr>
    {%- endfor %}
    </tbody>
  </table>
  {%- else %}
  <div class="box">
    <div class="dimmed-box centered">{{ _('No boards exist for this brand.') }}</div>
  </div>
  {%- endif %}

{%- endblock %}