Skip to content

Commit

Permalink
Generate actions buttons using actions twig variable and generate col…
Browse files Browse the repository at this point in the history
…umn Action only if some actions are possibles
  • Loading branch information
sylvain plançon committed Jan 14, 2014
1 parent 35fa3ac commit ed8e038
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Resources/views/base.list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
{% for attr, field in list_fields %}
<th>{{ field | trans }}</th>
{% endfor %}
{% if actions|length > 0 %}
<th>Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
Expand All @@ -31,11 +33,15 @@
<td>{{ attribute(item, attr)|nl2br }}</td>
{% endfor %}
{% block action_buttons %}
{% if actions|length > 0 %}
<td>
<div class="btn-group">
<a class="btn btn-link" href="{{ path(list_edit_route, { 'id': item.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a>
{% for action in actions %}
<a class="btn btn-link" href="{{ action.href }}"><span class="glyphicon glyphicon-{{ action.icon }}"></span></a>
{% endfor %}
</div>
</td>
{% endif %}
{% endblock %}
</tr>
{% endfor %}
Expand Down

0 comments on commit ed8e038

Please sign in to comment.