Templates update

This commit is contained in:
Piotr Kopycki 2021-12-09 23:25:35 +01:00
parent c532683843
commit 2be89b6901
12 changed files with 208 additions and 46 deletions

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SOITA | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}">
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

View File

@ -1,15 +0,0 @@
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
<h1>Welcome in SOITA/h1>
{% if user.is_authenticated %}
<p>Username: {{user.username}}</p>
<p>Name: {{user.first_name}} {{user.last_name}}</p>
<p>Email: {{user.email}}</p>
{% else %}
Guest nr 123
{% endif %}
{% endblock %}

View File

@ -16,10 +16,13 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import include from django.urls import include
from django.urls import path from django.urls import path
from .views import index from .views import index, login, logout, register
urlpatterns = [ urlpatterns = [
path('', index), path('', index),
path('login/', login),
path('logout/', logout),
path('register/', register),
path('users/', include("users.urls")), path('users/', include("users.urls")),
path('questions/', include("questions.urls")), path('questions/', include("questions.urls")),
path('answers/', include("answers.urls")), path('answers/', include("answers.urls")),

View File

@ -2,9 +2,26 @@ from django.shortcuts import render, redirect
from django.template import loader from django.template import loader
def index(request): def index(request):
# context = { # context = {
# 'latest_question_list': latest_question_list, # 'latest_question_list': latest_question_list,
# } # }
return render(request, 'index.html') return render(request, 'index.html')
def login(request):
# context = {
# 'latest_question_list': latest_question_list,
# }
return render(request, 'login.html')
def logout(request):
# context = {
# 'latest_question_list': latest_question_list,
# }
return render(request, 'logout.html')
def register(request):
# context = {
# 'latest_question_list': latest_question_list,
# }
return render(request, 'register.html')

6
palette.txt Normal file
View File

@ -0,0 +1,6 @@
Color palette:
#00916E - Illuminating Emerald
#FEEFE5 - Linen
#FFCF00 - Cyber Yellow
#EE6123 - Orange Panteon
#FA003F - Red Munsell

62
static/style.css Normal file
View File

@ -0,0 +1,62 @@
.sidenav {
height: 100%;
width: 160px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #FA003F;
overflow-x: :hidden;
padding-top: 20px;
}
.sidenav a {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 20px;
color: #FEEFE5;
display: block;
line-height: 1.6;
}
.sidenav a:hover {
color: #00916E;
}
.main {
margin-left: 160px;
padding: 0px 10px;
}
.authBox {
height: 100px;
width: 100px;
background-color: #FEEFE5;
color: #111;
padding: 250px 300px 0px 300px;
position: relative;
}
.authContent {
background-color:#FA003F
padding: 250px 300px 0px 300px;
height: 100%;
width: 100%;
position: absolute;
}
.titleBar {
height: 50px;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #2B3D41;
padding-top: 20px;
text-align: center;
text-decoration: none;
font-size: 30px;
color: #FEEFE5;
display: block;
}

24
templates/authBase.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<title>SOITA | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}">
</head>
<body>
<div class="titleBar">
SOITA
</div>
<div name="content", class="authContent">
<div name="box", class="authBox">
{% block content %}
{% endblock %}
</div>
</div>
</body>
</html>

View File

@ -1,15 +1,65 @@
<!DOCTYPE html> <!DOCTYPE html>
{% load static %}
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<!-- <style type="text/css">-->
<!-- .sidenav {-->
<!-- height: 100%;-->
<!-- width: 160px;-->
<!-- position: fixed;-->
<!-- z-index: 1;-->
<!-- top: 0;-->
<!-- left: 0;-->
<!-- background-color: #111;-->
<!-- overflow-x: :hidden;-->
<!-- padding-top: 20px;-->
<!-- }-->
<!-- .sidenav a {-->
<!-- padding: 6px 8px 6px 16px;-->
<!-- text-decoration: none;-->
<!-- font-size: 20px;-->
<!-- color: #818181;-->
<!-- display: block;-->
<!-- line-height: 1.6;-->
<!-- }-->
<!-- .sidenav a:hover {-->
<!-- color: #f1f1f1;-->
<!-- }-->
<!-- .main {-->
<!-- margin-left: 160px;-->
<!-- padding: 0px 10px;-->
<!-- }-->
<!-- </style>-->
<title>SOITA | {% block title %}{% endblock %}</title> <title>SOITA | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}"> <meta name="description" content="{% block description %}{% endblock %}">
</head> </head>
<body> <body>
<div class="sidenav">
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/tests/category/1">Category1</a>
<a href="/tests/category/2">Category2</a>
<a href="/tests/category/3">Category3</a>
<a href="/tests/category/4">Category4</a>
<a href="/tests/category/5">Category5</a>
<a href="/tests/category/6">Category6</a>
<a href="/tests/category/7">Category7</a>
<a href="/tests/category/8">Category8</a>
<a href="/tests/category/9">Category9</a>
<a href="/tests/category/10">Category10</a>
</div>
<div id="content", name="content", class="main">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div>
</body> </body>
</html> </html>

View File

@ -4,12 +4,19 @@
{% block content %} {% block content %}
<h1>Welcome in SOITA/h1> <h1>Welcome in SOITA/h1>
{% if user.is_authenticated %} <!-- TODO reading all tests from DB-->
<p>Username: {{user.username}}</p> {% for test in tests.all %}
<p>Name: {{user.first_name}} {{user.last_name}}</p> <div class="test-infoBox">
<p>Email: {{user.email}}</p> <p><a href="/tests/{{test.id}}/show/">{{test.name}}</a></p>
{% else %} </div>
Guest nr 123
{% endif %} {% endfor %}
<!-- {% if user.is_authenticated %}-->
<!-- <p>Username: {{user.username}}</p>-->
<!-- <p>Name: {{user.first_name}} {{user.last_name}}</p>-->
<!-- <p>Email: {{user.email}}</p>-->
<!-- {% else %}-->
<!-- Guest nr 123-->
<!-- {% endif %}-->
{% endblock %} {% endblock %}

8
templates/login.html Normal file
View File

@ -0,0 +1,8 @@
{% extends "authBase.html" %}
{% block title %}Login{% endblock %}
{% block content %}
Login
{% endblock %}

8
templates/logout.html Normal file
View File

@ -0,0 +1,8 @@
{% extends "authBase.html" %}
{% block title %}Logout{% endblock %}
{% block content %}
Logout
{% endblock %}

8
templates/register.html Normal file
View File

@ -0,0 +1,8 @@
{% extends "authBase.html" %}
{% block title %}Create account{% endblock %}
{% block content %}
Create account
{% endblock %}