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