{% load i18n %}

<table class="chart-detail-entries">
    <tr>
        <th>{% trans "Position" %}</th>
        <th></th>
        <th>{% trans "Song - Artist" %}</th>
        <th>{% trans "Previous" %}</th>
        <th>{% trans "Audio" %}</th>
        <th>{% trans "Video" %}</th>
    </tr>
    {% for chartentry in object.chartentries_permitted %}
    <tr>
        <td>{{ chartentry.current_position }}</td>
    	<td>{% if chartentry.track.image %}<img src="{{ chartentry.track.get_modelbase_list_item_thumbnail_LAYER_url }}" />{% endif %}</td>
	    <td>
            {% with chartentry.track.primary_contributors_permitted as primary_contributors_permitted %}
                {{ chartentry.track.title }}{% if primary_contributors_permitted %} - {{ primary_contributors_permitted|join:", " }}{% endif %}
            {% endwith %}
        </td>
	    <td>{% if chartentry.previous_position %}{{ chartentry.previous_position }}{% endif %}</td>
        {% comment %}<td>{% humanize_time_diff chartentry.get_duration_on_chart %}</td>{% endcomment %}
        <td>
            {% if chartentry.track.audio_embed %}
                <div class="audio">
                    {{ chartentry.track.audio_embed|safe }}
                </div>
            {% endif %}
        </td>
    	<td>
            {% if chartentry.track.video_embed %}
                <div class="video">
                    <a href="{{ chartentry.track.get_absolute_url }}" onclick="document.location='http://m.youtube.com/watch?gl=ZA&hl=en&client=mv-google&v={{ chartentry.track.youtube_id }}'; return false;">
                        <img src="{{ chartentry.track.get_chart_detail_videoembed_LAYER_url }}" alt="{{ chartentry.track.title }}" />
                    </a>
                </div>
            {% endif %}
        </td>
    </tr>
    {% endfor %}
</table>
