Link to post in the footer if logged in

This commit is contained in:
Matthias 2020-09-06 13:41:13 -04:00
parent 8003a396bf
commit 09c3294aa7
3 changed files with 30 additions and 4 deletions

View File

@ -12,14 +12,16 @@ html {
}
body {
padding: 0;
margin: 0 3%;
background: var(--background-color);
height: 100%;
min-height: calc(100% - 40px);
max-width: 1000px;
/*The height of the footer at the bottom*/
padding: 0 0 40px;
font-size: 16px;
color: var(--text-color);
font-family: Helvetica, Arial, sans-serif;
@ -58,7 +60,7 @@ button.show-more:hover, button.show-more:focus {
position: relative;
bottom: 4px;
border-bottom: solid 1px var(--accent-color);
border-bottom: inset 1px var(--accent-color);
}
hr.thought-end {
@ -81,4 +83,14 @@ header .text {
.hidden {
display: none;
}
footer {
position: fixed;
bottom: 0;
background: var(--accent-color);
color: var(--background-color);
width: 100%;
padding: 10px;
height: 20px;
}

View File

@ -22,6 +22,10 @@
{% endfor %}
</section>
<footer>Copyright Matthias @2020{% if authenticated %}
<a href="/post" style="color: var(--text-color); margin-left: 100px; text-decoration: none">POST</a>
{% endif %}</footer>
<script>
const els = document.querySelectorAll(".thought");
for (let el of els) {

View File

@ -4,7 +4,17 @@ from .models import Thought
def index(request):
return render(request, "whispermaphone/index.html", {"thoughts": Thought.objects.order_by("-posted")})
authenticated = False
try:
if request.COOKIES["password"] == "ChromaticWave":
authenticated = True
except KeyError:
pass
return render(request, "whispermaphone/index.html", {
"thoughts": Thought.objects.order_by("-posted"),
"authenticated": authenticated
})
def post(request):