{% block tag_table %}
{% load static %}
	<table id="all_tags_table">
    <tr><th>id</th>
        <th>
        {% if sort|slice:"1:" != "lab" %}
 	        {% if searched and searched != "" %}
	            <a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort='+lab' searched=searched %}">label</a>
	        {% else %}
	            <a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort='+lab' %}">label</a>
	        {% endif %}
        {% else %}label &nbsp;{% if searched and searched != "" %}<a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort=reverse_sort searched=searched %}">{% else %}<a href="{% url 'hdabo.views.all_tags'  num_page='1' nb_by_page=nb_by_page sort=reverse_sort %}">{% endif %}<img src="{% if sort|first == '+' %}{% static 'hdabo/img/sort-asc.png' %}{% else %}{% static 'hdabo/img/sort-desc.png' %}{% endif %}"/></a>{% endif %}
        </th>
        <th>original_label</th>
        <th class="text_centered">Lien W</th>
        <th class="text_centered">Lien D</th>
        <th>Catégorie</th>
        <th class="large_25 text_centered">Supprimer<br/>le lien W</th>
        <th>Alias</th>
        <th class="text_centered">Nb de<br/>fiches</th>
        <th>
        {% if sort|slice:"1:" != "pop" %}
 	        {% if searched and searched != "" %}
	            <a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort='+pop' searched=searched %}">Popularité</a>
	        {% else %}
	            <a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort='+pop' %}">Popularité</a>
	        {% endif %}
        {% else %}Popularité &nbsp;{% if searched and searched != "" %}<a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort=reverse_sort searched=searched %}">{% else %}<a href="{% url 'hdabo.views.all_tags' num_page='1' nb_by_page=nb_by_page sort=reverse_sort %}">{% endif %}<img src="{% if sort|first == '+' %}{% static 'hdabo/img/sort-asc.png' %}{% else %}{% static 'hdabo/img/sort-desc.png' %}{% endif %}"/></a>{% endif %}
        </th></tr>
    {% for tag in tags %}
    <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline' %}">
        <td class="reset_wp_info">{{tag.id}}</td>
        <td class="{{tag.url_status_text}} wikipediatag" id="{{tag.id}}" >{{tag.label}}</td>
        <td>{{tag.original_label}}</td>
        <td class="text_centered">
            {% if tag.wikipedia_url and tag.wikipedia_url != ""  %}
            <a href="{{tag.wikipedia_url}}" target="_blank"><img src="{% static 'hdabo/img/arrow_right.png' %}" ></a>
            {% else %}
            <a href="http://fr.wikipedia.org/w/index.php?search={{tag.label}}" target="_blank"><img src="{% static 'hdabo/img/wikipedia_search.png' %}" ></a>
            {% endif %}
        </td>
        <td class="text_centered">
            {% if tag.dbpedia_uri and tag.dbpedia_uri != ""  %}
            <a href="{{tag.dbpedia_uri}}" target="_blank"><img src="{% static 'hdabo/img/arrow_green_right.png' %}" ></a>
            {% else %}
            &nbsp;
            {% endif %}
        </td>
        <td class="tag_category" id="{{tag.id}}">{% if tag.category %}{{ tag.category }}{% endif %}</td>
        <td class="text_centered"><img src="{% static 'hdabo/img/red_cross.png' %}" class="remove_wp_link" id="{{tag.id}}" alt="{{tag.label}}" /></td>
        <td class="tag_alias" id="{{tag.id}}" >{% if tag.alias %}{{tag.alias}}{% endif %}</td>
        <td class="text_centered">
        {% if tag.num_ds > 0 %}
        	<a href="{% url 'hdabo.views.display_datasheet' %}?tag={{tag.id}}" >{{tag.num_ds}}</a>
		{% else %}
            {{tag.num_ds}}
        {% endif %}
        </td>
        <td class="text_centered">{{tag.popularity}}</td></tr>
    {% endfor %}
    </table>
{% endblock %}
