aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2022-01-30 14:29:48 +0100
committerGravatar Leon Sandøy <[email protected]>2022-01-30 14:29:48 +0100
commitdda3e355ac31dc4b9629f2e9e63474bbba69d740 (patch)
treefd73941134e394abc8bddd71c5fb9bed9b91f816
parentRemove italics from resource cards. (diff)
Refactor: collapsibles as a stand-alone component
-rw-r--r--pydis_site/apps/resources/urls.py1
-rw-r--r--pydis_site/static/css/collapsibles.css12
-rw-r--r--pydis_site/static/css/content/page.css13
-rw-r--r--pydis_site/static/js/collapsibles.js (renamed from pydis_site/static/js/content/page.js)0
-rw-r--r--pydis_site/static/js/resources/resources.js (renamed from pydis_site/static/js/resources.js)0
-rw-r--r--pydis_site/templates/content/base.html3
-rw-r--r--pydis_site/templates/resources/resources.html6
7 files changed, 18 insertions, 17 deletions
diff --git a/pydis_site/apps/resources/urls.py b/pydis_site/apps/resources/urls.py
index aa3892b6..044f7072 100644
--- a/pydis_site/apps/resources/urls.py
+++ b/pydis_site/apps/resources/urls.py
@@ -31,6 +31,7 @@ VALID_RESOURCE_TYPES = [
def get_all_pages() -> typing.Iterator[dict[str, str]]:
+ """Get all the valid options for the resource_type path selector."""
for resource_type in VALID_RESOURCE_TYPES:
yield {"resource_type": resource_type}
diff --git a/pydis_site/static/css/collapsibles.css b/pydis_site/static/css/collapsibles.css
new file mode 100644
index 00000000..7b76d8d5
--- /dev/null
+++ b/pydis_site/static/css/collapsibles.css
@@ -0,0 +1,12 @@
+.collapsible {
+ cursor: pointer;
+ width: 100%;
+ border: none;
+ outline: none;
+}
+
+.collapsible-content {
+ overflow: hidden;
+ max-height: 0;
+ transition: max-height 0.2s ease-out;
+} \ No newline at end of file
diff --git a/pydis_site/static/css/content/page.css b/pydis_site/static/css/content/page.css
index 2d4bd325..d831f86d 100644
--- a/pydis_site/static/css/content/page.css
+++ b/pydis_site/static/css/content/page.css
@@ -77,16 +77,3 @@ ul.menu-list.toc {
li img {
margin-top: 0.5em;
}
-
-.collapsible {
- cursor: pointer;
- width: 100%;
- border: none;
- outline: none;
-}
-
-.collapsible-content {
- overflow: hidden;
- max-height: 0;
- transition: max-height 0.2s ease-out;
-}
diff --git a/pydis_site/static/js/content/page.js b/pydis_site/static/js/collapsibles.js
index 366a033c..366a033c 100644
--- a/pydis_site/static/js/content/page.js
+++ b/pydis_site/static/js/collapsibles.js
diff --git a/pydis_site/static/js/resources.js b/pydis_site/static/js/resources/resources.js
index 718e1e88..718e1e88 100644
--- a/pydis_site/static/js/resources.js
+++ b/pydis_site/static/js/resources/resources.js
diff --git a/pydis_site/templates/content/base.html b/pydis_site/templates/content/base.html
index 00f4fce4..4a19a275 100644
--- a/pydis_site/templates/content/base.html
+++ b/pydis_site/templates/content/base.html
@@ -7,7 +7,8 @@
<meta property="og:type" content="website" />
<meta property="og:description" content="{{ page_description }}" />
<link rel="stylesheet" href="{% static "css/content/page.css" %}">
- <script src="{% static "js/content/page.js" %}"></script>
+ <link rel="stylesheet" href="{% static "css/collapsibles.css" %}">
+ <script src="{% static "js/collapsibles.js" %}"></script>
{% endblock %}
{% block content %}
diff --git a/pydis_site/templates/resources/resources.html b/pydis_site/templates/resources/resources.html
index c3881092..80577c2b 100644
--- a/pydis_site/templates/resources/resources.html
+++ b/pydis_site/templates/resources/resources.html
@@ -7,10 +7,10 @@
{% block title %}Resources{% endblock %}
{% block head %}
<link rel="stylesheet" href="{% static "css/resources/resources.css" %}">
- <link rel="stylesheet" href="{% static "css/content/page.css" %}">
+ <link rel="stylesheet" href="{% static "css/collapsibles.css" %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
- <script defer src="{% static "js/resources.js" %}"></script>
- <script defer src="{% static "js/content/page.js" %}"></script>
+ <script defer src="{% static "js/resources/resources.js" %}"></script>
+ <script defer src="{% static "js/collapsibles.js" %}"></script>
{% endblock %}
{% block content %}