summaryrefslogtreecommitdiffhomepage
path: root/apioforum/templates/common.html
blob: 3321085c0d57054d86c0549006da58603729a703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{% macro disp_user(username) -%} 
<a href="{{url_for('user.view_user',username=username)}}" class="username">{{username}}</a>
{%- endmacro %}

{% macro post_url(post) -%}
	{{url_for('thread.view_thread', thread_id=post.thread)}}#post_{{post.id}}
{%- endmacro %}

{% macro disp_post(post, buttons=False, footer=None) %}
<div class="post" id="post_{{post.id}}">
    <div class="post-heading">
        <span class="post-heading-a">
			{{disp_user(post.author)}}
			{{ts(post.created)}}
            {% if post.edited %}
                (edited {{ts(post.updated)}})
            {% endif %}
        </span>
        <span class="post-heading-b">
        {% if buttons %}
            {% if post.author == g.user %}
                <a class="actionbutton"
                   href="{{url_for('thread.edit_post',post_id=post.id)}}">edit</a>
                <a class="actionbutton"
                   href="{{url_for('thread.delete_post',post_id=post.id)}}">delete</a>
            {% endif %}
            <a class="actionbutton"
               href="{{url_for('thread.view_post',post_id=post.id)}}">src</a>
        {% endif %}
            
	<a class="post-anchor-link" href="{{post_url(post)}}">#{{post.id}}</a>
        </span>
    </div>
    <div class="post-content md">
        {{ post.content|md|safe }}
    </div>
    {% if footer %}
    <div class="post-footer">
        {{ footer }}
    </div>
    {% endif %}
</div>
{% endmacro %}

{% macro ts(dt) -%}
<time title="{{dt.isoformat(' ')}}" datetime="{{dt.isoformat(' ')}}">{{dt | fuzzy}}</time>
{%- endmacro %}

{% macro tag(the_tag) -%}
<span class="tag" style="color: {{the_tag.text_colour}}; background-color: {{the_tag.bg_colour}}">{{the_tag.name}}</span>
{%- endmacro %}