aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-01 19:32:08 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-01 19:32:08 +0100
commitc763111cdc6bcba0138886fa8ad7945f9688431b (patch)
tree9bfe29bf8935f1b9a91f8b44a8ede37a582c1d8a
parent511786f9ad75bd20157f3cbff1b17e48ac9734f5 (diff)
Improved resource list layout
- "horizontal" arrangement of standard resources
-rw-r--r--pyblackbird_cc/templates/resources/resource_card_featured.html (renamed from pyblackbird_cc/templates/resources/resource_card.html)2
-rw-r--r--pyblackbird_cc/templates/resources/resource_card_standard.html57
-rw-r--r--pyblackbird_cc/templates/resources/resource_list.html6
3 files changed, 60 insertions, 5 deletions
diff --git a/pyblackbird_cc/templates/resources/resource_card.html b/pyblackbird_cc/templates/resources/resource_card_featured.html
index a7b03e3..2d11ee8 100644
--- a/pyblackbird_cc/templates/resources/resource_card.html
+++ b/pyblackbird_cc/templates/resources/resource_card_featured.html
@@ -1,6 +1,6 @@
+{% load static %}
{% load markdown_extras %}
-
<div class="card mx-2 mt-2 shadow-sm" style="border-color: {{ resource.main_resource_category_colour_css_class }}; border-width: 3px;">
<img class="card-img-top"
src="{{ resource.thumbnail_urls|first }}"
diff --git a/pyblackbird_cc/templates/resources/resource_card_standard.html b/pyblackbird_cc/templates/resources/resource_card_standard.html
new file mode 100644
index 0000000..8dc6fba
--- /dev/null
+++ b/pyblackbird_cc/templates/resources/resource_card_standard.html
@@ -0,0 +1,57 @@
+{% load static %}
+{% load markdown_extras %}
+
+<!-- Card 1 -->
+<div class="col-md-6 mb-3">
+
+ <div class="card mx-2 mt-2 shadow-sm" style="border-color: {{ resource.main_resource_category_colour_css_class }}; border-width: 1px;">
+ <div class="row g-0">
+ <div class="col-4">
+ <img class="img-fluid rounded-start"
+ src="{{ resource.thumbnail_urls|first }}"
+ alt="{{ resource.thumbnail_filename }}">
+ </div>
+ <div class="col-8">
+ <div class="card-body">
+ <div class="d-flex flex-row justify-content-start align-content-center">
+ <h5 class="card-title"><a
+ href="{% url 'resources:resource_detail' resource_id=resource.id %}">{{ resource.name }}</a></h5>
+ </div>
+ <div>
+ <span class="badge bg-secondary me-2">{{ resource.age_range }}</span>
+ </div>
+ <div>
+ {% if resource.main_resource_category_name == "English as a Foreign Language (EFL)" %}
+ <span class="badge me-2"
+ style="background-color: {{ resource.main_resource_category_colour_css_class }}; color: {{ resource.main_resource_badge_foreground_colour }}">EFL</span>
+ {% else %}
+ <span class="badge me-2"
+ style="background-color: {{ resource.main_resource_category_colour_css_class }}; color: {{ resource.main_resource_badge_foreground_colour }}">{{ resource.main_resource_category_name }}</span>
+ {% endif %}
+ </div>
+ {% if request.user.is_authenticated and request.user.is_staff %}
+ <div>
+ <span class="badge bg-info me-2">Feature slot: {{ resource.feature_slot }}</span>
+ </div>
+ {% endif %}
+{# {% if resource.card_description %}#}
+{# <p class="card-text my-2">{{ resource.card_description | markdown | safe }}</p>#}
+{# {% else %}#}
+{# <p class="card-text my-2">{{ resource.description | markdown | safe }}</p>#}
+{# {% endif %}#}
+ <p class="card-text"><small class="text-muted">FREE</small></p>
+ </div>
+ </div>
+ {% if request.user.is_authenticated and request.user.is_staff %}
+ <div class="card-footer">
+ <a href="{% url 'resources:resource_update_metadata' resource.id %}"
+ class="btn btn-outline-primary btn-sm">Edit</a>
+ <a href="{% url 'resources:resource_update_thumbnails' resource.id %}"
+ class="btn btn-outline-primary btn-sm">Edit Feature Images</a>
+ <a href="{% url 'resources:resource_update_pdfs' resource.id %}"
+ class="btn btn-outline-primary btn-sm">Add PDFs</a>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/pyblackbird_cc/templates/resources/resource_list.html b/pyblackbird_cc/templates/resources/resource_list.html
index 7be49c6..fce5f60 100644
--- a/pyblackbird_cc/templates/resources/resource_list.html
+++ b/pyblackbird_cc/templates/resources/resource_list.html
@@ -23,7 +23,7 @@
{% elif featured_resources|length == 3 %}
<div class="col-lg-4 col-md-6 col-sm-12 mb-4">
{% endif %}
- {% include "resources/resource_card.html" with resource=featured_resource %}
+ {% include "resources/resource_card_featured.html" with resource=featured_resource %}
</div>
{% endfor %}
</div>
@@ -41,9 +41,7 @@
<div class="d-flex flex-row flex-wrap">
{% for resource in resource_list %}
- <div class="col">
- {% include "resources/resource_card.html" with resource=resource %}
- </div>
+ {% include "resources/resource_card_standard.html" with resource=resource %}
{% endfor %}
</div>
{% else %}