Skip to content

Commit

Permalink
Merge pull request sonata-project#2047 from aitboudad/block_admin_list
Browse files Browse the repository at this point in the history
[Dashboard][Block Admin list] use widgetbox
  • Loading branch information
rande committed Apr 10, 2014
2 parents fccda3d + 9fbfc4f commit 0d6eba6
Showing 1 changed file with 59 additions and 57 deletions.
116 changes: 59 additions & 57 deletions Resources/views/Block/block_admin_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,64 @@ file that was distributed with this source code.
{% extends sonata_block.templates.block_base %}

{% block block %}

<table class="table table-condensed sonata-ba-list">

{% for group in groups %}
{% set display = (group.roles is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
{% for role in group.roles if not display %}
{% set display = is_granted(role)%}
{% endfor %}

{% if display %}
<tr>
<td colspan="3" style="background: none repeat scroll 0 0 #F7F7F7;"><strong>{{ group.label|trans({}, group.label_catalogue) }}</strong></td>
</tr>

{% for admin in group.items %}
{% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
<tr>
<td class="sonata-ba-list-label">
{{ admin.label|trans({}, admin.translationdomain) }}
</td>
<td>
<div class="btn-group">
{% if admin.hasroute('create') and admin.isGranted('CREATE') %}
{% if admin.subClasses is empty %}
<a class="btn btn-link" href="{{ admin.generateUrl('create')}}">
<i class="fa fa-plus-circle"></i>
{% trans from 'SonataAdminBundle' %}link_add{% endtrans %}
</a>
{% else %}
<a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-plus-circle"></i>
{% trans from 'SonataAdminBundle' %}link_add{% endtrans %}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% for subclass in admin.subclasses|keys %}
<li>
<a href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">{{ subclass }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% if admin.hasroute('list') and admin.isGranted('LIST') %}
<a class="btn btn-link" href="{{ admin.generateUrl('list')}}">
<i class="glyphicon glyphicon-list"></i>
{% trans from 'SonataAdminBundle' %}link_list{% endtrans -%}
</a>
{% endif %}
</div>
</td>
</tr>
{% endif %}
{% endfor %}

{% endif %}
{% for group in groups %}
{% set display = (group.roles is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
{% for role in group.roles if not display %}
{% set display = is_granted(role)%}
{% endfor %}
</table>

{% if display %}
<div class="box">
<div class="box-header">
<h3 class="box-title">{{ group.label|trans({}, group.label_catalogue) }}</h3>
</div>
<div class="box-body">
<table class="table table-hover">
<tbody>
{% for admin in group.items %}
{% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
<tr>
<td class="sonata-ba-list-label">
{{ admin.label|trans({}, admin.translationdomain) }}
</td>
<td>
<div class="btn-group">
{% if admin.hasroute('create') and admin.isGranted('CREATE') %}
{% if admin.subClasses is empty %}
<a class="btn btn-link" href="{{ admin.generateUrl('create')}}">
<i class="fa fa-plus-circle"></i>
{% trans from 'SonataAdminBundle' %}link_add{% endtrans %}
</a>
{% else %}
<a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-plus-circle"></i>
{% trans from 'SonataAdminBundle' %}link_add{% endtrans %}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% for subclass in admin.subclasses|keys %}
<li>
<a href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">{{ subclass }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% if admin.hasroute('list') and admin.isGranted('LIST') %}
<a class="btn btn-link" href="{{ admin.generateUrl('list')}}">
<i class="glyphicon glyphicon-list"></i>
{% trans from 'SonataAdminBundle' %}link_list{% endtrans -%}
</a>
{% endif %}
</div>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endfor %}
{% endblock %}

0 comments on commit 0d6eba6

Please sign in to comment.