##// END OF EJS Templates
Added a short simple cache to the post template
neko259 -
r543:cc55cb0b 1.7-dev
parent child Browse files
Show More
@@ -1,91 +1,96 b''
1 1 {% load i18n %}
2 2 {% load board %}
3 {% load cache %}
3 4
4 {% spaceless %}
5 {% with thread=post.thread_new %}
6 {% if thread.archived %}
7 <div class="post archive_post" id="{{ post.id }}">
8 {% elif thread.can_bump %}
9 <div class="post" id="{{ post.id }}">
10 {% else %}
11 <div class="post dead_post" id="{{ post.id }}">
12 {% endif %}
5 {% get_current_language as LANGUAGE_CODE %}
13 6
14 {% if post.image %}
15 <div class="image">
16 <a
17 class="thumb"
18 href="{{ post.image.url }}"><img
19 src="{{ post.image.url_200x150 }}"
20 alt="{{ post.id }}"
21 width="{{ post.image_pre_width }}"
22 height="{{ post.image_pre_height }}"
23 data-width="{{ post.image_width }}"
24 data-height="{{ post.image_height }}"/>
25 </a>
26 </div>
27 {% endif %}
28 <div class="message">
29 <div class="post-info">
30 <span class="title">{{ post.title }}</span>
31 <a class="post_id" href="{% post_url post.id %}">
32 ({{ post.id }}) </a>
33 [<span class="pub_time">{{ post.pub_time }}</span>]
7 {% cache 60 post post.id post.thread_new.last_edit_time truncated moderator LANGUAGE_CODE %}
8 {% spaceless %}
9 {% with thread=post.thread_new %}
34 10 {% if thread.archived %}
35 β€” [{{ thread.bump_time }}]
36 {% endif %}
37 {% if not truncated %}
38 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
39 ; return false;">&gt;&gt;</a>]
40 {% endif %}
41 {% if post.is_opening and need_open_link %}
42 {% if post.thread_new.archived %}
43 [<a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>]
44 {% else %}
45 [<a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>]
46 {% endif %}
11 <div class="post archive_post" id="{{ post.id }}">
12 {% elif thread.can_bump %}
13 <div class="post" id="{{ post.id }}">
14 {% else %}
15 <div class="post dead_post" id="{{ post.id }}">
47 16 {% endif %}
48 17
49 {% if moderator %}
50 <span class="moderator_info">
51 [<a href="{% url 'delete' post_id=post.id %}"
52 >{% trans 'Delete' %}</a>]
53 ({{ post.poster_ip }})
54 [<a href="{% url 'ban' post_id=post.id %}?next={{ request.path }}"
55 >{% trans 'Ban IP' %}</a>]
56 </span>
18 {% if post.image %}
19 <div class="image">
20 <a
21 class="thumb"
22 href="{{ post.image.url }}"><img
23 src="{{ post.image.url_200x150 }}"
24 alt="{{ post.id }}"
25 width="{{ post.image_pre_width }}"
26 height="{{ post.image_pre_height }}"
27 data-width="{{ post.image_width }}"
28 data-height="{{ post.image_height }}"/>
29 </a>
30 </div>
31 {% endif %}
32 <div class="message">
33 <div class="post-info">
34 <span class="title">{{ post.title }}</span>
35 <a class="post_id" href="{% post_url post.id %}">
36 ({{ post.id }}) </a>
37 [<span class="pub_time">{{ post.pub_time }}</span>]
38 {% if thread.archived %}
39 β€” [{{ thread.bump_time }}]
40 {% endif %}
41 {% if not truncated %}
42 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
43 ; return false;">&gt;&gt;</a>]
44 {% endif %}
45 {% if post.is_opening and need_open_link %}
46 {% if post.thread_new.archived %}
47 [<a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>]
48 {% else %}
49 [<a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>]
50 {% endif %}
51 {% endif %}
52
53 {% if moderator %}
54 <span class="moderator_info">
55 [<a href="{% url 'delete' post_id=post.id %}"
56 >{% trans 'Delete' %}</a>]
57 ({{ post.poster_ip }})
58 [<a href="{% url 'ban' post_id=post.id %}?next={{ request.path }}"
59 >{% trans 'Ban IP' %}</a>]
60 </span>
61 {% endif %}
62 </div>
63 {% autoescape off %}
64 {% if truncated %}
65 {{ post.text.rendered|truncatewords_html:50 }}
66 {% else %}
67 {{ post.text.rendered }}
68 {% endif %}
69 {% endautoescape %}
70 {% if post.is_referenced %}
71 <div class="refmap">
72 {% trans "Replies" %}:
73 {% for ref_post in post.get_sorted_referenced_posts %}
74 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a
75 >{% if not forloop.last %},{% endif %}
76 {% endfor %}
77 </div>
57 78 {% endif %}
58 79 </div>
59 {% autoescape off %}
60 {% if truncated %}
61 {{ post.text.rendered|truncatewords_html:50 }}
62 {% else %}
63 {{ post.text.rendered }}
64 {% endif %}
65 {% endautoescape %}
66 {% if post.is_referenced %}
67 <div class="refmap">
68 {% trans "Replies" %}:
69 {% for ref_post in post.get_sorted_referenced_posts %}
70 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a
71 >{% if not forloop.last %},{% endif %}
72 {% endfor %}
80 {% if post.is_opening and thread.tags.exists %}
81 <div class="metadata">
82 {% if post.is_opening and need_open_link %}
83 {{ thread.get_images_count }} {% trans 'images' %}.
84 {% endif %}
85 <span class="tags">
86 {% for tag in thread.get_tags %}
87 <a class="tag" href="{% url 'tag' tag.name %}">
88 #{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
89 {% endfor %}
90 </span>
73 91 </div>
74 92 {% endif %}
75 </div>
76 {% if post.is_opening and thread.tags.exists %}
77 <div class="metadata">
78 {% if post.is_opening and need_open_link %}
79 {{ thread.get_images_count }} {% trans 'images' %}.
80 {% endif %}
81 <span class="tags">
82 {% for tag in thread.get_tags %}
83 <a class="tag" href="{% url 'tag' tag.name %}">
84 #{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
85 {% endfor %}
86 </span>
87 93 </div>
88 {% endif %}
89 </div>
90 {% endwith %}
91 {% endspaceless %}
94 {% endwith %}
95 {% endspaceless %}
96 {% endcache %} No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now