aboutsummaryrefslogblamecommitdiffstats
path: root/pyblackbird_cc/templates/resources/resource_list.html
blob: 5b11ff6173a96b509487d22b8c22095073d5f51f (plain) (tree)




























































                                                                                              
{% extends "base.html" %}

{% block title %}
  Joanna Lemon Resources - Resource List
{% endblock title %}
{% block content %}
  <div class="cella">
    {% if request.user.is_authenticated %}
      <div class="admin-links">
        <div>
          <a href="{% url 'resources:create_resource' %} ">Add a new resource</a>
        </div>
        <div>
          <form action="{% url 'account_logout' %}" method="post">
            {% csrf_token %}
            <button type="submit">Log out</button>
          </form>
        </div>
      </div>
    {% endif %}
    {% if resource_list %}
      {% for resource in resource_list %}
        <div class="resource-metadata-panel">
          <div>
            <a class="no-underline"
               href="{% url 'resources:resource_detail' resource_id=resource.id %}">
              <h1 class="resource-title">{{ resource.name }}</h1>
            </a>
          </div>
          <div>
            <div>Main category: {{ resource.main_resource_category_name }}</div>
            {% if resource.additional_resource_category_name %}
              <div>Additional category: {{ resource.additional_resource_category_name }}</div>
            {% endif %}
          </div>
        </div>
        <div>
          <div class="resource-img-detail">
            {% for img in resource.thumbnail_urls %}
              <img style="max-height: 400px;
                          width: auto"
                   src="{{ img }}"
                   alt="{{ resource.thumbnail_filename }}" />
            {% endfor %}
          </div>
          <div>
            Click
            <button hx-get="/hx-download-btn?rn={{ resource.pdf_filename }}"
                    hx-target="next #download-reveal">here</button>
            to download the resource
          </div>
          <div id="download-reveal"></div>
          <hr />
        </div>
      {% endfor %}
    {% else %}
      <p>There are no resources</p>
    {% endif %}
  </div>
  <div>Logged in as {{ request.user.username }}</div>
{% endblock content %}