{% extends "layout.html" %}
{% block homepage_link_class %}active{% endblock %}
{% block body %}
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#addResource">Add new resource</button>
<div id="addResource" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Add resource</h4>
            </div>
            <div class="modal-body">
                <form method="POST" action="{{ url_for('main.home') }}" enctype=multipart/form-data>
                    {{ form.csrf_token }}
                    {{ form.new_resource_name.label }} {{ form.new_resource_name }}
                    <input id="add_new_resource" value="Add" type="submit">
                </form>
            </div>
        </div>
    </div>
</div>
{% if resources %}
    <ul class="list-group">
        {% for resource in resources %}
            <li class="list-group-item">
                <a href="{{ url_for('main.resource', resource_pk=resource.pk) }}">
                    {{ resource.name }}
                </a>
            </li>
        {% endfor %}
    </ul>
{% else %}
<p>There are no resources.</p>
{% endif %}

{% endblock %}
