add user posts view
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{%- from 'common/icons.html' import icn_info, icn_warn, icn_error, icn_bookmark -%}
|
||||
|
||||
{% macro timestamp(unix_ts) -%}
|
||||
{#<span class="timestamp" data-utc="{{ unix_ts }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></span>#}
|
||||
<time datetime="{{ unix_ts | iso8601 }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></time>
|
||||
{%- endmacro %}
|
||||
|
||||
@@ -114,7 +113,7 @@
|
||||
{% macro full_post(
|
||||
post, render_sig=true, is_latest=false,
|
||||
show_toolbar=true, is_editing=false, thread=none,
|
||||
show_reactions=true
|
||||
show_reactions=true, show_thread=false
|
||||
) -%}
|
||||
{%- if is_logged_in() -%}
|
||||
{%- set can_delete = post.user_id == get_active_user().id or is_mod() -%}
|
||||
@@ -143,13 +142,18 @@
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<div class="plank even minimal secondary-bg no-shadow post-info">
|
||||
<a href="{{get_post_url(post.id, _anchor=true)}}">
|
||||
{%- if post.edited_at <= post.created_at -%}
|
||||
<i>Posted on {{timestamp(post.created_at)}}</i>
|
||||
{%- else -%}
|
||||
<i>Edited on {{timestamp(post.edited_at)}}</i>
|
||||
<span>
|
||||
<a href="{{get_post_url(post.id, _anchor=true)}}">
|
||||
{%- if post.edited_at <= post.created_at -%}
|
||||
<i>Posted on {{timestamp(post.created_at)}}</i>
|
||||
{%- else -%}
|
||||
<i>Edited on {{timestamp(post.edited_at)}}</i>
|
||||
{%- endif -%}
|
||||
</a>
|
||||
{%- if show_thread -%}
|
||||
<span> in thread <a href="{{url_for('threads.thread_by_id', thread_id=post.thread_id)}}"> {{post.thread_title}}</a></span>
|
||||
{%- endif -%}
|
||||
</a>
|
||||
</span>
|
||||
{%- if show_toolbar -%}
|
||||
<span class="thread-actions">
|
||||
{%- if owns -%}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% from 'common/macros.html' import infobox with context %}
|
||||
{% from 'common/macros.html' import subheader %}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}log in{%- endblock -%}
|
||||
@@ -7,9 +8,7 @@ Welcome back! No account yet? <a href="{{url_for('users.sign_up')}}">Sign up</a>
|
||||
{%- endset -%}
|
||||
{{ subheader('Log in', welcome)}}
|
||||
{%- if request.args.get('error') -%}
|
||||
<div class="infobox plank critical">
|
||||
{{request.args.get('error')}}
|
||||
</div>
|
||||
{{infobox(request.args.error, InfoboxKind.ERROR)}}
|
||||
{%- endif -%}
|
||||
<form class="plank primary-bg full-width" method="POST">
|
||||
<label for="username">Username</label>
|
||||
|
||||
30
app/templates/users/posts.html
Normal file
30
app/templates/users/posts.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{%- from 'common/macros.html' import full_post with context -%}
|
||||
{%- from 'common/macros.html' import subheader, pager -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}{{ target_user.get_readable_name() }}'s posts{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{%- set td -%}
|
||||
<a href="{{url_for('users.user_page', username=target_user.username)}}">Back to profile</a>
|
||||
{%- if posts -%}
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Page</legend>
|
||||
{{- pager(page, page_count) -}}
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
{%- endset -%}
|
||||
{%- call() subheader("%s's posts" % target_user.get_readable_name(), td) -%}
|
||||
{%- endcall -%}
|
||||
{%- if posts -%}
|
||||
{%- for post in posts -%}
|
||||
<div class="post plank">{{full_post(post, show_toolbar=false, show_thread=true)}}</div>
|
||||
{%- endfor -%}
|
||||
<div class="plank">
|
||||
<fieldset class="plank even no-shadow minimal thread-actions">
|
||||
<legend>Page</legend>
|
||||
{{- pager(page, page_count) -}}
|
||||
</fieldset>
|
||||
</div>
|
||||
{%- else -%}
|
||||
<div class="plank">{{target_user.get_readable_name()}} has no posts.</div>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
@@ -1,3 +1,4 @@
|
||||
{% from 'common/macros.html' import infobox with context %}
|
||||
{% from 'common/macros.html' import subheader %}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}sign up{%- endblock -%}
|
||||
@@ -7,9 +8,7 @@ Please read the rules etc. stub
|
||||
{%- endset -%}
|
||||
{{ subheader('Sign up', welcome)}}
|
||||
{%- if request.args.get('error') -%}
|
||||
<div class="infobox plank critical">
|
||||
{{request.args.get('error')}}
|
||||
</div>
|
||||
{{infobox(request.args.error, InfoboxKind.ERROR)}}
|
||||
{%- endif -%}
|
||||
<form class="plank primary-bg full-width" method="POST">
|
||||
<label for="username">Username</label>
|
||||
|
||||
Reference in New Issue
Block a user