From cc0fa3c9dedef61962777e9b07f5d6728bb62ceb Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:48:34 +0300 Subject: Create base resources app --- pydis_site/apps/resources/__init__.py | 0 pydis_site/apps/resources/apps.py | 7 +++++++ pydis_site/apps/resources/migrations/__init__.py | 0 3 files changed, 7 insertions(+) create mode 100644 pydis_site/apps/resources/__init__.py create mode 100644 pydis_site/apps/resources/apps.py create mode 100644 pydis_site/apps/resources/migrations/__init__.py diff --git a/pydis_site/apps/resources/__init__.py b/pydis_site/apps/resources/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydis_site/apps/resources/apps.py b/pydis_site/apps/resources/apps.py new file mode 100644 index 00000000..e0c235bd --- /dev/null +++ b/pydis_site/apps/resources/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class ResourcesConfig(AppConfig): + """AppConfig instance for Resources app.""" + + name = 'resources' diff --git a/pydis_site/apps/resources/migrations/__init__.py b/pydis_site/apps/resources/migrations/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From cae8eb732bce6fc879f853eebf43f4f7553349b6 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:48:58 +0300 Subject: Create CSS for resources index --- pydis_site/static/css/resources/resources.css | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pydis_site/static/css/resources/resources.css diff --git a/pydis_site/static/css/resources/resources.css b/pydis_site/static/css/resources/resources.css new file mode 100644 index 00000000..025b28c6 --- /dev/null +++ b/pydis_site/static/css/resources/resources.css @@ -0,0 +1,33 @@ +.box, .tile.is-parent { + transition: 0.1s ease-out; +} +.box { + min-height: 15vh; +} +.tile.is-parent:hover .box { + box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); +} +.tile.is-parent:hover { + padding: 0.65rem 0.85rem 0.85rem 0.65rem; + filter: saturate(1.1) brightness(1.1); +} + +#readingBlock { + background-image: linear-gradient(141deg, #911eb4 0%, #b631de 71%, #cf4bf7 100%); +} + +#interactiveBlock { + background-image: linear-gradient(141deg, #d05600 0%, #da722a 71%, #e68846 100%); +} + +#communitiesBlock { + background-image: linear-gradient(141deg, #3b756f 0%, #3a847c 71%, #41948b 100%); +} + +#podcastsBlock { + background-image: linear-gradient(141deg, #232382 0%, #30309c 71%, #4343ad 100%); +} + +.breadcrumb-section { + padding: 1rem; +} -- cgit v1.2.3 From d5c6986a955c8bcf628ed31d38c99d4fe880f0a8 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:49:15 +0300 Subject: Create resources index HTML file --- pydis_site/templates/resources/resources.html | 100 ++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 pydis_site/templates/resources/resources.html diff --git a/pydis_site/templates/resources/resources.html b/pydis_site/templates/resources/resources.html new file mode 100644 index 00000000..0f9abb42 --- /dev/null +++ b/pydis_site/templates/resources/resources.html @@ -0,0 +1,100 @@ +{% extends 'base/base.html' %} +{% load static %} + +{% block title %}Resources{% endblock %} +{% block head %} + +{% endblock %} + +{% block content %} + {% include "base/navbar.html" %} + + + +
+
+ +
+
+{% endblock %} -- cgit v1.2.3 From 83239a5c54869b0c9241b14760005b8ed4c26fb2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:49:36 +0300 Subject: Include resources app to settings --- pydis_site/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 1f042c1b..2c8a95a1 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -91,6 +91,7 @@ INSTALLED_APPS = [ 'pydis_site.apps.api', 'pydis_site.apps.home', 'pydis_site.apps.staff', + 'pydis_site.apps.resources', 'django.contrib.admin', 'django.contrib.auth', -- cgit v1.2.3 From 05fac08ad25621960f9195c45f7e608975365d6d Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:50:07 +0300 Subject: Create view for resources index --- pydis_site/apps/resources/views/__init__.py | 3 +++ pydis_site/apps/resources/views/resources.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 pydis_site/apps/resources/views/__init__.py create mode 100644 pydis_site/apps/resources/views/resources.py diff --git a/pydis_site/apps/resources/views/__init__.py b/pydis_site/apps/resources/views/__init__.py new file mode 100644 index 00000000..f54118f2 --- /dev/null +++ b/pydis_site/apps/resources/views/__init__.py @@ -0,0 +1,3 @@ +from .resources import ResourcesView + +__all__ = ["ResourcesView"] diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views/resources.py new file mode 100644 index 00000000..e778ab61 --- /dev/null +++ b/pydis_site/apps/resources/views/resources.py @@ -0,0 +1,12 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http import HttpResponse +from django.shortcuts import render +from django.views import View + + +class ResourcesView(View): + """Handles base resources page that shows different resource types.""" + + def get(self, request: WSGIRequest) -> HttpResponse: + """Show base resources page.""" + return render(request, "resources/resources.html") -- cgit v1.2.3 From 42fb57205235963784e59b7b23e3fe5bb786e0fe Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:50:24 +0300 Subject: Create resources app URLs --- pydis_site/apps/resources/urls.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 pydis_site/apps/resources/urls.py diff --git a/pydis_site/apps/resources/urls.py b/pydis_site/apps/resources/urls.py new file mode 100644 index 00000000..208d0c93 --- /dev/null +++ b/pydis_site/apps/resources/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from pydis_site.apps.resources import views + +app_name = "resources" +urlpatterns = [ + path("", views.ResourcesView.as_view(), name="resources"), +] -- cgit v1.2.3 From dd950f2958c4620d7acfcad3c8e4acd7e82b8931 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:50:48 +0300 Subject: Include resources app URLs to home app URLs --- pydis_site/apps/home/urls.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pydis_site/apps/home/urls.py b/pydis_site/apps/home/urls.py index 61e87a39..ed8dcfe6 100644 --- a/pydis_site/apps/home/urls.py +++ b/pydis_site/apps/home/urls.py @@ -38,4 +38,6 @@ urlpatterns = [ path('admin/', admin.site.urls), path('notifications/', include('django_nyt.urls')), + + path('resources/', include('pydis_site.apps.resources.urls', namespace="resources")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) -- cgit v1.2.3 From 128def50309353fc568f6c5354e65633076e8689 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Tue, 22 Sep 2020 20:51:00 +0300 Subject: Create tests for resources app --- pydis_site/apps/resources/tests/__init__.py | 0 pydis_site/apps/resources/tests/test_views.py | 10 ++++++++++ 2 files changed, 10 insertions(+) create mode 100644 pydis_site/apps/resources/tests/__init__.py create mode 100644 pydis_site/apps/resources/tests/test_views.py diff --git a/pydis_site/apps/resources/tests/__init__.py b/pydis_site/apps/resources/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pydis_site/apps/resources/tests/test_views.py b/pydis_site/apps/resources/tests/test_views.py new file mode 100644 index 00000000..b131b2a6 --- /dev/null +++ b/pydis_site/apps/resources/tests/test_views.py @@ -0,0 +1,10 @@ +from django.test import TestCase +from django_hosts import reverse + + +class TestResourcesView(TestCase): + def test_resources_index_200(self): + """Check does index of resources app return 200 HTTP response.""" + url = reverse("resources:resources") + response = self.client.get(url) + self.assertEqual(response.status_code, 200) -- cgit v1.2.3 From 638c323f3eae4a35f6e8ab4e4634fb30e5e9e163 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 4 Oct 2020 14:50:17 +0300 Subject: Simplify resources index view --- pydis_site/apps/resources/views/resources.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views/resources.py index e778ab61..e770954b 100644 --- a/pydis_site/apps/resources/views/resources.py +++ b/pydis_site/apps/resources/views/resources.py @@ -1,12 +1,7 @@ -from django.core.handlers.wsgi import WSGIRequest -from django.http import HttpResponse -from django.shortcuts import render -from django.views import View +from django.views.generic import TemplateView + +class ResourcesView(TemplateView): + """View for resources index page.""" -class ResourcesView(View): - """Handles base resources page that shows different resource types.""" - - def get(self, request: WSGIRequest) -> HttpResponse: - """Show base resources page.""" - return render(request, "resources/resources.html") + template_name = "resources/resources.html" -- cgit v1.2.3 From 337b5479596f4cd1ee09fb4a0625d7948bc7ccae Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Wed, 7 Oct 2020 16:08:57 +0300 Subject: Update guides URL to match with latest changes in #393 --- pydis_site/templates/resources/resources.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/resources/resources.html b/pydis_site/templates/resources/resources.html index 0f9abb42..70e0b5a8 100644 --- a/pydis_site/templates/resources/resources.html +++ b/pydis_site/templates/resources/resources.html @@ -25,7 +25,7 @@

Resources

- +

Guides

Made by us, for you

-- cgit v1.2.3 From 7cb83b60637d7c28d805227d12840b201ceb6eda Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Oct 2020 19:01:53 +0300 Subject: Remove breadcrumb from resources index page to avoid too much titles --- pydis_site/templates/resources/resources.html | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pydis_site/templates/resources/resources.html b/pydis_site/templates/resources/resources.html index 70e0b5a8..6eb32c97 100644 --- a/pydis_site/templates/resources/resources.html +++ b/pydis_site/templates/resources/resources.html @@ -9,16 +9,6 @@ {% block content %} {% include "base/navbar.html" %} -
-
-- cgit v1.2.3 From 2535d2285e1b6f130425ca43e1d22f11528c5017 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Oct 2020 19:02:20 +0300 Subject: Remove resources index breadcrumb CSS --- pydis_site/static/css/resources/resources.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pydis_site/static/css/resources/resources.css b/pydis_site/static/css/resources/resources.css index 025b28c6..cf4cb472 100644 --- a/pydis_site/static/css/resources/resources.css +++ b/pydis_site/static/css/resources/resources.css @@ -27,7 +27,3 @@ #podcastsBlock { background-image: linear-gradient(141deg, #232382 0%, #30309c 71%, #4343ad 100%); } - -.breadcrumb-section { - padding: 1rem; -} -- cgit v1.2.3 From a99135397a63da8ef1389ae8df6f5c537cf186f3 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Wed, 28 Oct 2020 20:00:51 +0200 Subject: Remove unnecessary namespace from including resources app URLs Co-authored-by: Jeremiah Boby --- pydis_site/apps/home/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/apps/home/urls.py b/pydis_site/apps/home/urls.py index 09b5df34..7b94420c 100644 --- a/pydis_site/apps/home/urls.py +++ b/pydis_site/apps/home/urls.py @@ -33,5 +33,5 @@ urlpatterns = [ path('logout', LogoutView.as_view(), name="logout"), path('admin/', admin.site.urls), - path('resources/', include('pydis_site.apps.resources.urls', namespace="resources")), + path('resources/', include('pydis_site.apps.resources.urls')), ] -- cgit v1.2.3 From 194e3720ad8cfac1c38d8ac1279688aa6dd65c6a Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Wed, 28 Oct 2020 20:07:25 +0200 Subject: Change resources home name from resources -> index --- pydis_site/apps/resources/tests/test_views.py | 2 +- pydis_site/apps/resources/urls.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/apps/resources/tests/test_views.py b/pydis_site/apps/resources/tests/test_views.py index b131b2a6..497e9bfe 100644 --- a/pydis_site/apps/resources/tests/test_views.py +++ b/pydis_site/apps/resources/tests/test_views.py @@ -5,6 +5,6 @@ from django_hosts import reverse class TestResourcesView(TestCase): def test_resources_index_200(self): """Check does index of resources app return 200 HTTP response.""" - url = reverse("resources:resources") + url = reverse("resources:index") response = self.client.get(url) self.assertEqual(response.status_code, 200) diff --git a/pydis_site/apps/resources/urls.py b/pydis_site/apps/resources/urls.py index 208d0c93..c91e306e 100644 --- a/pydis_site/apps/resources/urls.py +++ b/pydis_site/apps/resources/urls.py @@ -4,5 +4,5 @@ from pydis_site.apps.resources import views app_name = "resources" urlpatterns = [ - path("", views.ResourcesView.as_view(), name="resources"), + path("", views.ResourcesView.as_view(), name="index"), ] -- cgit v1.2.3