diff options
author | 2021-07-24 18:22:59 -0500 | |
---|---|---|
committer | 2021-07-24 18:22:59 -0500 | |
commit | 156951f12c05146650a84d4ac9d45e7a8a085023 (patch) | |
tree | cf206804c0a7183c251f7138928dee3bfa10e679 /pydis_site/apps/resources/views/resources.py | |
parent | add function to gather tags from resource yaml files (diff) |
add constant for resource tags. Add Functional front end
This change adds a fully functional front end menu for testing. This is a very rough outline and will need a bit of UI and UX love to get working fully. Should act as an example of functionality
Diffstat (limited to 'pydis_site/apps/resources/views/resources.py')
-rw-r--r-- | pydis_site/apps/resources/views/resources.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views/resources.py index dfd21682..f88a23fb 100644 --- a/pydis_site/apps/resources/views/resources.py +++ b/pydis_site/apps/resources/views/resources.py @@ -1,11 +1,24 @@ -from django.views.generic import TemplateView from django.shortcuts import render -# class ResourcesView(TemplateView): -# """View for resources index page.""" -# -# template_name = "resources/resources.html" +from pydis_site.apps.resources.utils import get_resources_meta + +RESOURCE_META_TAGS = get_resources_meta() + + +def format_checkbox_options(options: str) -> list: + """Split up the comma separated parameters into a list.""" + if options: + return options.split(",")[:-1] + return list() def resource_view(request): - return render(request, template_name="resources/resources.html") + """View for resources index page.""" + context = { + "checkboxOptions": format_checkbox_options(request.GET.get("checkboxOptions")), + "topics": RESOURCE_META_TAGS.get("topics"), + "tag_types": RESOURCE_META_TAGS.get("type"), + "payment_tiers": RESOURCE_META_TAGS.get("payment_tiers"), + "complexities": RESOURCE_META_TAGS.get("complexity") + } + return render(request, template_name="resources/resources.html", context=context) |