Initial commit

This commit is contained in:
Yusur 2019-05-01 15:33:28 +02:00
commit c33a74711c
15 changed files with 606 additions and 0 deletions

7
templates/404.html Normal file
View file

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block body %}
<h2>Not Found</h2>
<p><a href="/">Back to homepage.</a></p>
{% endblock %}

30
templates/base.html Normal file
View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Cori+</title>
<link rel="stylesheet" type="text/css" href="/static/style.css">
</head>
<body>
<div class="header">
<h1><a href="{{ url_for('homepage') }}">Cori+</a></h1>
<div class="metanav">
{% if not session.logged_in %}
<a href="{{ url_for('login') }}">log in</a>
<a href="{{ url_for('register') }}">register</a>
{% else %}
<a href="{{ url_for('user_detail', username=current_user.username) }}">{{ current_user.username }}</a> -
<a href="{# url_for('public_timeline') #}">explore</a>
<a href="{{ url_for('create') }}">create</a>
<a href="{{ url_for('logout') }}">log out</a>
{% endif %}
</div>
</div>
<div class="content">
{% for message in get_flashed_messages() %}
<div class=flash>{{ message }}</div>
{% endfor %}
{% block body %}{% endblock %}
</div>
<script src="/static/lib.js"></script>
</body>
</html>

11
templates/create.html Normal file
View file

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block body %}
<h2>Create</h2>
<form action="{{ url_for('create') }}" method=post>
<dl>
<dt>Message:</dt>
<dd><textarea name="text" placeholder="What's happening?"></textarea></dd>
<dd><input type="submit" value="Create" /></dd>
</dl>
</form>
{% endblock %}

7
templates/homepage.html Normal file
View file

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block body %}
<h2>Hello</h2>
<p>Cori+ is made by people like you. <br/>
<a href="{{url_for('login')}}">Log in</a> or <a href="{{url_for('register')}}">register</a> to see more.</p>
{% endblock %}

View file

@ -0,0 +1,2 @@
<p class="message-content">{{ message.text|enrich }}</p>
<p class="message-footer"><a href="{{ url_for('user_detail', username=message.user.username) }}">{{ message.user.username }}</a> - {{ message.pub_date | human_date }}</p>

View file

@ -0,0 +1,6 @@
{% if page > 1 %}
<a class="prev" href="?page={{ page - 1 }}">Previous</a>
{% endif %}
{% if page < pages %}
<a class="next" href="?page={{ page + 1 }}">Next</a>
{% endif %}

19
templates/join.html Normal file
View file

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% block body %}
<h2>Join Cori+</h2>
<form action="{{ url_for('register') }}" method="post">
<dl>
<dt>Username:</dt>
<dd><input type="text" class="username-input" name="username"></dd>
<dt>Password:</dt>
<dd><input type="password" name="password"></dd>
<dt>Email:</dt>
<dd><input type="text" name="email">
<p><small>(used for gravatar)</small></p>
</dd>
<dt>Birthday:
<dd><input type="text" name="birthday" placeholder="yyyy-mm-dd">
<dd><input type="submit" value="Join">
</dl>
</form>
{% endblock %}

14
templates/login.html Normal file
View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block body %}
<h2>Login</h2>
{% if error %}<p class=error><strong>Error:</strong> {{ error }}{% endif %}
<form action="{{ url_for('login') }}" method=post>
<dl>
<dt>Username:
<dd><input type=text name=username>
<dt>Password:
<dd><input type=password name=password>
<dd><input type=submit value=Login>
</dl>
</form>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h2>Your Timeline</h2>
<ul>
{% for message in message_list %}
<li>{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

View file

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block body %}
<h2>Messages from {{ user.username }}</h2>
<p>
<strong>{{ user.messages|count }}</strong> messages
-
<strong>{{ user.followers()|count }}</strong> followers
-
<strong>{{ user.following()|count }}</strong> following
</p>
{% if current_user %}
{% if user.username != current_user.username %}
{% if current_user|is_following(user) %}
<form action="{{ url_for('user_unfollow', username=user.username) }}" method="post">
<input type="submit" value="- Un-follow" />
</form>
{% else %}
<form action="{{ url_for('user_follow', username=user.username) }}" method="post">
<input type="submit" value="+ Follow" />
</form>
{% endif %}
{% endif %}
{% endif %}
<ul>
{% for message in message_list %}
<li>{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}