aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/templates/resources/resource_card_featured.html
blob: c24892269bd766c235126ca259682dc4ffec963b (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
{% load static %}
{% load markdown_extras %}

<div class="featured-card" style="border-color: {{ resource.main_resource_category_colour_css_class }};">
    <div class="featured-img">
        <img src="{{ resource.thumbnail_urls|first }}" alt="{{ resource.thumbnail_filename }}">
    </div>
    <div>
        <a class="card-title-link" href="{% url 'resources:resource_detail' resource_id=resource.id %}">{{ resource.name }}</a>
        <div class="card-metadata-row">
            <span>{{ resource.age_range }}</span>
            {% if resource.main_resource_category_name == "English as a Foreign Language (EFL)" %}
                <span class="card-category-badge" style="background-color: {{ resource.main_resource_category_colour_css_class }}; color: {{ resource.main_resource_badge_foreground_colour }}">EFL</span>
            {% else %}
                <span class="card-category-badge"  style="background-color: {{ resource.main_resource_category_colour_css_class }}; color: {{ resource.main_resource_badge_foreground_colour }}">{{ resource.main_resource_category_name }}</span>
            {% endif %}
            {% if request.user.is_authenticated and request.user.is_staff %}
                <span>Feature slot: {{ resource.feature_slot }}</span>
            {% endif %}
        </div>
        <hr>
        <div>
            <p class="featured-card-description">{{ resource.card_description }}</p>
        </div>
        <div>
            <p class="card-credit">1 credit</p>
            <p>{{ resource.price }}</p>
            {% if resource.in_cart %}
            <form action="{% url 'payments:add_to_basket' resource.id %}" method="POST">
                {% csrf_token %}
                <button type="submit" class="add-to-basket-button-disabled" disabled>In basket</button>
            </form>
            {% else %}
            <form action="{% url 'payments:add_to_basket' resource.id %}" method="POST">
                {% csrf_token %}
                <button type="submit" class="add-to-basket-button">Add to basket</button>
            </form>
            {% endif %}
        </div>
    </div>

    {% if request.user.is_authenticated and request.user.is_staff %}
    <div>
        <a href="{% url 'resources:resource_update_metadata' resource.id %}">Edit</a>
        <a href="{% url 'resources:resource_update_thumbnails' resource.id %}">Edit Feature Images</a>
        <a href="{% url 'resources:resource_update_pdfs' resource.id %}">Add PDFs</a>
    </div>
    {% endif %}
</div>