{% extends 'core_main_app/_render/admin/theme/tools/box.html' %}

{% block box_title %}

    {% if data.title %}
        {{data.title}}
    {% else %}
        {% if come_from_admin %} {{ data.document|title}}s list {% else %} My {{data.document}}s {% endif %}
    {% endif %}

{% endblock %}


{% block box_tools %}
    {% if data.create_workspace %}
    <a class="btn btn-default create-workspace-btn">
        <i class="fa fa-file-text-o"></i> Create workspace
    </a>
    {% endif %}

    {% if data.title %}
        <a href="#" class="btn btn-default back-to-previous">
             <i class="fa fa-arrow-left"></i> Previous page
        </a>
    {% endif %}
{% endblock %}


{% block box_body %}

{% if data.user_data %}
    Total number of {{data.document}}s: {{ data.number_total }}
{% endif %}

    {% if data.menu and not data.title %}
        <div class="dropdown" id="id_actions" style="display:none">
            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                Choose action
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                {% for value, text in data.action_form.fields.actions.choices %}
                    <li style="cursor:  pointer;" onclick="action_dashboard({{value}});">{{text}}</li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}

    {% if data.resources %}

        {% include 'core_main_registry_app/resource_banner/resource_banner.html' %}

        <br/>

            <ul class="nav nav-tabs">
                    {% if data.ispublished == None %} <li id="all" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('None', '');">All</a></li>
                    {% if data.ispublished == 'true' %} <li id="published" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('true', '');">Published</a></li>
                    {% if data.ispublished == 'false' %} <li id="notpublished" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('false', '');">Not Published</a></li>
                    {% if data.ispublished == 'draft' %} <li id="draft" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('draft', '');">Drafts</a></li>            </ul>

        <br/>
    {% endif %}

    <div class="tab-content">
        {% if data.user_data %}
            {% include data.template with objects=data.user_data group='user' %}
        {% else %}
            No {{data.document}}s found.
        {% endif %}
    </div>
{% endblock %}


