byceps/byceps

View on GitHub
byceps/blueprints/admin/gallery/templates/admin/gallery/gallery_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 = 'gallery_admin' %}
{% set page_title = _('Galleries') %}

{% block body %}

  <div class="block row row--space-between">
    <div>
      <h1 class="title">{{ page_title }} {{ render_extra_in_heading(galleries|length) }}</h1>
    </div>
  {%- if has_current_user_permission('gallery.administrate') %}
    <div>
      <div class="button-row is-right-aligned">
        <a class="button" href="{{ url_for('.gallery_create_form', brand_id=brand.id) }}">{{ render_icon('add') }} <span>{{ _('Add') }}</span></a>
      </div>
    </div>
  {%- endif %}
  </div>

  {%- if galleries %}
  <table class="itemlist is-wide">
    <thead>
      <tr>
        <th>{{ _('Slug') }}</th>
        <th>{{ _('Title') }}</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      {%- for gallery in galleries|sort(attribute='position') %}
      <tr>
        <td>{{ gallery.slug }}</td>
        <td>{{ gallery.title }}</td>
        <td>{% if gallery.hidden %}{{ render_tag(_('hidden')) }}{% endif %}</td>
      </tr>
      {%- endfor %}
    </tbody>
  </table>
  {%- else %}
  <div class="box">
    <div class="dimmed-box centered">{{ _('None defined') }}</div>
  </div>
  {%- endif %}

{%- endblock %}