mirror of
https://github.com/rmontanana/microblog.git
synced 2025-08-19 01:05:52 +00:00
Chapter 6
This commit is contained in:
10
app/templates/_post.html
Normal file
10
app/templates/_post.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<img src="{{ post.author.avatar(36) }}" />
|
||||
</td>
|
||||
<td>
|
||||
{{ post.author.username }} says:<br />{{ post.body }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@@ -13,6 +13,7 @@
|
||||
{% if current_user.is_anonymous %}
|
||||
<a href="{{ url_for('login') }}">Login</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('user', username = current_user.username) }}">Profile</a>
|
||||
<a href="{{ url_for('logout') }}">Logout</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
23
app/templates/edit_profile.html
Normal file
23
app/templates/edit_profile.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Edit Profile</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br />
|
||||
{{ form.username(size = 32) }}<br />
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.about_me.label }}<br />
|
||||
{{ form.about_me(cols = 50, rows = 4) }}<br />
|
||||
{% for error in form.about_me.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endblock %}
|
29
app/templates/user.html
Normal file
29
app/templates/user.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<img src="{{ user.avatar(128) }}" />
|
||||
</td>
|
||||
<td>
|
||||
<h1>User: {{ user.username }}</h1>
|
||||
{% if user.about_me %}
|
||||
<p>{{ user.about_me }}</p>
|
||||
{% endif %}
|
||||
{% if user.last_seen %}
|
||||
<p>Last seen on: {{ user.last_seen }}</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% if user == current_user %}
|
||||
<p>
|
||||
<a href="{{ url_for('edit_profile') }}">Edit your profile</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<hr />
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Reference in New Issue
Block a user