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

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

{% block content %}

  <div class="top_tools">
    
    {% if app.user.emailConfirmed %}
      <a href="#" id="group_add_link" class="button gradient justtopright">
        {{ 'group.add_group'|trans({}, 'navigationui') }}
        <img src="{{ asset('/img/icon_dart_right_white.png') }}" alt="" />
      </a>
      <a href="#" id="group_add_close_link" class="button gradient justtopright" style="display: none;">
        {{ 'group.add_group_box.close'|trans({}, 'navigationui') }}
        <img src="{{ asset('/img/icon_dart_left_white.png') }}" alt="" />
      </a>
    {% else %}
      <a href="#" id="group_add_link_disabled" class="button gradient justtopright mustconfirmemail">
        {{ 'group.add_group'|trans({}, 'navigationui') }}
        <img src="{{ asset('/img/icon_dart_right_white.png') }}" alt="" />
      </a>
    {% endif %}
    
  </div>
  
  {% 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(group.id)})  }}"
        >
          <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 %}">

    <h2>{{ 'group.add_group'|trans({}, 'navigationui') }}</h2>

    <form class="nicelabels" 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 } %}

      <div class="alignright">
        <input type="submit" class="button" value="{{ 'group.form.submit'|trans({}, 'groups') }}" />
      </div>
    </form>
  
  </div>

{% endblock %}