aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/templates
diff options
context:
space:
mode:
Diffstat (limited to 'pyblackbird_cc/templates')
-rw-r--r--pyblackbird_cc/templates/resources/resource_list.html140
1 files changed, 91 insertions, 49 deletions
diff --git a/pyblackbird_cc/templates/resources/resource_list.html b/pyblackbird_cc/templates/resources/resource_list.html
index 046aa7f..eb2506a 100644
--- a/pyblackbird_cc/templates/resources/resource_list.html
+++ b/pyblackbird_cc/templates/resources/resource_list.html
@@ -2,71 +2,113 @@
{% load static %}
-{% block title %}
+ {% block title %}
Joanna Lemon Learning - Resource List
-{% endblock title %}
-{% block content %}
+ {% endblock title %}
+ {% block content %}
{% if request.user.is_authenticated and request.user.is_staff %}
- <div class="row bg-white p-4 rounded border border-success border-opacity-25">
- <h5 class="text-decoration-underline">Admin bar</h5>
- <p>
- Only you will see this bar - normal users will not see it. It allows us to
- include buttons for adding new resources, etc.
- </p>
- <div class="col">
- <div class="d-flex flex-row flex-wrap justify-content-between">
- <div>
- <a class="btn btn-primary my-md-2"
- href="{% url 'resources:create_resource' %} ">Add a new resource</a>
- </div>
- <div class="bg-danger p-2 my-2 text-dark bg-white border border-1 border-danger">
- Logged in as
- <strong>{{ request.user.email }}</strong>
- </div>
- <div class="my-md-2">
- <form action="{% url 'account_logout' %}" method="post">
- {% csrf_token %}
- <button type="submit" class="btn btn-primary">Log out</button>
- </form>
- </div>
+ <div class="row bg-white p-4 rounded border border-success border-opacity-25">
+ <h5 class="text-decoration-underline">Admin bar</h5>
+ <p>
+ Only you will see this bar - normal users will not see it. It allows us to
+ include buttons for adding new resources, etc.
+ </p>
+ <div class="col">
+ <div class="d-flex flex-row flex-wrap justify-content-between">
+ <div>
+ <a class="btn btn-primary my-md-2"
+ href="{% url 'resources:create_resource' %} ">Add a new resource</a>
+ </div>
+ <div class="bg-danger p-2 my-2 text-dark bg-white border border-1 border-danger">
+ Logged in as
+ <strong>{{ request.user.email }}</strong>
+ </div>
+ <div class="my-md-2">
+ <form action="{% url 'account_logout' %}" method="post">
+ {% csrf_token %}
+ <button type="submit" class="btn btn-primary">Log out</button>
+ </form>
</div>
</div>
</div>
- {% endif %}
- <div class="row my-4 text-center">
- <div class="col">
- <h5 class="display-6">Featured resources</h5>
- </div>
</div>
+ {% endif %}
+
<div class="row my-4">
+
+ <!-- Featured resources first -->
<div class="col">
- {% if resource_list %}
+ {% if featured_resources %}
+ <div class="row my-4 text-center">
+ <div class="col">
+ <h5 class="display-6">Featured resources</h5>
+ </div>
+ </div>
+ <div class="d-flex flex-row justify-content-between flex-wrap">
+ {% for resource in featured_resources %}
+ <div class="card mx-2 mt-2" style="width: 22rem;">
+ <img class="card-img-top"
+ src="{{ resource.thumbnail_urls|first }}"
+ alt="{{ resource.thumbnail_filename }}" />
+ <div class="card-body">
+ <h5 class="card-title">{{ resource.name }}</h5>
+ <div class="d-flex flex-row justify-content-start align-content-center">
+ <div>
+ <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span>
+ </div>
+ <div>
+ <span class="badge bg-secondary me-2">{{ resource.age_range }}</span>
+ </div>
+ </div>
+ <p class="card-text my-3">{{ resource.description }}</p>
+ <a href="{% url 'resources:resource_detail' resource_id=resource.id %}"
+ class="btn btn-primary">Details</a>
+ </div>
+ </div>
+ {% endfor %}
+ {% else %}
+ <p>There are no featured resources</p>
+ {% endif %}
+ </div>
+ </div>
+
+ <div class="d-flex flex-row justify-content-between flex-wrap">
+
+ <div class="col">
+ {% if resource_list %}
+ <div class="row my-4 text-center">
+ <div class="col">
+ <h5 class="display-6">Standard resources</h5>
+ </div>
+ </div>
<div class="d-flex flex-row justify-content-between flex-wrap">
{% for resource in resource_list %}
- <div class="card mx-2 mt-2" style="width: 22rem;">
- <img class="card-img-top"
- src="{{ resource.thumbnail_urls|first }}"
- alt="{{ resource.thumbnail_filename }}" />
- <div class="card-body">
- <h5 class="card-title">{{ resource.name }}</h5>
- <div class="d-flex flex-row justify-content-start align-content-center">
- <div>
- <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span>
- </div>
- <div>
- <span class="badge bg-secondary me-2">{{ resource.age_range }}</span>
- </div>
+ <div class="card mx-2 mt-2" style="width: 22rem;">
+ <img class="card-img-top"
+ src="{{ resource.thumbnail_urls|first }}"
+ alt="{{ resource.thumbnail_filename }}" />
+ <div class="card-body">
+ <h5 class="card-title">{{ resource.name }}</h5>
+ <div class="d-flex flex-row justify-content-start align-content-center">
+ <div>
+ <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span>
+ </div>
+ <div>
+ <span class="badge bg-secondary me-2">{{ resource.age_range }}</span>
</div>
- <p class="card-text my-3">{{ resource.description }}</p>
- <a href="{% url 'resources:resource_detail' resource_id=resource.id %}"
- class="btn btn-primary">Details</a>
</div>
+ <p class="card-text my-3">{{ resource.description }}</p>
+ <a href="{% url 'resources:resource_detail' resource_id=resource.id %}"
+ class="btn btn-primary">Details</a>
</div>
+ </div>
{% endfor %}
</div>
+ </div>
+
{% else %}
- <p>There are no resources</p>
+ <p>There are no resources</p>
{% endif %}
</div>
</div>
-{% endblock content %}
+ {% endblock content %}