{% load dict_key_extras %}

<table id="table-{{data.document}}-{{group}}" class="display data-table" style="margin-bottom: 0em; width:100%; border: None">
    <thead>
        <th>Title</th>
        <th>Owner</th>
        <th>Can read</th>
        <th>Can write</th>
        <th>Public</th>
        <th>Actions</th>
    </thead>
    <tbody>
        {% for object in objects %}
            <tr objectid="{{object.workspace.id}}">
                <td>{{ object.name }}</td>
                <td>{{ object.user }}</td>
                <td>{{ object.can_read }}</td>
                <td>{{ object.can_write }}</td>
                <td>{{ object.is_public }} </td>
                <td>

                    {% if come_from_admin %}
                        <a class="btn btn-default view-data-{{data.document}}-btn" objectid="{{ object.workspace.id }}"
                           href="{% url 'admin:core_dashboard_workspace_list_data' object.workspace.id %}">
                            <i class="fa fa-list"></i> View data
                        </a>
                    {% else %}
                        <a class="btn btn-default view-data-{{data.document}}-btn" objectid="{{ object.workspace.id }}"
                           href="{% url 'core_dashboard_workspace_list_data' object.workspace.id %}">
                            <i class="fa fa-list"></i> View data
                        </a>
                    {% endif %}

                    {% if object.is_owner %}
                        {% if come_from_admin %}
                            <a class="btn btn-default rights-document-btn"
                                href="{% url 'admin:core_main_edit_rights_workspace' object.workspace.id %}">
                                <i class="fa fa-edit"></i> Edit
                            </a>
                        {% else %}
                            <a class="btn btn-default rights-document-btn"
                                href="{% url 'core_main_edit_rights_workspace' object.workspace.id %}">
                                <i class="fa fa-edit"></i> Edit
                            </a>
                        {% endif %}

                        {% if not object.is_public %}
                            <a class="btn btn-default delete-document-btn">
                                <i class="fa fa-trash"></i> Delete
                            </a>

                            <a class="btn btn-default public-{{data.document}}-btn">
                                <i class="fa fa-users"></i> Set public
                            </a>
                        {% endif %}
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>