##// 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 </div>
33 </div>
34 {% endif %}
34 {% endif %}
35 <div class="thread">
35 <div class="thread">
36 {% for post in thread.get_replies %}
36 {% for post in posts %}
37 {% if bumpable %}
37 {% if bumpable %}
38 <div class="post" id="{{ post.id }}">
38 <div class="post" id="{{ post.id }}">
39 {% else %}
39 {% else %}
@@ -22,27 +22,25 b''
22 </div>
22 </div>
23
23
24 <div id="posts-table">
24 <div id="posts-table">
25 {% for post in thread.get_replies %}
25 {% for post in posts %}
26 {% if post.image %}
26 <div class="gallery_image">
27 <div class="gallery_image">
27 <div>
28 <div>
28 <a
29 <a
29 class="thumb"
30 class="thumb"
30 href="{{ post.image.url }}"><img
31 href="{{ post.image.url }}"><img
31 src="{{ post.image.url_200x150 }}"
32 src="{{ post.image.url_200x150 }}"
32 alt="{{ post.id }}"
33 alt="{{ post.id }}"
33 width="{{ post.image_pre_width }}"
34 width="{{ post.image_pre_width }}"
34 height="{{ post.image_pre_height }}"
35 height="{{ post.image_pre_height }}"
35 data-width="{{ post.image_width }}"
36 data-width="{{ post.image_width }}"
36 data-height="{{ post.image_height }}"/>
37 data-height="{{ post.image_height }}"/>
37 </a>
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>
44 </div>
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 {% endfor %}
44 {% endfor %}
47 </div>
45 </div>
48 {% endcache %}
46 {% endcache %}
@@ -203,19 +203,24 b' def thread(request, post_id, mode=MODE_N'
203
203
204 posts = thread_to_show.get_replies()
204 posts = thread_to_show.get_replies()
205 context['form'] = form
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 context["last_update"] = _datetime_to_epoch(thread_to_show.last_edit_time)
206 context["last_update"] = _datetime_to_epoch(thread_to_show.last_edit_time)
214 context["thread"] = thread_to_show
207 context["thread"] = thread_to_show
215
208
216 if MODE_NORMAL == mode:
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 document = 'boards/thread.html'
220 document = 'boards/thread.html'
218 elif MODE_GALLERY == mode:
221 elif MODE_GALLERY == mode:
222 context['posts'] = posts.filter(image_width__gt=0)
223
219 document = 'boards/thread_gallery.html'
224 document = 'boards/thread_gallery.html'
220 else:
225 else:
221 raise Http404
226 raise Http404
General Comments 0
You need to be logged in to leave comments. Login now