##// END OF EJS Templates
Speed up gallery loading a bit. Removed duplicate getting of post list in...
neko259 -
r467:a0c69560 default
parent child Browse files
Show More
@@ -33,7 +33,7 b''
33 33 </div>
34 34 {% endif %}
35 35 <div class="thread">
36 {% for post in thread.get_replies %}
36 {% for post in posts %}
37 37 {% if bumpable %}
38 38 <div class="post" id="{{ post.id }}">
39 39 {% else %}
@@ -22,27 +22,25 b''
22 22 </div>
23 23
24 24 <div id="posts-table">
25 {% for post in thread.get_replies %}
26 {% if post.image %}
27 <div class="gallery_image">
28 <div>
29 <a
30 class="thumb"
31 href="{{ post.image.url }}"><img
32 src="{{ post.image.url_200x150 }}"
33 alt="{{ post.id }}"
34 width="{{ post.image_pre_width }}"
35 height="{{ post.image_pre_height }}"
36 data-width="{{ post.image_width }}"
37 data-height="{{ post.image_height }}"/>
38 </a>
39 </div>
40 <div class="gallery_image_metadata">
41 {{ post.image_width }}x{{ post.image_height }}
42 {% image_actions post.image.url request.get_host %}
43 </div>
25 {% for post in posts %}
26 <div class="gallery_image">
27 <div>
28 <a
29 class="thumb"
30 href="{{ post.image.url }}"><img
31 src="{{ post.image.url_200x150 }}"
32 alt="{{ post.id }}"
33 width="{{ post.image_pre_width }}"
34 height="{{ post.image_pre_height }}"
35 data-width="{{ post.image_width }}"
36 data-height="{{ post.image_height }}"/>
37 </a>
44 38 </div>
45 {% endif %}
39 <div class="gallery_image_metadata">
40 {{ post.image_width }}x{{ post.image_height }}
41 {% image_actions post.image.url request.get_host %}
42 </div>
43 </div>
46 44 {% endfor %}
47 45 </div>
48 46 {% endcache %}
@@ -203,19 +203,24 b' def thread(request, post_id, mode=MODE_N'
203 203
204 204 posts = thread_to_show.get_replies()
205 205 context['form'] = form
206 context['bumpable'] = thread_to_show.can_bump()
207 if context['bumpable']:
208 context['posts_left'] = neboard.settings.MAX_POSTS_PER_THREAD - posts \
209 .count()
210 context['bumplimit_progress'] = str(
211 float(context['posts_left']) /
212 neboard.settings.MAX_POSTS_PER_THREAD * 100)
213 206 context["last_update"] = _datetime_to_epoch(thread_to_show.last_edit_time)
214 207 context["thread"] = thread_to_show
215 208
216 209 if MODE_NORMAL == mode:
210 context['bumpable'] = thread_to_show.can_bump()
211 if context['bumpable']:
212 context['posts_left'] = neboard.settings.MAX_POSTS_PER_THREAD - posts \
213 .count()
214 context['bumplimit_progress'] = str(
215 float(context['posts_left']) /
216 neboard.settings.MAX_POSTS_PER_THREAD * 100)
217
218 context['posts'] = posts
219
217 220 document = 'boards/thread.html'
218 221 elif MODE_GALLERY == mode:
222 context['posts'] = posts.filter(image_width__gt=0)
223
219 224 document = 'boards/thread_gallery.html'
220 225 else:
221 226 raise Http404
General Comments 0
You need to be logged in to leave comments. Login now