CSS for post page

This commit is contained in:
Matthias 2020-09-06 14:17:49 -04:00
parent 09c3294aa7
commit b5948c60b2
5 changed files with 49 additions and 9 deletions

View File

@ -28,7 +28,7 @@ body {
} }
.thought { .thought {
padding: 20px 30px; margin: 20px 30px;
line-height: 1.5em; line-height: 1.5em;
} }
@ -73,10 +73,11 @@ hr.thought-end {
header { header {
padding: 4% 30px 15px; padding: 4% 30px 15px;
font-size: 3em;
} }
header .text { header .text {
color: var(--text-color); color: var(--text-color);
font-size: 3em;
font-family: Georgia, Libre Baskerville, serif; font-family: Georgia, Libre Baskerville, serif;
border-bottom: 4px solid var(--accent-color); border-bottom: 4px solid var(--accent-color);
} }
@ -85,6 +86,10 @@ header .text {
display: none; display: none;
} }
a {
text-decoration: none;
}
footer { footer {
position: fixed; position: fixed;
bottom: 0; bottom: 0;

25
main/static/main/post.css Normal file
View File

@ -0,0 +1,25 @@
textarea.thought {
padding: 5px;
outline: none;
width: calc(100% - 60px);
resize: none;
background: none;
border-right: 0;
border: none;
font-size: inherit;
color: inherit;
font-family: inherit;
}
#post-button {
border-radius: 0;
background: none;
outline: none;
border: none;
margin: 30px;
padding: 0;
font-size: 32px;
color: var(--text-color);
cursor: pointer;
float: right;
}

View File

@ -9,7 +9,9 @@
<link href="{% static "main/main.css" %}" rel="stylesheet"> <link href="{% static "main/main.css" %}" rel="stylesheet">
</head> </head>
<body> <body>
<header><span class="text">Thoughts</span></header> <header><span class="text">Thoughts</span>{% if authenticated %}
<a href="/post" class="text" style="border: none">Post</a>
{% endif %}</header>
<section class="main-wrap"> <section class="main-wrap">
{% for thought in thoughts %} {% for thought in thoughts %}
@ -22,9 +24,9 @@
{% endfor %} {% endfor %}
</section> </section>
<footer>Copyright Matthias @2020{% if authenticated %} <!-- <footer>Copyright Matthias @2020{% if authenticated %}-->
<a href="/post" style="color: var(--text-color); margin-left: 100px; text-decoration: none">POST</a> <!-- <a href="/post" style="color: var(&#45;&#45;text-color); margin-left: 100px; text-decoration: none">POST</a>-->
{% endif %}</footer> <!-- {% endif %}</footer>-->
<script> <script>
const els = document.querySelectorAll(".thought"); const els = document.querySelectorAll(".thought");

View File

@ -2,21 +2,26 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title> <title>Title</title>
{% load static %} {% load static %}
<link href="{% static "main/main.css" %}" rel="stylesheet"> <link href="{% static "main/main.css" %}" rel="stylesheet">
<link href="{% static "main/post.css" %}" rel="stylesheet">
</head> </head>
<body> <body>
<header><a href="/" class="text" style="border: none">Thoughts</a> <span class="text">Post</span></header>
<form action="{% url 'post'%}" method="post"> <form action="{% url 'post'%}" method="post">
{% csrf_token %} {% csrf_token %}
<textarea name="text" id="text"></textarea> <textarea name="text" id="text" class="thought"></textarea>
<textarea name="extended_text" id="extended_text"></textarea> <hr class="thought-end">
<textarea name="extended_text" id="extended_text" class="thought"></textarea>
<hr class="thought-end">
<input type="hidden" name="timezone_offset" id="timezone_offset"> <input type="hidden" name="timezone_offset" id="timezone_offset">
<input type="submit"> <input type="submit" id="post-button" value="Submit">
</form> </form>
<script> <script>

View File

@ -25,6 +25,9 @@ def post(request):
return render(request, "whispermaphone/login.html", status=401) return render(request, "whispermaphone/login.html", status=401)
if request.method == "POST": if request.method == "POST":
if len(request.POST["text"]) == 0:
return HttpResponse("Need some text.", status=400)
Thought( Thought(
text=request.POST["text"], text=request.POST["text"],
extended_text=request.POST["extended_text"], extended_text=request.POST["extended_text"],