Skip to content

Instantly share code, notes, and snippets.

@rileyrg
Created May 23, 2017 14:39
Show Gist options
  • Save rileyrg/eaaaf88ab093c305583f2de24394d115 to your computer and use it in GitHub Desktop.
Save rileyrg/eaaaf88ab093c305583f2de24394d115 to your computer and use it in GitHub Desktop.
{# @controller AppBundle:Person:list #}
{% extends 'base.html.twig' %}
{% set paginationIcon = pagination.direction == "asc" ? "fa-sort-asc" : pagination.direction == "desc" ? "fa-sort-desc" : "fa-sort" %}
{% block body %}
{{ parent() }}
{% if form is not null %}
<form method="get" action="{{ path('actors_list') }}">
{{ form_rest(form) }}
<input type="submit" name="submit-filter" value="filter" />
</form>
{% endif %}
<div class="container paginating-list-container">
<div class="row">
<div class="col-xs-12">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<div class="navigation">
{{ knp_pagination_render(pagination) }}
</div>
</tr>
<tr>
<th class="text-center text-primary">
{% include "person/glyphs/person.html.twig" %}
{% if pagination.isSorted('p.surname') %}
{% embed "fragments/glyphs/fa-icon.html.twig" with {"icon":paginationIcon} %}{% endembed %}
{% endif %}
{{ knp_pagination_sortable(pagination, "person.name" | trans({}, 'person'), 'p.surname') }}
</th>
<th class="text-center">
{% include "addressdata/glyphs/address-book.html.twig" %}
{% if pagination.isSorted('c.name') %}
{% embed "fragments/glyphs/fa-icon.html.twig" with {"icon":paginationIcon} %}{% endembed %}
{% endif %}
{{ knp_pagination_sortable(pagination, "address.address" | trans({}, 'address'), 'c.name') }}
</th>
<th class="text-center">
{% include "addressdata/glyphs/address-book-admin.html.twig" %}
{% if pagination.isSorted('ac.name') %}
{% embed "fragments/glyphs/fa-icon.html.twig" with {"icon":paginationIcon} %}{% endembed %}
{% endif %}
{{ knp_pagination_sortable(pagination, "address.adminaddress" | trans({}, 'address'), 'ac.name') }}
</th>
<th class="text-right text-muted">
<i class="fa fa-calendar fa-fw" aria-hidden="true"></i>
{% if pagination.isSorted('p.createdAt') %}
{% embed "fragments/glyphs/fa-icon.html.twig" with {"icon":paginationIcon} %}{% endembed %}
{% endif %}
{{ knp_pagination_sortable(pagination, "date.created" | trans({}, 'dates'), 'p.createdAt') }}
</th>
</tr>
</thead>
{% for person in pagination %}
<tr>
<td class="name text-center text-primary">
<a href="{{ path('person_show',{
'id': person.id
}) }}">
{{ person.getName }}
<small>
{% embed "person/glyphs/gender.html.twig" with {"gender":person.sex} only %}{% endembed %}
{% embed "fragments/glyphs/debug-key.html.twig" with {"key":person.getid} %}{% endembed %}
</small>
</a>
</td>
<td {{ person.adressdata? '': 'class="danger"' }}>
{% if person.adressData %}
{% embed "addressdata/address.html.twig" with {'address':person.adressData,title:"",'informempty':false} %}{% endembed %}
{% endif %}
</td>
<td {{ person.adminadressdata? '': 'class="danger"' }}>
{% if person.adminAdressData %}
{% embed "addressdata/address.html.twig" with {'address':person.adminAdressData,title:"",'informempty':false} %}{% endembed %}
{% endif %}
</td>
<td class="date text-right text-muted">
{{ person.createdAt |date('Y-m-d') }}
</td>
</tr>
{% endfor %}
</table>
<div class="navigation bottom">
{{ knp_pagination_render(pagination) }}
</div>
</div>
</div>
</div>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment