From 9678d1120449630d52f9526ed4bdac2d52845567 Mon Sep 17 00:00:00 2001 From: Anirudh Prabhakaran Date: Sat, 26 Aug 2023 12:55:01 +0530 Subject: [PATCH 1/2] Added basic UI --- corpus/corpus/settings.py | 3 +- corpus/corpus/urls.py | 1 + corpus/pages/__init__.py | 0 corpus/pages/apps.py | 6 ++ corpus/pages/migrations/__init__.py | 0 corpus/pages/urls.py | 7 ++ corpus/pages/views.py | 8 +++ corpus/templates/base.html | 71 +++++++++++++++++++ .../components/dark_mode_toggle.html | 22 ++++++ .../components/general_dropdown.html | 4 ++ .../components/internal_dropdown.html | 4 ++ .../templates/components/navbar_dropdown.html | 7 ++ .../components/navbar_profile_dropdown.html | 9 +++ corpus/templates/components/navbar_right.html | 17 +++++ corpus/templates/pages/index.html | 12 ++++ 15 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 corpus/pages/__init__.py create mode 100644 corpus/pages/apps.py create mode 100644 corpus/pages/migrations/__init__.py create mode 100644 corpus/pages/urls.py create mode 100644 corpus/pages/views.py create mode 100644 corpus/templates/base.html create mode 100644 corpus/templates/components/dark_mode_toggle.html create mode 100644 corpus/templates/components/general_dropdown.html create mode 100644 corpus/templates/components/internal_dropdown.html create mode 100644 corpus/templates/components/navbar_dropdown.html create mode 100644 corpus/templates/components/navbar_profile_dropdown.html create mode 100644 corpus/templates/components/navbar_right.html create mode 100644 corpus/templates/pages/index.html diff --git a/corpus/corpus/settings.py b/corpus/corpus/settings.py index 9b0d0f36..abef62ff 100644 --- a/corpus/corpus/settings.py +++ b/corpus/corpus/settings.py @@ -39,6 +39,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "pages.apps.PagesConfig", ] MIDDLEWARE = [ @@ -56,7 +57,7 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [os.path.join(BASE_DIR, "templates")], "APP_DIRS": True, "OPTIONS": { "context_processors": [ diff --git a/corpus/corpus/urls.py b/corpus/corpus/urls.py index f839ddd0..93193992 100644 --- a/corpus/corpus/urls.py +++ b/corpus/corpus/urls.py @@ -20,4 +20,5 @@ urlpatterns = [ path("admin/", admin.site.urls), + path("", include("pages.urls")), ] diff --git a/corpus/pages/__init__.py b/corpus/pages/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/corpus/pages/apps.py b/corpus/pages/apps.py new file mode 100644 index 00000000..4b6237c5 --- /dev/null +++ b/corpus/pages/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class PagesConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "pages" diff --git a/corpus/pages/migrations/__init__.py b/corpus/pages/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/corpus/pages/urls.py b/corpus/pages/urls.py new file mode 100644 index 00000000..8e0d0aea --- /dev/null +++ b/corpus/pages/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from .views import index + +urlpatterns = [ + path("", index, name="index"), +] diff --git a/corpus/pages/views.py b/corpus/pages/views.py new file mode 100644 index 00000000..b2c0b60c --- /dev/null +++ b/corpus/pages/views.py @@ -0,0 +1,8 @@ +from django.shortcuts import render + +# Create your views here. + + +def index(request): + args = {} + return render(request, "pages/index.html", args) diff --git a/corpus/templates/base.html b/corpus/templates/base.html new file mode 100644 index 00000000..cdd1cc33 --- /dev/null +++ b/corpus/templates/base.html @@ -0,0 +1,71 @@ + + + + + + + {% block title %} {% endblock %} | Corpus + + + + + + + + + + + + + + + + {% block content %} + {% endblock %} + + {% include "components/dark_mode_toggle.html" %} + + + + + diff --git a/corpus/templates/components/dark_mode_toggle.html b/corpus/templates/components/dark_mode_toggle.html new file mode 100644 index 00000000..a59ab8bc --- /dev/null +++ b/corpus/templates/components/dark_mode_toggle.html @@ -0,0 +1,22 @@ + + + diff --git a/corpus/templates/components/general_dropdown.html b/corpus/templates/components/general_dropdown.html new file mode 100644 index 00000000..578d6643 --- /dev/null +++ b/corpus/templates/components/general_dropdown.html @@ -0,0 +1,4 @@ + diff --git a/corpus/templates/components/internal_dropdown.html b/corpus/templates/components/internal_dropdown.html new file mode 100644 index 00000000..7bd41cbd --- /dev/null +++ b/corpus/templates/components/internal_dropdown.html @@ -0,0 +1,4 @@ + diff --git a/corpus/templates/components/navbar_dropdown.html b/corpus/templates/components/navbar_dropdown.html new file mode 100644 index 00000000..93bfcc2d --- /dev/null +++ b/corpus/templates/components/navbar_dropdown.html @@ -0,0 +1,7 @@ + diff --git a/corpus/templates/components/navbar_profile_dropdown.html b/corpus/templates/components/navbar_profile_dropdown.html new file mode 100644 index 00000000..3245f2a0 --- /dev/null +++ b/corpus/templates/components/navbar_profile_dropdown.html @@ -0,0 +1,9 @@ + diff --git a/corpus/templates/components/navbar_right.html b/corpus/templates/components/navbar_right.html new file mode 100644 index 00000000..375c615f --- /dev/null +++ b/corpus/templates/components/navbar_right.html @@ -0,0 +1,17 @@ +{% if user.is_authenticated %} + +{% else %} + + Login + + login + + +{% endif %} diff --git a/corpus/templates/pages/index.html b/corpus/templates/pages/index.html new file mode 100644 index 00000000..a0361ee3 --- /dev/null +++ b/corpus/templates/pages/index.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block title %} +Home +{% endblock %} + +{% block content %} +
+

Welcome to Corpus!

+

Corpus is IEEE NITK's tool to manage all internal and external activities of the club.

+
+{% endblock %} From 77196ad31ddecc8785809233b6c436a2689f0fc2 Mon Sep 17 00:00:00 2001 From: Nishant Nayak Date: Sat, 26 Aug 2023 22:17:46 +0530 Subject: [PATCH 2/2] Update dark theme to night, add padding on body Signed-off-by: Nishant Nayak --- corpus/templates/base.html | 2 +- corpus/templates/components/dark_mode_toggle.html | 2 +- corpus/templates/pages/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/corpus/templates/base.html b/corpus/templates/base.html index cdd1cc33..25558d71 100644 --- a/corpus/templates/base.html +++ b/corpus/templates/base.html @@ -16,7 +16,7 @@ diff --git a/corpus/templates/components/dark_mode_toggle.html b/corpus/templates/components/dark_mode_toggle.html index a59ab8bc..dae8d984 100644 --- a/corpus/templates/components/dark_mode_toggle.html +++ b/corpus/templates/components/dark_mode_toggle.html @@ -13,7 +13,7 @@ const toggleTheme = () => { let theme = localStorage.getItem("corpusTheme") || "winter"; - theme = theme == "winter" ? "dark" : "winter"; + theme = theme == "winter" ? "night" : "winter"; const icon = theme == "winter" ? "dark_mode" : "light_mode"; document.documentElement.setAttribute("data-theme", theme); $("#dark-mode-toggle").html(icon); diff --git a/corpus/templates/pages/index.html b/corpus/templates/pages/index.html index a0361ee3..7c90553b 100644 --- a/corpus/templates/pages/index.html +++ b/corpus/templates/pages/index.html @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -
+

Welcome to Corpus!

Corpus is IEEE NITK's tool to manage all internal and external activities of the club.