I have this code in my Twig template:
{% for entity in entities %}
<ul>
<li>{{ entity.getName }} | <a href="{{ path('detail_group_edit', { 'detail_group_id': entity.getId }) }}">Editar</a> - <a href="{{ path('detail_group_delete', { 'detail_group_id': entity.getId }) }}">Eliminar</a>
{{ render(controller('ProductBundle:DetailGroup:index', { 'parent_id': entity.getId })) }}
</li>
</ul>
{% endfor %}
<dl class="sub-nav">
<dd><a href="#" id="detail_group_create">Add new</a></dd>
</dl>
<script>
$(function() {
$("#detail_group_create").click(function() {
loadCenterLayout(Routing.generate('detail_group_new'));
});
});
</script>
Because I'm calling this {{ render(controller('ProductBundle:DetailGroup:index', { 'parent_id': entity.getId })) }}
I get the Add new
link twice. I don't want to create a new function to handle the same, how did yours deal with this? Any tips or advice?