From 5ab9a8355296b28565e8a39d6b8fff0cbb504932 Mon Sep 17 00:00:00 2001 From: Bobby Date: Wed, 3 Aug 2022 00:02:04 +0530 Subject: Added views for user home page --- blog/static/css/main.css | 161 --------------------- .../images/favicons/android-chrome-192x192.png | Bin 22940 -> 0 bytes .../images/favicons/android-chrome-512x512.png | Bin 99299 -> 0 bytes blog/static/images/favicons/apple-touch-icon.png | Bin 20759 -> 0 bytes blog/static/images/favicons/favicon-16x16.png | Bin 612 -> 0 bytes blog/static/images/favicons/favicon-32x32.png | Bin 1514 -> 0 bytes blog/static/images/favicons/favicon.ico | Bin 15406 -> 0 bytes blog/static/images/favicons/favicon.png | Bin 26043 -> 0 bytes blog/static/images/favicons/site.webmanifest | 1 - blog/static/images/logo.png | Bin 14822 -> 0 bytes blog/templates/account.html | 93 ------------ blog/templates/home.html | 28 ---- blog/templates/homepage.html | 7 - blog/templates/partials/base.html | 23 --- blog/templates/partials/sidebar.html | 69 --------- blog/views.py | 6 +- userpages/views.py | 2 +- 17 files changed, 4 insertions(+), 386 deletions(-) delete mode 100644 blog/static/css/main.css delete mode 100644 blog/static/images/favicons/android-chrome-192x192.png delete mode 100644 blog/static/images/favicons/android-chrome-512x512.png delete mode 100644 blog/static/images/favicons/apple-touch-icon.png delete mode 100644 blog/static/images/favicons/favicon-16x16.png delete mode 100644 blog/static/images/favicons/favicon-32x32.png delete mode 100644 blog/static/images/favicons/favicon.ico delete mode 100644 blog/static/images/favicons/favicon.png delete mode 100644 blog/static/images/favicons/site.webmanifest delete mode 100644 blog/static/images/logo.png delete mode 100644 blog/templates/account.html delete mode 100644 blog/templates/home.html delete mode 100644 blog/templates/homepage.html delete mode 100644 blog/templates/partials/base.html delete mode 100644 blog/templates/partials/sidebar.html diff --git a/blog/static/css/main.css b/blog/static/css/main.css deleted file mode 100644 index cf534be3..00000000 --- a/blog/static/css/main.css +++ /dev/null @@ -1,161 +0,0 @@ -/* making a sidebar layout with 20% sidebar */ -body { - display: inline-flex; - flex-direction: row; - flex-wrap: wrap; - min-height: calc(100vh); - background-color: #fafafa; - padding: 0; - min-width: calc(100vw - 16px); - width: 100%; - font-family: serif; - margin: 0; - padding: 0; -} - -.sidebar { - background-color: #bad9ff; - padding: 20px; - overflow-x: hidden; - overflow-y: auto; - border: 1px solid #191919; - min-width: 15rem; - max-width: 15rem; -} - -.main { - flex: 1; - padding: 20px; - overflow-x: hidden; - overflow-y: auto; -} - -.title:visited { - color: #000; -} - -.title > h1 { - font-size: 1.2rem; - font-weight: bold; - margin-top: 0; -} - -.title { - display: block; -} - -.title > img { - width: 10rem; - height: 3.23rem; - display: block; - margin: 0px auto 10px auto; - pointer-events: none; -} - -.alert { - background-color: #ffd4bd; - padding: 20px; - border: 1px solid #191919; -} - -lebel, input, textarea, select { - display: block; - margin: 5px 0px; - font-family: serif; - font-size: 16px; -} - -input[type = 'submit'] { - margin-top: 10px; -} - -fieldset { - border: 1px solid #191919; - padding: 10px 20px; -} - -nav > ul { - list-style: none; - padding: 0; - margin: 0; -} - -nav > ul > li { - margin: 5px 0; -} - -.center { - text-align: center; -} - -.login-box { - padding: 20px; - border: 1px solid #191919; -} - -.login-box > p { - margin-top: 0; - margin-bottom: 10px; -} - -.error { - color: red; -} - -.success { - color: green; -} - -.alert.success { - background-color: #d4ffbd; - padding: 10px; - color: rgb(5, 74, 5); - font-weight: bold; -} - -.alert.error { - background-color: #ffbdbd; - padding: 10px; - color: rgb(74, 5, 5); - font-weight: bold; -} - -.account { - display: flex; - flex-direction: row; - flex-wrap: wrap; -} - -.ac-sidebar { - padding: 20px; - overflow-x: hidden; - overflow-y: auto; -} - -.ac-main { - flex: 1; - padding: 20px; - overflow-x: hidden; - overflow-y: auto; -} - -.errorbox { - background-color: #ffd4bd; - padding: 20px; - border: 1px solid #191919; -} - -.errorbox > h1 { - margin-top: 0; -} - -/* Optimize for phones */ -@media only screen and (max-width: 480px) { - body { - flex-direction: column; - } - - .account { - flex-direction: column; - } -} diff --git a/blog/static/images/favicons/android-chrome-192x192.png b/blog/static/images/favicons/android-chrome-192x192.png deleted file mode 100644 index e9d9c66c..00000000 Binary files a/blog/static/images/favicons/android-chrome-192x192.png and /dev/null differ diff --git a/blog/static/images/favicons/android-chrome-512x512.png b/blog/static/images/favicons/android-chrome-512x512.png deleted file mode 100644 index 7a2d8305..00000000 Binary files a/blog/static/images/favicons/android-chrome-512x512.png and /dev/null differ diff --git a/blog/static/images/favicons/apple-touch-icon.png b/blog/static/images/favicons/apple-touch-icon.png deleted file mode 100644 index 4d1c7a33..00000000 Binary files a/blog/static/images/favicons/apple-touch-icon.png and /dev/null differ diff --git a/blog/static/images/favicons/favicon-16x16.png b/blog/static/images/favicons/favicon-16x16.png deleted file mode 100644 index ccab5501..00000000 Binary files a/blog/static/images/favicons/favicon-16x16.png and /dev/null differ diff --git a/blog/static/images/favicons/favicon-32x32.png b/blog/static/images/favicons/favicon-32x32.png deleted file mode 100644 index 59f8e353..00000000 Binary files a/blog/static/images/favicons/favicon-32x32.png and /dev/null differ diff --git a/blog/static/images/favicons/favicon.ico b/blog/static/images/favicons/favicon.ico deleted file mode 100644 index db7a682d..00000000 Binary files a/blog/static/images/favicons/favicon.ico and /dev/null differ diff --git a/blog/static/images/favicons/favicon.png b/blog/static/images/favicons/favicon.png deleted file mode 100644 index 67ff62f2..00000000 Binary files a/blog/static/images/favicons/favicon.png and /dev/null differ diff --git a/blog/static/images/favicons/site.webmanifest b/blog/static/images/favicons/site.webmanifest deleted file mode 100644 index 58a15c20..00000000 --- a/blog/static/images/favicons/site.webmanifest +++ /dev/null @@ -1 +0,0 @@ -{"name":"","short_name":"","icons":[{"src":"/static/images/favicons/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/static/images/favicons/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/blog/static/images/logo.png b/blog/static/images/logo.png deleted file mode 100644 index 56366c3d..00000000 Binary files a/blog/static/images/logo.png and /dev/null differ diff --git a/blog/templates/account.html b/blog/templates/account.html deleted file mode 100644 index 50b58996..00000000 --- a/blog/templates/account.html +++ /dev/null @@ -1,93 +0,0 @@ -{% extends 'partials/base.html' %} {% block content %} -
-

My Account

-

You can change account settings for {{ user.username }} here. If you wish to have additional support, please contact me at support@thatcomputerscientist.com. Please take care of the following points before you submit your support request:

- -

Your avatar is fetched from gravatar. Update your gravatar email to fetch the avatar. If you don't have an account, you can sign up for one here. If you haven't set up your gravatar email, we would try to fetch your profile picture from your account email, by default. If your account email and gravatar email are the same, you do not need to set a gravatar email.

- {% if user_subdomain_url %} - {% load replace %} -
-

Your account is publicly accessible at {{ user_subdomain_url|replace:"https://"|replace:"http://" }}. If you wish to change your account to private, you can do so below.

-
- {% endif %} - {% for message in messages %} -
-

{{ message }}

-
- {% endfor %} - -
-{% endblock %} diff --git a/blog/templates/home.html b/blog/templates/home.html deleted file mode 100644 index 6b120d0b..00000000 --- a/blog/templates/home.html +++ /dev/null @@ -1,28 +0,0 @@ -{% extends 'partials/base.html' %} {% block content %} -
-
-

That Computer Scientist

-

- Welcome to the home of That Computer Scientist. This is my personal - website where I share all of my thoughts, ideas, and experiences. To know - more about me, please visit my About page. If you - would like to connect with me, please visit my - Contact page. Please use the sidebar to navigate - the site. -

-
-
-
-

- This website is a work in progress. I am currently working on adding more - features to this website. I aim to build a retro looking personal website, - where I will share my articles and Ideas, which will be built entirely - around the idea of "collaborative writing" — where anyone can write new - articles or edit existing ones. -

-
-
-

Recent Posts

-
-
-{% endblock %} diff --git a/blog/templates/homepage.html b/blog/templates/homepage.html deleted file mode 100644 index 73639601..00000000 --- a/blog/templates/homepage.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'partials/base.html' %} {% block content %} -
-
-

My Homepage

-
-
-{% endblock %} diff --git a/blog/templates/partials/base.html b/blog/templates/partials/base.html deleted file mode 100644 index ba78a931..00000000 --- a/blog/templates/partials/base.html +++ /dev/null @@ -1,23 +0,0 @@ -{% load static %} - - - - - - - - That Computer Scientist - {{ title }} - - - - - - - - {% include 'partials/sidebar.html' %} - {% block content %} {% endblock %} - - diff --git a/blog/templates/partials/sidebar.html b/blog/templates/partials/sidebar.html deleted file mode 100644 index cd46c18a..00000000 --- a/blog/templates/partials/sidebar.html +++ /dev/null @@ -1,69 +0,0 @@ -{% load static %} - - - diff --git a/blog/views.py b/blog/views.py index 8d3dbe44..5fa42889 100644 --- a/blog/views.py +++ b/blog/views.py @@ -6,7 +6,7 @@ import hashlib # Create your views here. def home(request): - return render(request, 'home.html', {'title': 'Home'}) + return render(request, 'blog/home.html', {'title': 'Home'}) def account(request): user = request.user @@ -23,10 +23,10 @@ def account(request): except UserProfile.DoesNotExist: user_profile = None avatar = hashlib.md5(str(user.email).lower().encode()).hexdigest() - return render(request, 'account.html', {'title': 'Account', 'user_profile': user_profile, 'avatar': avatar, 'user_subdomain_url': user_subdomain_url}) + return render(request, 'blog/account.html', {'title': 'Account', 'user_profile': user_profile, 'avatar': avatar, 'user_subdomain_url': user_subdomain_url}) else: # Redirect to login page return redirect('/') def homepage(request): - return render(request, 'homepage.html', {'title': 'Homepage'}) + return render(request, 'blog/homepage.html', {'title': 'Homepage'}) diff --git a/userpages/views.py b/userpages/views.py index 11b2fce7..46da5eb8 100644 --- a/userpages/views.py +++ b/userpages/views.py @@ -12,7 +12,7 @@ def home(request): user_profile = UserProfile.objects.get(user=user) is_public = user_profile.is_public if is_public: - return HttpResponse('Welcome to {}\'s homepage!'.format(subdomain)) + return render(request, 'userpages/home.html', {'title': 'Homepage', 'username': str(user.username).capitalize()}) else: raise Http404('{} is not public.'.format(subdomain)) except UserProfile.DoesNotExist: -- cgit v1.2.3