##// END OF EJS Templates
Optimized thread list loading
neko259 -
r1028:aaf7a38a default
parent child Browse files
Show More
@@ -1,188 +1,190 b''
1 {% extends "boards/base.html" %}
1 {% extends "boards/base.html" %}
2
2
3 {% load i18n %}
3 {% load i18n %}
4 {% load cache %}
4 {% load cache %}
5 {% load board %}
5 {% load board %}
6 {% load static %}
6 {% load static %}
7
7
8 {% block head %}
8 {% block head %}
9 {% if tag %}
9 {% if tag %}
10 <title>{{ tag.name }} - {{ site_name }}</title>
10 <title>{{ tag.name }} - {{ site_name }}</title>
11 {% else %}
11 {% else %}
12 <title>{{ site_name }}</title>
12 <title>{{ site_name }}</title>
13 {% endif %}
13 {% endif %}
14
14
15 {% if current_page.has_previous %}
15 {% if current_page.has_previous %}
16 <link rel="prev" href="
16 <link rel="prev" href="
17 {% if tag %}
17 {% if tag %}
18 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
18 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
19 {% else %}
19 {% else %}
20 {% url "index" page=current_page.previous_page_number %}
20 {% url "index" page=current_page.previous_page_number %}
21 {% endif %}
21 {% endif %}
22 " />
22 " />
23 {% endif %}
23 {% endif %}
24 {% if current_page.has_next %}
24 {% if current_page.has_next %}
25 <link rel="next" href="
25 <link rel="next" href="
26 {% if tag %}
26 {% if tag %}
27 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
27 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
28 {% else %}
28 {% else %}
29 {% url "index" page=current_page.next_page_number %}
29 {% url "index" page=current_page.next_page_number %}
30 {% endif %}
30 {% endif %}
31 " />
31 " />
32 {% endif %}
32 {% endif %}
33
33
34 {% endblock %}
34 {% endblock %}
35
35
36 {% block content %}
36 {% block content %}
37
37
38 {% get_current_language as LANGUAGE_CODE %}
38 {% get_current_language as LANGUAGE_CODE %}
39
39
40 {% if tag %}
40 {% if tag %}
41 <div class="tag_info">
41 <div class="tag_info">
42 <h2>
42 <h2>
43 {% if is_favorite %}
43 {% if is_favorite %}
44 <a href="{% url 'tag' tag.name %}?method=unsubscribe&next={{ request.path }}"
44 <a href="{% url 'tag' tag.name %}?method=unsubscribe&next={{ request.path }}"
45 class="fav" rel="nofollow">β˜…</a>
45 class="fav" rel="nofollow">β˜…</a>
46 {% else %}
46 {% else %}
47 <a href="{% url 'tag' tag.name %}?method=subscribe&next={{ request.path }}"
47 <a href="{% url 'tag' tag.name %}?method=subscribe&next={{ request.path }}"
48 class="not_fav" rel="nofollow">β˜…</a>
48 class="not_fav" rel="nofollow">β˜…</a>
49 {% endif %}
49 {% endif %}
50 {% if is_hidden %}
50 {% if is_hidden %}
51 <a href="{% url 'tag' tag.name %}?method=unhide&next={{ request.path }}"
51 <a href="{% url 'tag' tag.name %}?method=unhide&next={{ request.path }}"
52 title="{% trans 'Show tag' %}"
52 title="{% trans 'Show tag' %}"
53 class="fav" rel="nofollow">H</a>
53 class="fav" rel="nofollow">H</a>
54 {% else %}
54 {% else %}
55 <a href="{% url 'tag' tag.name %}?method=hide&next={{ request.path }}"
55 <a href="{% url 'tag' tag.name %}?method=hide&next={{ request.path }}"
56 title="{% trans 'Hide tag' %}"
56 title="{% trans 'Hide tag' %}"
57 class="not_fav" rel="nofollow">H</a>
57 class="not_fav" rel="nofollow">H</a>
58 {% endif %}
58 {% endif %}
59 {% autoescape off %}
59 {% autoescape off %}
60 {{ tag.get_view }}
60 {{ tag.get_view }}
61 {% endautoescape %}
61 {% endautoescape %}
62 {% if moderator %}
62 {% if moderator %}
63 <span class="moderator_info">[<a href="{% url 'admin:boards_tag_change' tag.id %}">{% trans 'Edit tag' %}</a>]</span>
63 <span class="moderator_info">[<a href="{% url 'admin:boards_tag_change' tag.id %}">{% trans 'Edit tag' %}</a>]</span>
64 {% endif %}
64 {% endif %}
65 </h2>
65 </h2>
66 <p>{% blocktrans with thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p>
66 <p>{% blocktrans with thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p>
67 </div>
67 </div>
68 {% endif %}
68 {% endif %}
69
69
70 {% if threads %}
70 {% if threads %}
71 {% if current_page.has_previous %}
71 {% if current_page.has_previous %}
72 <div class="page_link">
72 <div class="page_link">
73 <a href="
73 <a href="
74 {% if tag %}
74 {% if tag %}
75 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
75 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
76 {% else %}
76 {% else %}
77 {% url "index" page=current_page.previous_page_number %}
77 {% url "index" page=current_page.previous_page_number %}
78 {% endif %}
78 {% endif %}
79 ">{% trans "Previous page" %}</a>
79 ">{% trans "Previous page" %}</a>
80 </div>
80 </div>
81 {% endif %}
81 {% endif %}
82
82
83 {% for thread in threads %}
83 {% for thread in threads %}
84 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
84 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
85 <div class="thread">
85 <div class="thread">
86 {% post_view thread.get_opening_post moderator is_opening=True thread=thread truncated=True need_open_link=True %}
86 {% post_view thread.get_opening_post moderator is_opening=True thread=thread truncated=True need_open_link=True %}
87 {% if not thread.archived %}
87 {% if not thread.archived %}
88 {% with last_replies=thread.get_last_replies %}
88 {% with last_replies=thread.get_last_replies %}
89 {% if last_replies %}
89 {% if last_replies %}
90 {% if thread.get_skipped_replies_count %}
90 {% with skipped_replies_count=thread.get_skipped_replies_count %}
91 <div class="skipped_replies">
91 {% if skipped_replies_count %}
92 <a href="{% url 'thread' thread.get_opening_post.id %}">
92 <div class="skipped_replies">
93 {% blocktrans with count=thread.get_skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
93 <a href="{% url 'thread' thread.get_opening_post_id %}">
94 </a>
94 {% blocktrans with count=skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
95 </div>
95 </a>
96 {% endif %}
96 </div>
97 {% endif %}
98 {% endwith %}
97 <div class="last-replies">
99 <div class="last-replies">
98 {% for post in last_replies %}
100 {% for post in last_replies %}
99 {% post_view post is_opening=False moderator=moderator truncated=True %}
101 {% post_view post is_opening=False moderator=moderator truncated=True %}
100 {% endfor %}
102 {% endfor %}
101 </div>
103 </div>
102 {% endif %}
104 {% endif %}
103 {% endwith %}
105 {% endwith %}
104 {% endif %}
106 {% endif %}
105 </div>
107 </div>
106 {% endcache %}
108 {% endcache %}
107 {% endfor %}
109 {% endfor %}
108
110
109 {% if current_page.has_next %}
111 {% if current_page.has_next %}
110 <div class="page_link">
112 <div class="page_link">
111 <a href="
113 <a href="
112 {% if tag %}
114 {% if tag %}
113 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
115 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
114 {% else %}
116 {% else %}
115 {% url "index" page=current_page.next_page_number %}
117 {% url "index" page=current_page.next_page_number %}
116 {% endif %}
118 {% endif %}
117 ">{% trans "Next page" %}</a>
119 ">{% trans "Next page" %}</a>
118 </div>
120 </div>
119 {% endif %}
121 {% endif %}
120 {% else %}
122 {% else %}
121 <div class="post">
123 <div class="post">
122 {% trans 'No threads exist. Create the first one!' %}</div>
124 {% trans 'No threads exist. Create the first one!' %}</div>
123 {% endif %}
125 {% endif %}
124
126
125 <div class="post-form-w">
127 <div class="post-form-w">
126 <script src="{% static 'js/panel.js' %}"></script>
128 <script src="{% static 'js/panel.js' %}"></script>
127 <div class="post-form">
129 <div class="post-form">
128 <div class="form-title">{% trans "Create new thread" %}</div>
130 <div class="form-title">{% trans "Create new thread" %}</div>
129 <div class="swappable-form-full">
131 <div class="swappable-form-full">
130 <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %}
132 <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %}
131 {{ form.as_div }}
133 {{ form.as_div }}
132 <div class="form-submit">
134 <div class="form-submit">
133 <input type="submit" value="{% trans "Post" %}"/>
135 <input type="submit" value="{% trans "Post" %}"/>
134 </div>
136 </div>
135 (ctrl-enter)
137 (ctrl-enter)
136 </form>
138 </form>
137 </div>
139 </div>
138 <div>
140 <div>
139 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
141 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
140 </div>
142 </div>
141 <div><a href="{% url "staticpage" name="help" %}">
143 <div><a href="{% url "staticpage" name="help" %}">
142 {% trans 'Text syntax' %}</a></div>
144 {% trans 'Text syntax' %}</a></div>
143 </div>
145 </div>
144 </div>
146 </div>
145
147
146 <script src="{% static 'js/form.js' %}"></script>
148 <script src="{% static 'js/form.js' %}"></script>
147
149
148 {% endblock %}
150 {% endblock %}
149
151
150 {% block metapanel %}
152 {% block metapanel %}
151
153
152 <span class="metapanel">
154 <span class="metapanel">
153 <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b>
155 <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b>
154 {% trans "Pages:" %}
156 {% trans "Pages:" %}
155 <a href="
157 <a href="
156 {% if tag %}
158 {% if tag %}
157 {% url "tag" tag_name=tag.name page=paginator.page_range|first %}
159 {% url "tag" tag_name=tag.name page=paginator.page_range|first %}
158 {% else %}
160 {% else %}
159 {% url "index" page=paginator.page_range|first %}
161 {% url "index" page=paginator.page_range|first %}
160 {% endif %}
162 {% endif %}
161 ">&lt;&lt;</a>
163 ">&lt;&lt;</a>
162 [
164 [
163 {% for page in paginator.center_range %}
165 {% for page in paginator.center_range %}
164 <a
166 <a
165 {% ifequal page current_page.number %}
167 {% ifequal page current_page.number %}
166 class="current_page"
168 class="current_page"
167 {% endifequal %}
169 {% endifequal %}
168 href="
170 href="
169 {% if tag %}
171 {% if tag %}
170 {% url "tag" tag_name=tag.name page=page %}
172 {% url "tag" tag_name=tag.name page=page %}
171 {% else %}
173 {% else %}
172 {% url "index" page=page %}
174 {% url "index" page=page %}
173 {% endif %}
175 {% endif %}
174 ">{{ page }}</a>
176 ">{{ page }}</a>
175 {% if not forloop.last %},{% endif %}
177 {% if not forloop.last %},{% endif %}
176 {% endfor %}
178 {% endfor %}
177 ]
179 ]
178 <a href="
180 <a href="
179 {% if tag %}
181 {% if tag %}
180 {% url "tag" tag_name=tag.name page=paginator.page_range|last %}
182 {% url "tag" tag_name=tag.name page=paginator.page_range|last %}
181 {% else %}
183 {% else %}
182 {% url "index" page=paginator.page_range|last %}
184 {% url "index" page=paginator.page_range|last %}
183 {% endif %}
185 {% endif %}
184 ">&gt;&gt;</a>
186 ">&gt;&gt;</a>
185 [<a href="rss/">RSS</a>]
187 [<a href="rss/">RSS</a>]
186 </span>
188 </span>
187
189
188 {% endblock %}
190 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now