blob: 5efd9bd00883efbaacb28c6317b686c77a520abb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{% extends "base.html" %}
{% load static %}
{% block title %}
Joanna Lemon Resources - Resource List
{% 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 justify-content-between">
<div>
<a class="btn btn-primary" href="{% url 'resources:create_resource' %} ">Add a new resource</a>
</div>
<div class="bg-danger p-2 text-dark bg-white border border-1 border-danger">
Logged in as
<strong>{{ request.user.email }}</strong>
</div>
<div>
<form action="{% url 'account_logout' %}" method="post">
{% csrf_token %}
<button type="submit" class="btn btn-primary">Log out</button>
</form>
</div>
</div>
</div>
</div>
{% endif %}
<div class="row my-4">
<div class="col">
{% if resource_list %}
<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;">
<div class="card-header position-relative">
<div class="text-success">
Featured
<!-- <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">£5.99!</span> -->
</div>
</div>
<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 %}
</div>
{% else %}
<p>There are no resources</p>
{% endif %}
</div>
</div>
{% endblock content %}
|