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 %}