Initial checkin of stuff that exists so far.

This commit is contained in:
Armin Ronacher 2010-04-06 13:12:57 +02:00
commit 33850c0ebd
15 changed files with 984 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<!doctype html>
<title>{% block title %}Welcome{% endblock %} | MiniTwit</title>
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
<div class=page>
<h1>MiniTwit</h1>
<div class=navigation>
{% if g.user %}
<a href="{{ url_for('timeline') }}">my timeline</a> |
<a href="{{ url_for('public_timeline') }}">public timeline</a> |
<a href="{{ url_for('logout') }}">sign out [{{ g.user.username }}]</a>
{% else %}
<a href="{{ url_for('public_timeline') }}">public timeline</a> |
<a href="{{ url_for('register') }}">sign up</a> |
<a href="{{ url_for('login') }}">sign in</a>
{% endif %}
</div>
{% with flashes = get_flashed_messages() %}
{% if flashes %}
<ul class=flashes>
{% for message in flashes %}
<li>{{ message }}
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<div class=body>
{% block body %}{% endblock %}
</div>
<div class=footer>
MiniTwit &mdash; A Flask Application
</div>
</div>

View file

@ -0,0 +1,16 @@
{% extends "layout.html" %}
{% block title %}Sign In{% endblock %}
{% block body %}
<h2>Sign In</h2>
{% if error %}<div class=error><strong>Error:</strong> {{ error }}</div>{% endif %}
<form action="" method=post>
<dl>
<dt>Username:
<dd><input type=text name=username size=30 value="{{ request.form.username }}">
<dt>Password:
<dd><input type=password name=password size=30>
</dl>
<div class=actions><input type=submit value="Sign In"></div>
</form>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends "layout.html" %}
{% block title %}Sign Up{% endblock %}
{% block body %}
<h2>Sign Up</h2>
{% if error %}<div class=error><strong>Error:</strong> {{ error }}</div>{% endif %}
<form action="" method=post>
<dl>
<dt>Username:
<dd><input type=text name=username size=30 value="{{ request.form.username }}">
<dt>E-Mail:
<dd><input type=text name=email size=30 value="{{ request.form.email }}">
<dt>Password:
<dd><input type=password name=password size=30>
<dt>Password <small>(repeat)</small>:
<dd><input type=password name=password2 size=30>
</dl>
<div class=actions><input type=submit value="Sign Up"></div>
</form>
{% endblock %}

View file

@ -0,0 +1,49 @@
{% extends "layout.html" %}
{% block title %}
{% if request.endpoint == 'public_timeline' %}
Public Timeline
{% elif request.endpoint == 'user_timeline' %}
{{ profile_user.username }}'s Timeline
{% else %}
My Timeline
{% endif %}
{% endblock %}
{% block body %}
<h2>{{ self.title() }}</h2>
{% if g.user %}
{% if request.endpoint == 'user_timeline' %}
<div class=followstatus>
{% if g.user.user_id == profile_user.user_id %}
This is you!
{% elif followed %}
You are currently following this user.
<a class=unfollow href="{{ url_for('unfollow_user', username=profile_user.username)
}}">Unfollow user</a>.
{% else %}
You are not yet following this user.
<a class=follow href="{{ url_for('follow_user', username=profile_user.username)
}}">Follow user</a>.
{% endif %}
</div>
{% elif request.endpoint == 'timeline' %}
<div class=twitbox>
<h3>What's on your mind {{ g.user.username }}?</h3>
<form action="{{ url_for('add_message') }}" method=post>
<p><input type=text name=text size=60><!--
--><input type=submit value="Share">
</form>
</div>
{% endif %}
{% endif %}
<ul class=messages>
{% for message in messages %}
<li><img src="{{ message.email|gravatar(size=48) }}"><p>
<strong><a href="{{ url_for('user_timeline', username=message.username)
}}">{{ message.username }}</a></strong>
{{ message.text }}
<small>&mdash; {{ message.pub_date|datetimeformat }}</small>
{% else %}
<li><em>There are no messages so far.</em>
{% endfor %}
</ul>
{% endblock %}