{% extends "hdabo_base.html" %}
    {% block title %}HDA - BO : Tous les tags{% endblock %}

    {% block js_import %}
    {{block.super}}
    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.jeditable.js"></script>
    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.tablednd_0_5.js"></script>
    {% endblock %}
    
    {% block js_declaration %}
    {{block.super}}
    <script type="text/javascript">
    
    var global_csrf_token = "{{ csrf_token }}";
    var static_url = "{{STATIC_URL}}";
    var tag_up_down_url = "{% url hdabo.views.tag_up_down %}";
    var remove_tag_from_list_url = "{% url hdabo.views.remove_tag_from_list %}";
    var modify_tag_url = "{% url hdabo.views.modify_tag %}";
    var reset_wp_info_url = "{% url hdabo.views.reset_wikipedia_info %}";
    var add_tag_url = "{% url hdabo.views.add_tag %}";
    var remove_wp_link_url = "{% url hdabo.views.remove_wp_link %}";
    var update_tag_alias_url = "{% url hdabo.views.update_tag_alias %}";
    var update_tag_category_url = "{% url hdabo.views.update_tag_category %}";
    var categories_list = '{{categories|safe}}';
    
    $(document).ready(function(){
        init_tags_events();
    });
    </script>
    {% endblock %}

    {% block css_import %}
    {{block.super}}
    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/smoothness/jquery-ui-1.8.13.custom.css" type="text/css"/>
    {% endblock %}

    {% block css_declaration %}
    {{block.super}}
    <style type="text/css">
    .ui-autocomplete {
        max-height: 100px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
        /* add padding to account for vertical scrollbar */
        padding-right: 20px;
    }
    </style>
    {% endblock %}
    
    
    {% block content %}
    {{block.super}}
    <form method="POST" action="{% url hdabo.views.all_tags %}">
    {% csrf_token %}
    <p>Chercher : 
    {% for s in search_def %}
    <a href="{% url hdabo.views.all_tags num_page=1, nb_by_page=nb_by_page, sort=sort, searched=s.1 %}">{{s.0}}</a>
    {% endfor %}
    <input type="text" name="searched" value="{% if searched %}{{searched}}{% endif %}" id="searched" />
    </p>
    <p>Tags {{ current_page.start_index }} à {{ current_page.end_index }} sur {{ nb_total }}</p>
    <div id="count_nav_top"><p>
        {% if searched and searched != "" %}
            <a href="{% url hdabo.views.all_tags num_page=1, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&lt;&lt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=prev_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&lt;</a>&nbsp;&nbsp;
            {{ num_page }}/{{ last_page }}&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=next_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&gt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=last_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&gt;&gt;</a></p>
        {% else %}
            <a href="{% url hdabo.views.all_tags num_page=1, nb_by_page=nb_by_page, sort=sort %}">&lt;&lt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=prev_page, nb_by_page=nb_by_page, sort=sort %}">&lt;</a>&nbsp;&nbsp;
            {{ num_page }}/{{ last_page }}&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=next_page, nb_by_page=nb_by_page, sort=sort %}">&gt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=last_page, nb_by_page=nb_by_page, sort=sort %}">&gt;&gt;</a>
        {% endif %}</p>
    </div>
    <input type="hidden" name="num_page" value="{{num_page}}" id="num_page" />
    <input type="hidden" name="nb_by_page" value="{{nb_by_page}}" id="nb_by_page" />
    <input type="hidden" name="searched_str" value="{% if searched %}{{searched}}{% endif %}" id="searched_str" />
    <input type="hidden" name="sort" value="{% if sort %}{{sort}}{% endif %}" id="sort" />
    <div id="tag_table_container">
    {% include "partial/all_tags_table.html" %}
    </div>
    <div id="count_nav_bottom"><p>
        {% if searched and searched != "" %}
            <a href="{% url hdabo.views.all_tags num_page=1, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&lt;&lt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=prev_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&lt;</a>&nbsp;&nbsp;
            {{ num_page }}/{{ last_page }}&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=next_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&gt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=last_page, nb_by_page=nb_by_page, sort=sort, searched=searched %}">&gt;&gt;</a></p>
        {% else %}
            <a href="{% url hdabo.views.all_tags num_page=1, nb_by_page=nb_by_page, sort=sort %}">&lt;&lt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=prev_page, nb_by_page=nb_by_page, sort=sort %}">&lt;</a>&nbsp;&nbsp;
            {{ num_page }}/{{ last_page }}&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=next_page, nb_by_page=nb_by_page, sort=sort %}">&gt;</a>&nbsp;&nbsp;
            <a href="{% url hdabo.views.all_tags num_page=last_page, nb_by_page=nb_by_page, sort=sort %}">&gt;&gt;</a>
        {% endif %}</p>
    </div>
    {% endblock %}
