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