byceps/byceps

View on GitHub
byceps/blueprints/admin/brand/templates/admin/brand/index.html

Summary

Maintainability
Test Coverage
{% extends 'layout/admin/base.html' %}
{% from 'macros/admin.html' import render_extra_in_heading %}
{% from 'macros/admin/brand.html' import render_brand_avatar %}
{% from 'macros/icons.html' import render_icon %}
{% from 'macros/misc.html' import render_tag %}
{% set current_page = 'brands_admin' %}
{% set page_title = _('Brands') %}

{% block body %}

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

  {%- if brands %}
  <table class="itemlist is-vcentered is-wide">
    <thead>
      <tr>
        <th colspan="2">{{ _('Name') }}<br>{{ _('ID') }}</th>
        <th class="centered">{{ _('Parties') }}</th>
        <th class="centered">{{ _('Organizers') }}</th>
      </tr>
    </thead>
    <tbody>
      {%- for brand in brands %}
      <tr>
        <td>
          <div style="float: left; margin-right: 0.75rem;">{{ render_brand_avatar(brand, '32') }}</div>
          <div>
            <a class="disguised" href="{{ url_for('admin_dashboard.view_brand', brand_id=brand.id) }}"><strong>{{ brand.title }}</strong></a><br>
            {{ brand.id|dim }}
          </div>
        </td>
        <td>
        {%- if brand.archived %}
          {{ render_tag(_('archived'), class='color-disabled', icon='archived') }}
        {%- endif %}
        </td>
        <td class="centered bignumber">{{ party_count_by_brand_id[brand.id] }}</td>
        <td class="centered bignumber">{{ orga_count_by_brand_id[brand.id] }}</td>
      </tr>
      {%- endfor %}
    </tbody>
  </table>
  {%- else %}
  <div class="box">
    <div class="dimmed-box centered">{{ _('No brands defined.') }}</div>
  </div>
  {%- endif %}

{%- endblock %}