From 3f2fc550a7baf7bbd8d9045d4f2e1bcf41a209ff Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 25 Sep 2022 00:56:00 -0400 Subject: Major visual overhaul --- blog/context_processors.py | 14 +-- blog/views.py | 4 +- static/css/main.css | 162 +++++++++++++++++------------------ static/images/banner.png | Bin 0 -> 237640 bytes static/images/bg.jpeg | Bin 0 -> 131609 bytes templates/blog/home.html | 47 ++++++++-- templates/blog/partials/base.html | 75 ++++++++-------- templates/blog/partials/sidebar.html | 19 +--- templates/blog/register.html | 2 +- templates/blog_admin/edit_post.html | 2 +- templates/blog_admin/new_post.html | 2 +- thatcomputerscientist/settings.py | 4 - 12 files changed, 171 insertions(+), 160 deletions(-) create mode 100644 static/images/banner.png create mode 100644 static/images/bg.jpeg diff --git a/blog/context_processors.py b/blog/context_processors.py index 605fc0c5..7d2f7da0 100644 --- a/blog/context_processors.py +++ b/blog/context_processors.py @@ -1,13 +1,13 @@ from .models import Post, Category -def recent_posts(request): - recent_posts = Post.objects.filter(is_public=True).order_by('-date')[:5] - return {'recent_posts': recent_posts} +def recent_posts(): + recent_posts = Post.objects.filter(is_public=True).order_by('-date')[1:6] + return recent_posts -def categories(request): +def categories(): categories = Category.objects.all() - return {'categories': categories} + return categories -def archives(request): +def archives(): archives = Post.objects.filter(is_public=True).dates('date', 'month', order='DESC') - return {'archives': archives} + return archives diff --git a/blog/views.py b/blog/views.py index 45db0370..28d693f1 100644 --- a/blog/views.py +++ b/blog/views.py @@ -10,12 +10,14 @@ from string import ascii_letters, digits import base64 import json from .models import Post, Comment +from .context_processors import recent_posts, categories, archives # Create your views here. def home(request): last_post = Post.objects.filter(is_public=True).order_by('-date')[0] - return render(request, 'blog/home.html', {'title': 'Home', 'last_post': last_post}) + first_paragraph = last_post.body.split('

')[1].split('

')[0] + return render(request, 'blog/home.html', {'title': 'Home', 'last_post': last_post, 'first_paragraph': first_paragraph, 'recent_posts': recent_posts(), 'categories': categories(), 'archives': archives()}) def account(request): user = request.user diff --git a/static/css/main.css b/static/css/main.css index 35fe5b56..ff2a33bd 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,26 +1,67 @@ -/* making a sidebar layout with 20% sidebar */ body { + background-image: url("../images/bg.jpeg"); + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; + background-position: center; + font-family: serif; + padding: 0; + margin: 0; + min-height: calc(100vh); + text-align: center; +} + +.header { + background-image: url("../images/banner.png"); + background-size: contain; + background-repeat: no-repeat; + background-position: center; + width: 1000px; + height: 300px; + margin: auto; +} + +.mc { 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; + width: 1000px; + border: solid 1px cecece; + padding: 2px; + text-align: initial; } .sidebar { - padding: 20px; + /* padding: 20px; */ overflow-x: hidden; overflow-y: auto; min-width: 15rem; max-width: 15rem; } +/* COLORS SECTION ACCORIDING TO DARK MODE */ + +h1, h2, h3, h4, h5, h6, p, a, li, span, label, footer, .table { + color: #cecece; +} + +a { + color: #8278ed; +} +/* +a:visited { + color: #b894dc; +} */ + +svg { + filter: invert(1); +} + +fieldset, legend { + color: #cecece; +} + + .sidebar-lg { min-width: 20rem; max-width: 20rem; @@ -31,20 +72,20 @@ body { } .sidebar-border { - border: 1px solid #191919; + border: 1px solid #e6e6e6; } .content { flex: 1; - padding: 20px; + padding: 9px 20px 20px 20px; overflow-x: hidden; overflow-y: auto; min-height: calc(100vh - 40px); } .title:visited { - color: #000; + color: #cecece; } .title > h1 { @@ -66,9 +107,9 @@ body { } .alert { - background-color: #ffd4bd; + background-color: #0c1221; padding: 20px; - border: 1px solid #191919; + border: 1px solid #cecece; } lebel, input, textarea, select { @@ -78,12 +119,17 @@ lebel, input, textarea, select { font-size: 16px; } +input, textarea { + background-color: rgb(17, 17, 17); + color: #cecece; +} + input[type = 'submit'] { margin-top: 10px; } fieldset { - border: 1px solid #191919; + border: 1px solid #cecece; padding: 10px 20px; } @@ -103,7 +149,7 @@ nav > ul > li { .login-box { padding: 20px; - border: 1px solid #191919; + border: 1px solid #cecece; } .login-box > p { @@ -112,7 +158,7 @@ nav > ul > li { } .error { - color: red; + color: rgb(255, 81, 81); } .success { @@ -120,16 +166,16 @@ nav > ul > li { } .alert.success { - background-color: #d4ffbd; + color: #d4ffbd; padding: 10px; - color: rgb(5, 74, 5); + background-color: rgb(5, 74, 5); font-weight: bold; } .alert.error { - background-color: #ffbdbd; + color: #ffbdbd; padding: 10px; - color: rgb(74, 5, 5); + background-color: rgb(74, 5, 5); font-weight: bold; } @@ -153,19 +199,15 @@ nav > ul > li { } .errorbox { - background-color: #ffd4bd; + background-color: #191919; padding: 20px; - border: 1px solid #191919; + border: 1px solid #ffd4bd; } .errorbox > h1 { margin-top: 0; } -.hamburger { - display: none; -} - #captcha { display: flex; flex-direction: row; @@ -197,11 +239,11 @@ nav > ul > li { /* Add borders to all cells */ .table, .table th, .table td { - border: 1px solid #191919; + border: 1px solid #cecece; } .table-striped > tbody > tr:nth-child(odd) { - background-color: #f2f2f2; + background-color: #0000007a; } summary { @@ -226,18 +268,18 @@ summary { } .label-success { - background-color: #d4ffbd; - color: rgb(5, 74, 5); + color: #d4ffbd; + background-color: rgb(5, 74, 5); } .label-error { - background-color: #ffbdbd; - color: rgb(74, 5, 5); + color: #ffbdbd; + background-color: rgb(74, 5, 5); } .label-warning { - background-color: #ffd4bd; - color: rgb(74, 5, 5); + color: #ffd4bd; + background-color: rgb(74, 5, 5); } .comment { @@ -272,51 +314,3 @@ summary { max-height: 50vh; max-width: 100%; } - -/* Optimize for phones */ -@media only screen and (max-width: 480px) { - body { - flex-direction: column; - } - - .account { - flex-direction: column; - } - - .sidebar, .sidebar-lg { - min-width: calc(100vw - 42px) - } - - .hamburger { - display: block; - position: absolute; - right: 20px; - } - .title > img { - position: relative; - left: -5.9rem; - top: -3px; - } - - .lgn-area { - display: none; - } - - .lgn-area-open { - display: block; - } - - .table { - width: 100%; - table-layout: fixed; - word-wrap: break-word; - } - - .float-right { - position: initial; - } - - .content { - min-height: auto; - } -} diff --git a/static/images/banner.png b/static/images/banner.png new file mode 100644 index 00000000..5fd3f5ae Binary files /dev/null and b/static/images/banner.png differ diff --git a/static/images/bg.jpeg b/static/images/bg.jpeg new file mode 100644 index 00000000..396e3bca Binary files /dev/null and b/static/images/bg.jpeg differ diff --git a/templates/blog/home.html b/templates/blog/home.html index 2357a13e..54e4d6b2 100644 --- a/templates/blog/home.html +++ b/templates/blog/home.html @@ -1,7 +1,7 @@ {% extends 'blog/partials/base.html' %} {% block content %}
-

That Computer Scientist

+ {% comment %}

That Computer Scientist

{% endcomment %}

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 @@ -12,7 +12,7 @@


-
+

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, @@ -22,16 +22,51 @@

{% if last_post %} - + {% endif %} + {% for post in recent_posts %} +
  • + {{ post.title }} + by {{ post.author.username }} on {{ + post.date|date:"M d, Y" }}. +
  • + {% endfor %} + +
    +

    Archives

    +
    + +
    +

    Categories

    +
    +
    {% endblock %} diff --git a/templates/blog/partials/base.html b/templates/blog/partials/base.html index 588f7302..dd0e7819 100644 --- a/templates/blog/partials/base.html +++ b/templates/blog/partials/base.html @@ -11,48 +11,45 @@ /> That Computer Scientist - {{ title }} - - - - + + + + - {% include 'blog/partials/sidebar.html' %} -
    - {% block content %} - {% endblock %} -
    -