diff options
author | 2021-08-14 22:34:08 +0100 | |
---|---|---|
committer | 2021-08-14 22:34:08 +0100 | |
commit | cec38ecaedd000c1f6919e63cc8bab837b2f24f7 (patch) | |
tree | 85f8f08f91db55a7e98abfa768f34d54fac20004 /pydis_site/apps | |
parent | chore: Split Topic column into two columns (diff) |
chore: Add tag to resource boxes
Diffstat (limited to 'pydis_site/apps')
-rw-r--r-- | pydis_site/apps/resources/templatetags/get_category_icon.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pydis_site/apps/resources/templatetags/get_category_icon.py b/pydis_site/apps/resources/templatetags/get_category_icon.py new file mode 100644 index 00000000..683f2c98 --- /dev/null +++ b/pydis_site/apps/resources/templatetags/get_category_icon.py @@ -0,0 +1,37 @@ +from django import template + +register = template.Library() + + +def get_category_icon(name: str) -> str: + """Get icon of a specific resource category.""" + icons = { + "Algorithms And Data Structures": "fa-cogs", + "Data Science": "fa-flask", + "Databases": "fa-server", + "Game Development": "fa-joystick", + "General": "fa-book", + "Microcontrollers": "fa-microchip", + "Other": "fa-question-circle", + "Software Design": "fa-paint-brush", + "Testing": "fa-vial", + "Tooling": "fa-toolbox", + "User Interface": "fa-desktop", + "Web Development": "fa-wifi", + "Book": "fa-book", + "Community": "fa-users", + "Course": "fa-chalkboard-teacher", + "Interactive": "fa-mouse-pointer", + "Podcast": "fa-microphone-alt", + "Tool": "fa-tools", + "Tutorial": "fa-clipboard-list", + "Video": "fa-video", + "Free": "f", + "Paid": "fa-sack", + "Subscription": "fa-vault", + "Beginner": "fa-play-circle", + "Intermediate": "fa-align-center" + } + icon_name = icons[name] + return f'fa {icon_name}' |