basic admin interface done

This commit is contained in:
Johannnes Bürst
2020-03-19 17:12:31 +01:00
parent de0da705fa
commit 6dbd4ca229
4 changed files with 92 additions and 43 deletions

View File

@@ -8,11 +8,11 @@
<div>
<h6>Submit your meme for the next day now! Feel free to create and submit your own creations. </h6>
<br>
{% if g.user %}
<a class="action" href="{{ url_for('calender.create') }}">
<button>Submit a Meme</button>
</a>
{% endif %}
<a class="action" href="{{ url_for('calender.create') }}">
<button>Submit a Meme</button>
</a>
</div>
</div>
{% endblock %}
@@ -20,26 +20,32 @@
{% block content %}
<div class="container w3-center">
{% for post in posts %}
<div class="item">
<article class="post">
<header>
<div>
<h1>{{ post['title'] }}</h1>
<h2>{{ post['nickname'] }}</h2>
<div class="about">by {{ post['username'] }}
on {{ post['created'].strftime('%Y-%m-%d') }}</div>
</div>
{% if g.user['id'] == post['author_id'] %}
<a class="action" href="{{ url_for('calender.update', id=post['id']) }}">Edit</a>
{% if post['chosen'] == 1 %}
<div class="item">
<article class="post">
<header>
<div>
<h1>{{ post['title'] }}</h1>
<h2>{{ post['nickname'] }}</h2>
<div class="about">by {{ post['username'] }}
on {{ post['created'].strftime('%Y-%m-%d') }}</div>
</div>
</header>
{% if post['type'] == 'image' %}
<img class="file" src="{{ post['file'] }}">
{% endif %}
</header>
<img class="file" src="{{ post['file'] }}">
<p class="body">{{ post['body'] }}</p>
</article>
{% if not loop.last %}
<hr>
{% endif %}
</div>
{% if post['type'] == 'video' %}
<video class="file" preload="none" controls="" width="500">
<source src="{{ post['file'] }}">
</video>
{% endif %}
<p class="body">{{ post['body'] }}</p>
</article>
{% if not loop.last %}
<hr>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% endblock %}

View File

@@ -4,12 +4,30 @@
{% endblock %}
{% block content %}
<form method="post">
<form method=post enctype=multipart/form-data>
<label for="title">Title</label>
<input name="title" id="title"
value="{{ request.form['title'] or post['title'] }}" required>
<label for="nickname">Nickname</label>
<input name="nickname" id="nickname" value="{{ request.form['nickname'] or post['nickname'] }}" required>
<label for="body">Body</label>
<textarea name="body" id="body">{{ request.form['body'] or post['body'] }}</textarea>
<label for="file">Body</label>
{% if post['type'] == 'image' %}
<img class="file" src="{{ post['file'] }}">
{% endif %}
{% if post['type'] == 'video' %}
<video class="file" preload="none" controls="" width="500">
<source src="{{ post['file'] }}">
</video>
{% endif %}
<div>
<p>Choose a mp4, webm, gif , png or jpg file.(max 25MB)</p>
<input type="file" placeholder="meme" name="file" id="file"
value="{{ request.form['file'] or post['file'] }}">
</div>
<label for="chosen">Chosen</label><br>
<input id="chosen" name="chosen" value="{{ request.form['chosen'] or post['chosen'] }}">
<input type="submit" value="Save">
</form>
<hr>