file upload added, link to db next

This commit is contained in:
Johannnes Bürst
2020-03-18 13:26:10 +01:00
parent b6b5f0e281
commit 1ea7cff2f1
11 changed files with 1518 additions and 31 deletions

View File

@@ -1,18 +1,54 @@
<!doctype html>
<title>{% block title %}{% endblock %} - Flaskr</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<nav>
<h1>Flaskr</h1>
<ul>
{% if g.user %}
<li><span>{{ g.user['username'] }}</span>
<li><a href="{{ url_for('auth.logout') }}">Log Out</a>
{% else %}
<li><a href="{{ url_for('auth.register') }}">Register</a>
<li><a href="{{ url_for('auth.login') }}">Log In</a>
{% endif %}
</ul>
</nav>
<head>
<title>{% block title %}{% endblock %}Dankventskalender</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='calender/w3.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='calender/style.css') }}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-colors-highway.css">
</head>
<body class="w3-light-grey">
<div class="w3-display-container">
<!-- Navigation bar -->
<nav>
<div class="w3-bar w3-center w3-highway-red w3-xlarge ">
<a class="w3-bar-item w3-button" onclick="goBack()"><i class="fa fa-arrow-left"></i></a>
<script>
function goBack() {
window.history.back();
}
</script>
<a href="https://johnnyikarus.de" class="w3-bar-item w3-button">Home</a>
<div class="w3-dropdown-hover">
<button class="w3-button">Dankventskalender</button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<a href="http://dankventskalender.johnnyikarus.de" class="w3-bar-item w3-button">Dankventskalender
2019</a>
<a href="{{ url_for('static', filename='archive/Dankventskalender_2018.html') }}"
class="w3-bar-item w3-button">Dankventskalender
2018</a>
<a href="{{ url_for('static', filename='archive/Dankventskalender_2017.html') }}"
class="w3-bar-item w3-button">Dankventskalender
2017</a>
</div>
</div>
<a href="https://johnnyikarus.de/memes.php" class="w3-bar-item w3-button button_flash_animation">Memes</a>
<!--a href="#" class="w3-bar-item w3-button">Push Me!</a-->
<!--<a href="..." class="w3-bar-item w3-button" style="opacity: 0.1">Privacy</a>-->
<!--<div class="w3-medium w3-margin-right w3-align-right"><p align="right">Visitors: </p></div>-->
{% if g.user %}
<span class="w3-bar-item w3-right">{{ g.user['username'] }}</span>
<a class="w3-bar-item w3-right w3-button" href="{{ url_for('auth.logout') }}">Log Out</a>
{% else %}
<a class="w3-bar-item w3-right w3-button" href="{{ url_for('auth.register') }}">Register</a>
<a class="w3-bar-item w3-right w3-button" href="{{ url_for('auth.login') }}">Log In</a>
{% endif %}
</div>
</nav>
</div>
<section class="content">
<header>
{% block header %}{% endblock %}
@@ -20,5 +56,7 @@
{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %}
{% block content %}{% endblock %}
</section>
</section>
{% block content %}
{% endblock %}
</body>

View File

@@ -1,15 +1,20 @@
{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}New Post{% endblock %}</h1>
<h1>{% block title %}Submit a Meme{% endblock %}</h1>
{% endblock %}
{% block content %}
<form method="post">
<label for="title">Title</label>
<input name="title" id="title" value="{{ request.form['title'] }}" required>
<label for="body">Body</label>
<textarea name="body" id="body">{{ request.form['body'] }}</textarea>
<input type="submit" value="Save">
</form>
{% endblock %}
<form method=post enctype=multipart/form-data>
<label for="title">Title</label>
<input name="title" id="title" value="{{ request.form['title'] }}" required>
<label for="body">Body</label>
<textarea name="body" id="body">{{ request.form['body'] }}</textarea>
<div>
<p>Choose a mp4, webm, gif , png or jpg file.(max 25MB)</p>
<input type="file" placeholder="meme" name="file" required>
</div>
<input type="submit" value=Upload>
</form>
{% endblock %}

View File

@@ -1,10 +1,20 @@
{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}Posts{% endblock %}</h1>
{% if g.user %}
<a class="action" href="{{ url_for('calender.create') }}">New</a>
{% endif %}
<div class="container w3-center">
<h1>{% block title %}Welcome to the Dankventskalender 2020!{% endblock %}</h1>
<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 %}
</div>
</div>
{% endblock %}
{% block content %}