diff options
author | Matthew Lemon <y@yulqen.org> | 2024-08-02 16:17:53 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-08-02 16:17:53 +0100 |
commit | a75aca148ba7db29e14e30f2e0707b1efac1ff94 (patch) | |
tree | fad1d439446507f59377115267b6143de643885e /pyblackbird_cc/templates/resources/resource_card.html | |
parent | 27576670437e9edd139bae93efc5bd9577f83e35 (diff) |
Refactored list template into includes to fix div hell.
Diffstat (limited to '')
-rw-r--r-- | pyblackbird_cc/templates/resources/resource_card.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pyblackbird_cc/templates/resources/resource_card.html b/pyblackbird_cc/templates/resources/resource_card.html new file mode 100644 index 0000000..67807cc --- /dev/null +++ b/pyblackbird_cc/templates/resources/resource_card.html @@ -0,0 +1,42 @@ +{% 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 }}" + alt="{{ resource.thumbnail_filename }}"> + <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 %} + </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> + </div> + {% endif %} +</div>
\ No newline at end of file |