Start moving personal site into db
This commit is contained in:
parent
fc7943f327
commit
f482cb562b
13 changed files with 211 additions and 53 deletions
BIN
wedding_site/primary/static/primary/fonts/Emitha-Script.otf
Executable file
BIN
wedding_site/primary/static/primary/fonts/Emitha-Script.otf
Executable file
Binary file not shown.
BIN
wedding_site/primary/static/primary/fonts/GlacialIndifference-Bold.otf
Executable file
BIN
wedding_site/primary/static/primary/fonts/GlacialIndifference-Bold.otf
Executable file
Binary file not shown.
BIN
wedding_site/primary/static/primary/fonts/GlacialIndifference-Regular.otf
Executable file
BIN
wedding_site/primary/static/primary/fonts/GlacialIndifference-Regular.otf
Executable file
Binary file not shown.
BIN
wedding_site/primary/static/primary/images/Background.png
Executable file
BIN
wedding_site/primary/static/primary/images/Background.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 491 KiB |
BIN
wedding_site/primary/static/primary/images/Blob1.png
Executable file
BIN
wedding_site/primary/static/primary/images/Blob1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 737 KiB |
BIN
wedding_site/primary/static/primary/images/Blob2.png
Executable file
BIN
wedding_site/primary/static/primary/images/Blob2.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 577 KiB |
BIN
wedding_site/primary/static/primary/images/Flowers.png
Executable file
BIN
wedding_site/primary/static/primary/images/Flowers.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 533 KiB |
165
wedding_site/primary/static/primary/style.css
Executable file
165
wedding_site/primary/static/primary/style.css
Executable file
|
@ -0,0 +1,165 @@
|
|||
@font-face {
|
||||
font-family: 'GlacialIndifference';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('GlacialIndifference'),
|
||||
url('fonts/GlacialIndifference-Regular.otf') format('opentype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'GlacialIndifference';
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src: local('GlacialIndifference'),
|
||||
url('fonts/GlacialIndifference-Bold.otf') format('opentype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Emitha-Script';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Emitha-Script'),
|
||||
url('fonts/Emitha-Script.otf') format('opentype');
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
margin: 0 auto;
|
||||
background:
|
||||
top right / 40% no-repeat url('images/Flowers.png'),
|
||||
bottom -150px left -400px / 1000px no-repeat url('images/Blob1.png'),
|
||||
top -300px right -250px / 700px no-repeat url('images/Blob2.png'),
|
||||
url('images/Background.png');
|
||||
}
|
||||
|
||||
.site-tagline{
|
||||
text-align: center;
|
||||
margin-top: 140px;
|
||||
font-family: GlacialIndifference;
|
||||
font-size: 74px;
|
||||
}
|
||||
|
||||
.site-names{
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
font-family: GlacialIndifference;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.site-tagline-span{
|
||||
font-family: Emitha-Script;
|
||||
font-size: 184px;
|
||||
position:relative;
|
||||
bottom: -30px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.main-nav {
|
||||
margin:0 auto;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-button {
|
||||
display: block;
|
||||
color: black;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
font-size: 24px;
|
||||
font-family: GlacialIndifference;
|
||||
}
|
||||
|
||||
.standard-a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.standard-a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.biglink-a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.biglink-a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.login-input{
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-family: GlacialIndifference;
|
||||
}
|
||||
|
||||
input[type=password] {
|
||||
padding:5px;
|
||||
border:2px solid #ccc;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
input[type=password]:autofill {
|
||||
background: #bdc4c2; /* or any other */
|
||||
}
|
||||
|
||||
|
||||
input[type=password]:focus {
|
||||
border-color:#333;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
padding:5px 15px;
|
||||
background:#b9b9b9;
|
||||
border:0 none;
|
||||
cursor:pointer;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.article-content{
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
width: 50%;
|
||||
margin:0 auto;
|
||||
font-family: GlacialIndifference;
|
||||
}
|
||||
|
||||
.jumbo-image {
|
||||
margin:0 auto;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
max-height:300px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 8px 0;
|
||||
}
|
||||
|
||||
.signature{
|
||||
font-family: Emitha-Script;
|
||||
font-size: 50px;
|
||||
width: 70%;
|
||||
text-align: center;
|
||||
margin:0 auto;
|
||||
}
|
6
wedding_site/primary/templates/header.html
Normal file
6
wedding_site/primary/templates/header.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<title>{{site.title}}</title>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1">
|
||||
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'primary/style.css' %}">
|
11
wedding_site/primary/templates/index_body.html
Normal file
11
wedding_site/primary/templates/index_body.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="site-tagline">SAVE <span class="site-tagline-span">the</span> DATE</div>
|
||||
|
||||
<div class="site-names">JAMES AND FIONNUALA</div>
|
||||
|
||||
<div class="login-input">
|
||||
<form method="put" action="login">
|
||||
<label for="pwd">Password:</label>
|
||||
<input type="password" id="pwd" value="" name="token">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
10
wedding_site/primary/templates/page_header.html
Normal file
10
wedding_site/primary/templates/page_header.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<header>
|
||||
<div class="main-nav">
|
||||
<ul>
|
||||
{% for page in pages %}
|
||||
<li><a class="nav-button"
|
||||
href="/{{page.name | lower}}">{{page.pretty_name}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
|
@ -5,7 +5,7 @@ from . import views
|
|||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("schedule", views.schedule, name="schedule"),
|
||||
path('schedule', views.schedule, name="schedule"),
|
||||
path("thingstodo", views.things_to_do, name="thingstodo"),
|
||||
path("travel", views.travel, name="travel"),
|
||||
]
|
||||
|
|
|
@ -12,43 +12,22 @@ _TEMPLATE = """
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{{site_header}}
|
||||
{{site_header | safe}}
|
||||
</head>
|
||||
<body>
|
||||
{{page_body}}
|
||||
{{page_body | safe}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
"""
|
||||
|
||||
_BODY = """
|
||||
<div class="site-tagline">SAVE <span class="site-tagline-span">the</span> DATE</div>
|
||||
|
||||
<div class="site-names">JAMES AND FIONNUALA</div>
|
||||
|
||||
<div class="login-input">
|
||||
<form method="put" action="login">
|
||||
<label for="pwd">Password:</label>
|
||||
<input type="password" id="pwd" value="" name="token">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
"""
|
||||
|
||||
_HEADER = """
|
||||
<title>{{site.title}}</title>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/static/css/styles.css">
|
||||
"""
|
||||
|
||||
def get_site_header(site):
|
||||
template = Template(_HEADER)
|
||||
template = Template(site.header)
|
||||
context = Context({"site": site})
|
||||
return template.render(context)
|
||||
|
||||
def get_index_body(site):
|
||||
template = Template(_BODY)
|
||||
template = Template(site.index)
|
||||
context = Context({"site": site})
|
||||
return template.render(context)
|
||||
|
||||
|
@ -63,34 +42,11 @@ def index(request):
|
|||
soup = BeautifulSoup(template.render(context))
|
||||
return HttpResponse(soup.prettify())
|
||||
|
||||
def schedule(request):
|
||||
return get_page("Schedule")
|
||||
|
||||
def things_to_do(request):
|
||||
return get_page("ThingsToDo")
|
||||
|
||||
def travel(request):
|
||||
return get_page("Travel")
|
||||
|
||||
|
||||
_PAGE_HEADER = """
|
||||
<header>
|
||||
<div class="main-nav">
|
||||
<ul>
|
||||
{% for page in pages %}
|
||||
<li><a class="nav-button"
|
||||
href="/{{page.pretty_name}}">{{page.name}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
"""
|
||||
|
||||
def get_page_header(site: Site):
|
||||
|
||||
pages = site.page_set.filter(navigable=True)
|
||||
template = Template(_PAGE_HEADER)
|
||||
context = Context({"pages", pages})
|
||||
template = Template(site.page_header)
|
||||
context = Context({"pages" : pages})
|
||||
return template.render(context)
|
||||
|
||||
def get_page_body(site: Site, page: Page):
|
||||
|
@ -108,5 +64,15 @@ def get_page(name:str):
|
|||
"site_header" : get_site_header(site),
|
||||
"page_body" : get_page_body(site, page)})
|
||||
|
||||
soup = BeautifulSoup(template.render(context))
|
||||
content = template.render(context)
|
||||
soup = BeautifulSoup(content, features="html.parser")
|
||||
return HttpResponse(soup.prettify())
|
||||
|
||||
def schedule(request):
|
||||
return get_page("Schedule")
|
||||
|
||||
def things_to_do(request):
|
||||
return get_page("ThingsToDo")
|
||||
|
||||
def travel(request):
|
||||
return get_page("Travel")
|
Loading…
Reference in a new issue