aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/resources/resource_box.html
blob: 6a9729dfff93b12618aeb9bea9ee18e8303315cb (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
73
74
75
76
77
78
79
{% load as_icon %}
{% load to_kebabcase %}
{% load get_category_icon %}

<div class="box resource-box has-background-white-bis {{ resource.css_classes }}" data-resource-name="{{ resource.name }}">
    {% if 'title_url' in resource %}
        <a href="{{ resource.title_url }}">
            {% include "resources/resource_box_header.html" %}
        </a>
    {% else %}
        {% include "resources/resource_box_header.html" %}
    {% endif %}

    <p>{{ resource.description|safe }}</p>

    <div class="is-flex is-align-items-center">
        {# Add primary link #}
        {% if "title_url" in resource %}
            <span class="icon is-size-4" style="margin: 5px;">
                <a href="{{ resource.title_url }}">
                    <i class="fas fa-external-link-alt fa-fw is-size-4 resource-icon is-hoverable is-primary"></i>
                </a>
            </span>
        {% endif %}

        {# Add all additional icon #}
        {% for icon in resource.urls %}
            <span class="icon is-size-4" style="margin: 5px;">
                <a href="{{ icon.url }}">
                    <i class="{{ icon.icon|as_icon }} fa-fw is-size-4 resource-icon is-hoverable is-{{ icon.color }}"></i>
                </a>
            </span>
        {% endfor %}

        {#  Tags #}
        <div class="resource-tag-container is-flex ml-auto is-flex-wrap-wrap is-justify-content-end">
            {% for tag in resource.tags.topics %}
            <span
                class="tag resource-tag is-primary is-light ml-2 mt-2"
                data-filter-name="topics"
                data-filter-item="{{ tag|to_kebabcase }}"
            >
                <i class="{{ tag|title|get_category_icon }} mr-1"></i>
                {{ tag|title }}
            </span>
            {% endfor %}
            {% for tag in resource.tags.type %}
            <span
                class="tag resource-tag has-background-success-light has-text-success-dark ml-2 mt-2"
                data-filter-name="type"
                data-filter-item="{{ tag|to_kebabcase }}"
            >
                <i class="{{ tag|title|get_category_icon }} mr-1"></i>
                {{ tag|title }}
            </span>
            {% endfor %}
            {% for tag in resource.tags.payment_tiers %}
            <span
                class="tag resource-tag has-background-danger-light has-text-danger-dark ml-2 mt-2"
                data-filter-name="payment-tiers"
                data-filter-item="{{ tag|to_kebabcase }}"
            >
                <i class="{{ tag|title|get_category_icon }} mr-1"></i>
                {{ tag|title }}
            </span>
            {% endfor %}
            {% for tag in resource.tags.difficulty %}
            <span
                class="tag resource-tag has-background-info-light has-text-info-dark ml-2 mt-2"
                data-filter-name="difficulty"
                data-filter-item="{{ tag|to_kebabcase }}"
            >
                <i class="{{ tag|title|get_category_icon }} mr-1"></i>
                {{ tag|title }}
            </span>
            {% endfor %}
        </div>
    </div>
</div>