microblog/app/templates/_post.html

48 lines
2.1 KiB
HTML

<table class="table table-hover">
<tr>
<td width="70px">
<a href="{{ url_for('main.user', username=post.author.username) }}">
<img src="{{ post.author.avatar(70) }}" />
</a>
</td>
<td>
{% set user_link %}
<span class="user_popup">
<a href="{{ url_for('main.user', username=post.author.username) }}">
{{ post.author.username }}
</a>
</span>
{% endset %}
{{ _('%(username)s said %(when)s',
username=user_link, when=moment(post.timestamp).fromNow()) }}
<br>
<span id="post{{ post.id }}">{{ post.body }}</span>
{% if post.language and post.language != g.locale %}
<br><br>
<span id="translation{{ post.id }}">
<a href="javascript:translate(
'#post{{ post.id }}',
'#translation{{ post.id }}',
'{{ post.language }}',
'{{ g.locale }}');">{{ _('Translate') }}</a>
</span>
{% endif %}
{% if post.author.username != current_user.username %}
{% if not current_user.has_archived_post(post.id) %}
<a href="{{ url_for('main.archive', post_id=post.id, user_id=post.author.id ,post_b=post.body, post_user=post.author.username, post_time=post.timestamp) }}">Archive</a>
{% else %}
<a href="{{ url_for('main.archive_remove', post_user=post.author.username, post_id=post.id) }}">Remove from Archive</a>
{% endif %}
{% endif %}
{% if post.author.username == current_user.username %}
<a href="{{ url_for('main.delete', post_id=post.id) }}">Delete</a>
{% endif %}
</td>
</tr>
</table>