initial commit

This commit is contained in:
Rupus Reinefjord 2018-01-11 23:40:31 +01:00
commit a528892ac8
46 changed files with 2152 additions and 0 deletions

View file

@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% set navbar = [
(url_for('admin_new_photo'), 'new_photo', 'Upload new photo'),
(url_for('admin_photos'), 'photos', 'View photos'),
(url_for('logout'), 'logout', 'Logout')
] %}
{% block header %}
<h1><a href="{{ url_for('admin') }}" class="nav-item">administration</a></h1>
{% endblock %}

View file

@ -0,0 +1,26 @@
{% extends 'admin/admin.html' %}
{% set title = 'New photo' %}
{% set active_page = 'new_photo' %}
{% block body %}
<main>
<form method="POST" enctype="multipart/form-data">
{{ form.csrf_token }}
<div class="field">
{{ form.photo.label }}
{{ form.photo }}
</div>
<div class="field">
{{ form.title.label }}
{{ form.title }}
</div>
<div class="field">
{{ form.description.label }}
{{ form.description }}
</div>
<button type="submit">Submit</button>
</form>
</main>
{% endblock %}

View file

@ -0,0 +1,34 @@
{% extends 'admin/admin.html' %}
{% set title = photo.title or 'Unnamed photo' %}
{% set active_page = 'photos' %}
{% block body %}
<main class="view-image">
<img src="{{ photo_resize_url(photo, 800) }}">
<h2>{{ photo.title or 'Unnamed photo' }}</h2>
{{ photo.description or 'No description'}}
<form method="POST" enctype="multipart/form-data">
{{ form.csrf_token }}
<div class="field">
{{ form.photo.label }}
{{ form.photo }}
</div>
<div class="field">
{{ form.title.label }}
{{ form.title }}
</div>
<div class="field">
{{ form.description.label }}
{{ form.description }}
</div>
<button type="submit">Submit</button>
</form>
<div class="field">
<a href="{{ url_for('admin_remove_photo', photo_id=photo.id) }}">Remove</a>
</div>
</main>
{% endblock %}

View file

@ -0,0 +1,18 @@
{% extends 'admin/admin.html' %}
{% set title = 'Photos' %}
{% set active_page = 'photos' %}
{% block body %}
<main>
<h2>Photos</h2>
{% if photos %}
<ul>
{% for photo in photos %}
<li><a href="{{ url_for('admin_edit_photo', photo_id=photo.id) }}">{{ photo.timestamp.strftime("%Y-%m-%d %H:%M:%S") }} - {{ photo.title or photo.filename }}</a></li>
{% endfor %}
</ul>
{% endif %}
</main>
{% endblock %}

View file

@ -0,0 +1,26 @@
{% extends 'admin/admin.html' %}
{% set title = 'Remove ' + (photo.title or 'unnamed photo') %}
{% set active_page = 'photos' %}
{% block body %}
<main class="view-image">
<img src="{{ photo_resize_url(photo, 800) }}">
<h2>{{ photo.title or 'Unnamed photo' }}</h2>
{{ photo.description or 'No description'}}
<form method="POST" enctype="multipart/form-data">
{{ form.csrf_token }}
<h2>Remove photo?</h2>
<p>Are you sure?</p>
<div class="field">
<button type="submit">Remove</button>
</div>
<div class="field">
<a href="{{ url_for('admin_edit_photo', photo_id=photo.id) }}">No, take me away from here</a>
</div>
</form>
</main>
{% endblock %}

44
templates/base.html Normal file
View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
{% block head %}
<title>{{ title }} | reinefjord</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
<link rel="icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
-->
{% assets 'common_css' %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
{% endblock %}
</head>
<body>
<div class="wrapper">
<header>
{% block header %}{% endblock %}
</header>
<nav>
<ul>
{% for href, id, caption in navbar %}
<li><a href="{{ href|e }}" class="nav-item {% if id == active_page %}active{% endif %}">{{ caption|e }}</a></li>
{% endfor %}
</ul>
</nav>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<ul class="flashes">
{% for category, message in messages %}
<li class="flash {{ category }}">{{ message|safe }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block body %}{% endblock %}
</div>
</body>
</html>

10
templates/error/404.html Normal file
View file

@ -0,0 +1,10 @@
{% extends "layout.html" %}
{% set title = "404 - Not found" %}
{% block body %}
<main>
<h2>404 &mdash; Not found</h2>
<p>The page you were looking for was not found :(</p>
</main>
{% endblock %}

11
templates/error/500.html Normal file
View file

@ -0,0 +1,11 @@
{% extends "layout.html" %}
{% set title = "500 - Internal Server Error" %}
{% block body %}
<main>
<h2>500 &mdash; Internal Server Error</h2>
<p>It seems like something broke on the server end. Sorry! :S</p>
<p>Try again or try something else.</p>
</main>
{% endblock %}

13
templates/index.html Normal file
View file

@ -0,0 +1,13 @@
{% extends 'layout.html' %}
{% set active_page = 'index' %}
{% set title = '^_^' %}
{% block body %}
<main>
<h2>Welcome</h2>
<p>... to my fancy webpage!</p>
</main>
{% endblock %}

11
templates/layout.html Normal file
View file

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% set navbar = [
(url_for('index'), 'index', 'Home'),
(url_for('photography'), 'photo', 'Photography'),
(url_for('me'), 'me', 'Find me')
] %}
{% block header %}
<h1><a href="{{ url_for('index') }}" class="nav-item">rupus reinefjord</a></h1>
{% endblock %}

20
templates/login.html Normal file
View file

@ -0,0 +1,20 @@
{% extends 'layout.html' %}
{% set active_page = None %}
{% set title = 'Login' %}
{% block body %}
<main>
<h2>Login</h2>
<form method="POST">
{{ form.csrf_token }}
<div class="field">
{{ form.password.label }}
{{ form.password }}
</div>
<button type="submit">Login</button>
</form>
</main>
{% endblock %}

31
templates/me.html Normal file
View file

@ -0,0 +1,31 @@
{% extends 'layout.html' %}
{% set active_page = 'me' %}
{% set title = 'Find me' %}
{% block body %}
<main>
<h2>Find me</h2>
<dl>
<dt>GitHub:</dt>
<dd><a href="https://github.com/reinefjord">reinefjord</a></dd>
<dt>Instagram:</dt>
<dd><a href="https://www.instagram.com/rupusreinefjord/">@rupusreinefjord</a></dd>
<dt>Flickr:</dt>
<dd><a href="https://www.flickr.com/photos/koltrast_">koltrast_</a></dd>
<dt>Keybase:</dt>
<dd><a href="https://keybase.io/rupus">rupus</a></dd>
</dl>
<h2>Contact me</h2>
<dl>
<dt>Email:</dt>
<dd>
<a href="mailto:firstname(at)lastname(dot)net" class="email">cnVwdXNAa2x0cnN0LnNl</a>
<noscript><p>Please activate javascript to see the address. Hint: it is <span class="email">firstname(at)lastname(dot)net</span></p></noscript>
</dd>
<dt>PGP:</dt>
<dd><a href="{{ url_for('static', filename='rupusreinefjord_pubkey.asc') }}"><code>E275 C3F0 8765 EBC3 C906 66F4 E918 999B E668 8BD2</code></a></dd>
</dl>
<script src="{{ url_for('static', filename='js/emaildecode.js') }}"></script>
</main>
{% endblock %}

View file

@ -0,0 +1,20 @@
{% extends 'layout.html' %}
{% set active_page = 'photo' %}
{% set title = 'Photography' %}
{% block body %}
<main>
<h2>Photography</h2>
<div class="photo-grid">
{% for photo in photos %}
<a href="{{ url_for('view_photo', photo_id=photo.id) }}">
<img srcset="{{ photo_resize_url(photo, 200) }},
{{ photo_resize_url(photo, 300) }} 1.5x,
{{ photo_resize_url(photo, 400) }} 2x"
src="{{ photo_resize_url(photo, 200) }}">
</a>
{% endfor %}
</div>
</main>
{% endblock %}

32
templates/view_photo.html Normal file
View file

@ -0,0 +1,32 @@
{% extends 'layout.html' %}
{% set active_page = 'photo' %}
{% set title = 'Photography' %}
{% block body %}
<main class="view-image">
<img srcset="{{ photo_resize_url(photo, 800) }},
{{ photo_resize_url(photo, 1200) }} 1.5x,
{{ photo_resize_url(photo, 1600) }} 2x"
src="{{ photo_resize_url(photo, 800) }}">
<article>
{% if photo.title %}
<h2>{{ photo.title }}</h2>
{% endif %}
{% if photo.description %}
{{ photo.html_description|safe }}
{% endif %}
{% if next or prev %}
</article>
<nav>
{% if next %}
<a href="{{ url_for('view_photo', photo_id=next.id) }}" class="nav-item next">&larr; Next</a>
{% endif %}
{% if prev %}
<a href="{{ url_for('view_photo', photo_id=prev.id) }}" class="nav-item prev">Previous &rarr;</a>
{% endif %}
{% endif %}
</main>
{% endblock %}