{% extends "base.html" %}

{% block title %} | Dashboard{% endblock %}

{% block main %}
        <div class="page-header">
            <div class="container">
                <h1>Welcome, {{user.display_name}}.</h1>
            </div>
        </div>
        <div class="container">
            {% include 'snippets/messages.html' %}
            <div class="row">
                <div class="col-md-8">
                    <h3 class="header">
                        Manage your projects
                        {% if admin_projects %} <a href="{% url 'admin:project_create' %}" class="pull-right btn btn-sm btn-success"><span class="glyphicon glyphicon-plus"></span> Create new Project</a>{% endif %}
                    </h3>
                    {% for project in admin_projects %}

                    {% if forloop.first %}
                    <ul class="list-unstyled overview-list">
                    {% endif %}

                    <li>
                        <h3>
                            <a href="{% url 'admin:project_overview' project.id %}">{{project.name}}</a>
                            {% if project.isprivate %}<span class="label label-info">Private</span>{% else %}<span class="label label-info">Public</span>{% endif %}
                            {% if project.status == status_types.inactive %}<span class="label label-default">Inactive</span>{% endif %}
                        </h3>
                        {% if project.description %}<p>{{project.description}}</p>{% endif %}
                        <p class="meta">Created by {{ project.creator.display_name }}</p>
                    </li>

                    {% if forloop.last %}
                    </ul>
                    {% endif %}

                    {% empty %}
                        <div class="well empty-list">
                            <p class="lead">We couldn't find any projects you are eligible to manage.</p>
                            <p>You can create a new project if you want to start your own community map.</p>
                            <a href="{% url 'admin:project_create' %}" class="btn btn-success btn-lg">Create a new project</a>
                        </div>
                    {% endfor %}
                </div>
                <div class="col-md-4">
                    <div class="panel panel-default">
                        <div class="list-group">
                            <a class="list-group-item" href="{% url 'admin:app_overview' %}">Your applications</a>
                            {% if user.is_superuser %}<a class="list-group-item" href="{% url 'admin:superuser_projects' %}">Super-user tools</a>{% endif %}
                            {% if involved_projects %}<a class="list-group-item" href="{% url 'admin:projects_involved' %}">Other projects</a>{% endif %}
                        </div>
                    </div>

                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">Extensions</h3>
                        </div>
                        <div class="list-group">
                            {% for extension in extensions %}
                                <a href="{% url extension.index_url %}" class="list-group-item">{{ extension.name }}</a>
                            {% empty %}
                            <div class="list-group-item">
                                No extensions have been installed.
                            </div>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>
{% endblock %}
