<table>
  <tr>
    <td class="element_thumbnail">
      
      {% if element.embed %}
        <a href="#" class="a_thumbnail element_open element_embed_open_link {% if element.embed %}embed{% else %}noembed{% endif %}">
          <img class="play" style="display: none;" src="{{ asset('bundles/muzichcore/img/1328283150_media-playback-start.png') }}" alt="" />
          <img 
            class="element_thumbnail"
            {% if element.thumbnailUrl %}
              src="{{ element.thumbnailUrl }}" 
            {% else %}
              src="{{ asset('bundles/muzichcore/img/nothumb.png') }}" 
            {% endif %}
            title="{{ 'element.show.open_embed'|trans({}, 'elements') }}" 
            alt=""
          />
        </a>
      {% else %}
        <a href="{{ element.url }}" class="a_thumbnail element_open {% if element.embed %}embed{% else %}noembed{% endif %}" target="_blank">
          <img class="open" style="display: none;" src="{{ asset('bundles/muzichcore/img/1328283201_emblem-symbolic-link.png') }}" alt="" />
          <img 
            class="element_thumbnail"
            {% if element.thumbnailUrl %}
              src="{{ element.thumbnailUrl }}" 
            {% else %}
              src="{{ asset('bundles/muzichcore/img/nothumb.png') }}" 
            {% endif %}
            title="{{ 'element.show.open_embed'|trans({}, 'elements') }}" 
            alt=""
          />
        </a>
      {% endif %}
      
    </td>
    <td class="element_content">
      
      <span class="element_name">
        {% if element.embed %}
          <a href="#" class="element_open element_name_embed_open_link">
            {{ element.name }}
          </a>
        {% else %}
          <a href="{{ element.url }}" class="element_open" target="_blank">
            {{ element.name }}
          </a>
        {% endif %}
      </span> 
      
      <a title="{{ 'element.link'|trans({}, 'elements') }}" class="element_link" href="{{ element.url }}" target="_blank">
        <img src="{{ asset('bundles/muzichcore/img/1324917097_link.png') }}" alt="link" />
      </a>
      
      {% if app.user.id != element.owner.id %}
      
        <a title="{{ 'element.proposition_tags.link_title'|trans({}, 'userui') }}" 
          class="element_propose_tags" 
          href="{{ path('ajax_element_propose_tags_open', {'element_id' : element.id}) }}">
          <img src="{{ asset('bundles/muzichcore/img/1333484018_rss-tag.png') }}" alt="tags_proposition" />
        </a>
      
        <a title="{{ 'element.report.link_title'|trans({}, 'userui') }}" 
          class="element_report" 
          href="{{ path('ajax_report_element', {'element_id':element.id, 'token':app.user.getPersonalHash}) }}">
          <img src="{{ asset('bundles/muzichcore/img/1331832708_comment_alert.png') }}" alt="report" />
        </a>
      
      {% endif %}
      
      {% if app.user.id == element.owner.id %}
      
        {% if element.hasTagProposition %}
          <a title="{{ 'element.view_propositions.link'|trans({}, 'elements') }}" class="element_view_propositions_link" 
             href="{{ path('ajax_element_proposed_tags_view', {'element_id' : element.id})  }}"
          >
            <img src="{{ asset('bundles/muzichcore/img/1333493527_tag_add.png') }}" alt="tags proposition" />
          </a>
        {% endif %}
      
        <a title="{{ 'element.edit.link'|trans({}, 'elements') }}" class="element_edit_link" 
           href="{{ path('element_edit', {'element_id' : element.id})  }}" style="display: none;"
        >
          <img src="{{ asset('bundles/muzichcore/img/1327151338_desktop.png') }}" alt="edit" />
        </a>

        <a title="{{ 'element.remove.link'|trans({}, 'elements') }}" class="element_remove_link" 
           href="{{ path('element_remove', {'element_id' : element.id})  }}" style="display: none;"
        >
          <img src="{{ asset('bundles/muzichcore/img/1327168960_fileclose.png') }}" alt="delete" />
        </a>
      {% endif %}
      
      <br />
      {% autoescape false %}
        {% if element.group and no_group_name is not defined%}
          {{ 'element.name.whoandgroup'|trans({
            '%owner_url%'  : path('show_user', {'slug': element.owner.slug}),
            '%owner_name%' : element.owner.name,
            '%group_url%'  : path('show_group', {'slug': element.group.slug}),
            '%group_name%' : element.group.name
          }, 'elements') }}
        {% else %}
          {{ 'element.name.who'|trans({
            '%owner_url%'  : path('show_user', {'slug': element.owner.slug}),
            '%owner_name%' : element.owner.name
          }, 'elements') }}
        {% endif %}
      {% endautoescape %}
      {{ element.created.date|date_or_relative_date }}
      
      <div class="loader">
        <img class="element_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
      </div>
      
      {% if element.tags|length %}
      <ul class="element_tags">
        {% for tag in element.tags %} 
          <li class="element_tag">
            <a id="element_tag_{{ tag.id }}" href="#" class="element_tag button">{{ tag.name }}</a>
            <a 
              href="{{ path('ajax_tag_add_to_favorites', {
                'tag_id' : tag.id,
                'token'  : app.user.getPersonalHash
              }) }}" 
              class="tag_to_favorites" 
              style="display: none;"
              title="{{ 'element.tag.addtofav.title'|trans({}, 'elements') }}"   
            >
              <img src="{{ asset('/bundles/muzichcore/img/1331734087_emblem-favorite.png') }}" alt="add-to-favorites"/>
            </a>
          </li>
        {% endfor %} 
      </ul>
      {% endif %}
      
      <a href="#" class="button element_open element_embed_close_link" style="display: none;">
        {{ 'element.show.close_embed'|trans({}, 'elements') }}
      </a>
      
      
      {% autoescape false %}
        {% if element.comments|length > 1 %}
          <a href="#hide_comments_{{ element.id }}" class="hide_comments" style="display: none;">
            {{ 'element.comments.hideare'|trans({}, 'elements') }}
          </a>  
          <a href="#comments_{{ element.id }}" class="display_comments">
            {{ 'element.comments.thereare'|trans({'%count%':element.comments|length}, 'elements') }}
          </a>
        {% elseif element.comments|length == 1 %}
          <a href="#hide_comments_{{ element.id }}" class="hide_comments" style="display: none;">
            {{ 'element.comments.hideis'|trans({}, 'elements') }}
          </a> 
          <a href="#comments_{{ element.id }}" class="display_comments">
            {{ 'element.comments.thereis'|trans({}, 'elements') }}
          </a>
        {%endif %}
      {% endautoescape %}
                
      <a href="#add_comment_{{ element.id }}" class="add_comment">
        {{ 'element.comments.add'|trans({}, 'elements') }}
      </a>
      
      
    </td>
    <td class="right">
      
      <ul>
        {% if element.owner.id != app.user.id %}
          <li class="vote">
            {% if element.hasVoteGood(app.user.id) %}
              <a class="vote" href="{{ path('ajax_element_remove_vote_good', {
                'element_id' : element.id,
                'token'      : app.user.getPersonalHash
              }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
                <img src="{{ asset('/bundles/muzichcore/img/up_b.png') }}" alt="vote" />
              </a>
            {% else %}
              <a class="vote" href="{{ path('ajax_element_add_vote_good', {
                'element_id' : element.id,
                'token'      : app.user.getPersonalHash
              }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
                <img src="{{ asset('/bundles/muzichcore/img/up_bw.png') }}" alt="vote" />
              </a>
            {% endif %}
          </li>
      {% endif %}
      <li class="score">

        <span class="score">
          {{ element.points }}
        </span>

      </li>
      <li>

      {% if element.getCountFavorite %}
        <a class="favorite_link" href="{{ path('favorite_remove', { 'id': element.id, 'token': app.user.personalHash }) }}" >
          <img src="{{ asset('bundles/muzichcore/img/favorite.png') }}" title="{{ 'element.favorite.remove'|trans({}, 'elements') }}" alt="{{ 'element.favorite.remove'|trans({}, 'elements') }}"/>
        </a>
      {% else %}
        <a class="favorite_link" href="{{ path('favorite_add', { 'id': element.id, 'token': app.user.personalHash }) }}" >
          <img src="{{ asset('bundles/muzichcore/img/favorite_bw.png') }}" title="{{ 'element.favorite.add'|trans({}, 'elements') }}" alt="{{ 'element.favorite.add'|trans({}, 'elements') }}" />
        </a>
      {% endif %}

        </li>
      </ul>
    </td>
  </tr>
</table>

{% if ids_display is defined %}
{% if ids_display == event_const('TYPE_TAGS_PROPOSED') %}

  {% include 'MuzichCoreBundle:Element:tag.propositions.html.twig' with {
    'propositions' : element.getTagsProposition,
    'element_id'   : element.id
  } %}

{% endif %}
{% endif %}

{% if element.embed %}
  {% autoescape false %}
    <div id="embed_{{ element.id }}" class="element_embed" style="display: none;">
      {{ element.embed }}
    </div>
  {% endautoescape %}
{% endif %}

  <div class="comments" style="display: none;">
    <ul class="comments">
    {% if element.comments|length %}
      {% for comment in element.comments %}
        {% include "MuzichCommentBundle:Comment:li.comment.html.twig" with {'element_id' : element.id} %}
      {% endfor %}
    {% endif %}
    </ul>
      
    <div class="comments_loader">
      <img class="comments_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
    </div>
      
    <form 
      action="{{ path('ajax_add_comment', {'element_id':element.id, 'token':app.user.getPersonalHash}) }}" 
      method="post" 
      name="add_comment"
      style="display: none;"
      class="add_comment"
    >
      {% include "MuzichCommentBundle:Comment:form.html.twig" with {
        'submit_value' : 'element.comments.add_submit'|trans({}, 'elements'),
        'cancel_value' : 'element.comments.add_cancel'|trans({}, 'elements'),
        'following'    : element.userFollowComments(app.user.id),
        'own'          : (app.user.id == element.owner.id)
      } %}
    </form>
      
    <a href="#add_comment_{{ element.id }}" class="add_comment">
      {{ 'element.comments.add'|trans({}, 'elements') }}
    </a>
      
  </div>
