diff options
author | 2021-08-22 13:19:14 -0400 | |
---|---|---|
committer | 2021-08-22 13:19:14 -0400 | |
commit | 595b6728edee309f8b098c2f7efb5a285c3be070 (patch) | |
tree | b527678d6b382e2317bd2306f9f8291ef3868229 /pydis_site/apps/resources | |
parent | Add nedbat's kindling projects. (diff) |
Make icon dict a constant; add project ideas icon.
Diffstat (limited to 'pydis_site/apps/resources')
-rw-r--r-- | pydis_site/apps/resources/templatetags/get_category_icon.py | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/pydis_site/apps/resources/templatetags/get_category_icon.py b/pydis_site/apps/resources/templatetags/get_category_icon.py index d8b47476..cfac7832 100644 --- a/pydis_site/apps/resources/templatetags/get_category_icon.py +++ b/pydis_site/apps/resources/templatetags/get_category_icon.py @@ -2,37 +2,38 @@ from django import template register = template.Library() +_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", + "Project Ideas": "fa-lightbulb-o", + "Software Design": "fa-paint-brush", + "Testing": "fa-vial", + "Tooling": "fa-toolbox", + "User Interface": "fa-desktop", + "Web Development": "fa-wifi", + "Discord Bots": "fa-robot", + "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": "fa-first-aid", + "Paid": "fa-sack", + "Subscription": "fa-credit-card", + "Beginner": "fa-play-circle", + "Intermediate": "fa-align-center" +} + @register.filter 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", - "Discord Bots": "fa-robot", - "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": "fa-first-aid", - "Paid": "fa-sack", - "Subscription": "fa-credit-card", - "Beginner": "fa-play-circle", - "Intermediate": "fa-align-center" - } - icon_name = icons[name] - return f'fa {icon_name}' + return f'fa {_ICONS[name]}' |