{% extends "base.html" %}
{% block extra_head %}
<link rel="stylesheet" href="{{ static_url('/static/css/admin.css') }}">
<link rel="stylesheet" href="{{ static_url('/static/css/moderation.css') }}">
{% endblock %}
{% block content %}
<div class="page-narrow">
    <h1>Published workspaces</h1>
    <p class="report-intro">Every workspace a DevPlace member has published to the public ingress, with its owner, its project and the direct link that opens it. {{ total }} published.</p>

    <table class="admin-table">
        <caption class="sr-only">Workspaces published to the public ingress</caption>
        <thead>
            <tr>
                <th scope="col">Workspace</th>
                <th scope="col">Owner</th>
                <th scope="col">Project</th>
                <th scope="col">Label</th>
                <th scope="col">Link</th>
                <th scope="col">Report</th>
            </tr>
        </thead>
        <tbody>
            {% for workspace in workspaces %}
            <tr>
                <td>
                    {{ workspace.name }}
                    {% if workspace.description %}<span class="workspace-desc">{{ workspace.description[:160] }}</span>{% endif %}
                </td>
                <td>{% if workspace.owner %}<a href="/profile/{{ workspace.owner }}">{{ workspace.owner }}</a>{% else %}-{% endif %}</td>
                <td>{% if workspace.project_url %}<a href="{{ workspace.project_url }}">Project</a>{% else %}-{% endif %}</td>
                <td><span class="status-badge status-{{ 'dismissed' if workspace.maturity == 'general' else 'open' }}">{{ workspace.maturity }}</span></td>
                <td><a href="{{ workspace.url }}" rel="noopener">{{ workspace.url }}</a></td>
                <td>{% set _type = "workspace" %}{% set _uid = workspace.uid %}{% set _owner = workspace.owner_uid %}{% set _owner_name = "" %}{% set _class = "admin-btn admin-btn-sm" %}{% include "_report_button.html" %}</td>
            </tr>
            {% else %}
            <tr><td colspan="6" class="empty-state">No workspaces are published yet.</td></tr>
            {% endfor %}
        </tbody>
    </table>

    {% include "_pagination.html" %}
</div>
{% endblock %}
