diff options
author | 2021-09-04 17:31:05 -0400 | |
---|---|---|
committer | 2021-09-04 17:31:05 -0400 | |
commit | 990eebae44ba6f9328d8c15d02319f8c2a07f850 (patch) | |
tree | 2e0ba07eb2df3a7b5805a3e79e305e4adb0976c8 | |
parent | Rename `utils.py` to `resource_search.py`. (diff) |
Drop -Option from {topic,type,etc}Option.
Having -Option in the names was making the URL especially verbose.
-rw-r--r-- | pydis_site/apps/resources/views/resources.py | 8 | ||||
-rw-r--r-- | pydis_site/templates/resources/resources.html | 13 |
2 files changed, 10 insertions, 11 deletions
diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views/resources.py index a7c631dc..60ec6d8f 100644 --- a/pydis_site/apps/resources/views/resources.py +++ b/pydis_site/apps/resources/views/resources.py @@ -16,10 +16,10 @@ def resource_view(request: HttpRequest) -> HttpResponse: checkbox_options = { a: set(format_checkbox_options(request.GET.get(b))) for a, b in ( - ('topics', 'topicOption'), - ('type', 'typeOption'), - ('payment_tiers', 'paymentOption'), - ('complexity', 'complexityOption'), + ('topics', 'topic'), + ('type', 'type'), + ('payment_tiers', 'payment'), + ('complexity', 'complexity'), ) } diff --git a/pydis_site/templates/resources/resources.html b/pydis_site/templates/resources/resources.html index 2ae28725..e9695fff 100644 --- a/pydis_site/templates/resources/resources.html +++ b/pydis_site/templates/resources/resources.html @@ -29,7 +29,7 @@ {% for topic in topics_1 %} <div class="field"> <label class="checkbox"> - <input class="topic" name="topicOption" type="checkbox" value="{{ topic }}"{% if topic == 'General' %} checked{% endif %}> + <input class="topic" name="topic" type="checkbox" value="{{ topic }}"{% if topic == 'General' %} checked{% endif %}> <span class="has-text-grey is-size-6">{{ topic }}</span> </label> </div> @@ -39,7 +39,7 @@ {% for topic in topics_2 %} <div class="field"> <label class="checkbox"> - <input class="topic" name="topicOption" type="checkbox" value="{{ topic }}"{% if topic == 'General' %} checked{% endif %}> + <input class="topic" name="topic" type="checkbox" value="{{ topic }}"{% if topic == 'General' %} checked{% endif %}> <span class="has-text-grey is-size-6">{{ topic }}</span> </label> </div> @@ -57,7 +57,7 @@ {% for tag_type in tag_types %} <div class="field"> <label class="checkbox ml-0"> - <input class="type" name="typeOption" type="checkbox" value="{{ tag_type }}"{% if tag_type == 'Tutorial' %} checked{% endif %}> + <input class="type" name="type" type="checkbox" value="{{ tag_type }}"{% if tag_type == 'Tutorial' %} checked{% endif %}> <span class="has-text-grey is-size-6">{{ tag_type }}</span> </label> </div> @@ -73,7 +73,7 @@ {% for payment_tier in payment_tiers %} <div class="field"> <label class="checkbox ml-0"> - <input class="payment" name="paymentOption" type="checkbox" value="{{ payment_tier }}"{% if payment_tier == 'Free' %} checked{% endif %}> + <input class="payment" name="payment" type="checkbox" value="{{ payment_tier }}"{% if payment_tier == 'Free' %} checked{% endif %}> <span class="has-text-grey is-size-6">{{ payment_tier }}</span> </label> </div> @@ -89,7 +89,7 @@ {% for complexity in complexities %} <div class="field"> <label class="checkbox ml-0"> - <input class="complexity" name="complexityOption" type="checkbox" value="{{ complexity }}"{% if complexity == 'Beginner' %} checked{% endif %}> + <input class="complexity" name="complexity" type="checkbox" value="{{ complexity }}"{% if complexity == 'Beginner' %} checked{% endif %}> <span class="has-text-grey is-size-6">{{ complexity }}</span> </label> </div> @@ -147,8 +147,7 @@ <script> "use strict"; const initialParams = new URLSearchParams(window.location.search); - const checkboxOptions = ['topicOption', 'typeOption', 'paymentOption', 'complexityOption']; - // const topicOptions = document.querySelectorAll("input[name='topicOption']"); + const checkboxOptions = ['topic', 'type', 'payment', 'complexity']; const createQuerySelect = (opt) => { return "input[name=" + opt + "]" |