{% extends "MuzichGroupBundle::layout.html.twig" %}

{% block title %}{{ 'my_groups.title'|trans({}, 'navigationui') }}{% endblock %}

{% block content %}

  <a href="#" id="group_add_link" class="button">
    {{ 'group.add_group'|trans({}, 'navigationui') }} &gt;&gt;
  </a>

  {% if groups|length %}

    {{ 'havegroups.sentence'|trans({}, 'groups') }}

    <ul class="inline">
    {% for group in groups %} 
      <li>
        
        <a href="{{ path('show_group', { 'slug': group.slug }) }}">{{ group.name }}</a>
        
        <a title="{{ 'group.remove.link'|trans({}, 'groups') }}" class="group_remove_link" 
          href="{{ path('group_delete', {'group_id' : group.id, 'token': app.user.personalHash})  }}"
        >
          <img src="{{ asset('bundles/muzichcore/img/1327168960_fileclose.png') }}" alt="delete" />
        </a>
        
      </li>
    {% endfor %}
    </ul>

  {% else %}

    {{ 'nogroups.sentence'|trans({}, 'groups') }}

  {% endif %}

  <div id="group_add_box" style="{% if not open_add_group %}display: none;{% endif %}">

    <a href="#" id="group_add_close_link" class="button">
      &lt;&lt; {{ 'group.add_group_box.close'|trans({}, 'navigationui') }}
    </a>
    
    <h2>{{ 'group.add_group'|trans({}, 'navigationui') }}</h2>

    <form name="{{ form_new_name }}" action="{{ path('group_add') }}" method="post" {{ form_enctype(form_new) }}>

      {% include "MuzichGroupBundle:Form:form.html.twig" with { 'form': form_new, 'form_name': form_new_name } %}

      <input type="submit" class="button" />
    </form>
  
  </div>

{% endblock %}