##// END OF EJS Templates
Added debug suffix to the site name when DEBUG is set to true. Optimized post...
neko259 -
r583:cf14ad32 default
parent child Browse files
Show More
@@ -4,11 +4,8 b''
4
4
5 {% get_current_language as LANGUAGE_CODE %}
5 {% get_current_language as LANGUAGE_CODE %}
6
6
7 {% with thread=post.thread_new %}
8 {% with bumpable=thread.can_bump %}
9 {% cache 600 post post.id post.last_edit_time thread.archived bumpable truncated moderator LANGUAGE_CODE need_open_link %}
7 {% cache 600 post post.id post.last_edit_time thread.archived bumpable truncated moderator LANGUAGE_CODE need_open_link %}
10
8
11 {% with is_opening=post.is_opening %}
12 {% spaceless %}
9 {% spaceless %}
13 {% if thread.archived %}
10 {% if thread.archived %}
14 <div class="post archive_post" id="{{ post.id }}">
11 <div class="post archive_post" id="{{ post.id }}">
@@ -97,7 +94,4 b''
97 {% endif %}
94 {% endif %}
98 </div>
95 </div>
99 {% endspaceless %}
96 {% endspaceless %}
100 {% endwith %}
101 {% endcache %}
97 {% endcache %}
102 {% endwith %}
103 {% endwith %}
@@ -74,23 +74,25 b''
74 {% for thread in threads %}
74 {% for thread in threads %}
75 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
75 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
76 <div class="thread">
76 <div class="thread">
77 {% post_view_truncated thread.get_opening_post True moderator %}
77 {% with can_bump=thread.can_bump %}
78 {% if not thread.archived %}
78 {% post_view_truncated thread.get_opening_post True moderator is_opening=True thread=thread can_bump=can_bump %}
79 {% if thread.get_last_replies.exists %}
79 {% if not thread.archived %}
80 {% if thread.get_skipped_replies_count %}
80 {% if thread.get_last_replies.exists %}
81 <div class="skipped_replies">
81 {% if thread.get_skipped_replies_count %}
82 <a href="{% url 'thread' thread.get_opening_post.id %}">
82 <div class="skipped_replies">
83 {% blocktrans with count=thread.get_skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
83 <a href="{% url 'thread' thread.get_opening_post.id %}">
84 </a>
84 {% blocktrans with count=thread.get_skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
85 </a>
86 </div>
87 {% endif %}
88 <div class="last-replies">
89 {% for post in thread.get_last_replies %}
90 {% post_view_truncated post moderator=moderator is_opening=False thread=thread can_bump=can_bump %}
91 {% endfor %}
85 </div>
92 </div>
86 {% endif %}
93 {% endif %}
87 <div class="last-replies">
94 {% endif %}
88 {% for post in thread.get_last_replies %}
95 {% endwith %}
89 {% post_view_truncated post moderator=moderator%}
90 {% endfor %}
91 </div>
92 {% endif %}
93 {% endif %}
94 </div>
96 </div>
95 {% endcache %}
97 {% endcache %}
96 {% endfor %}
98 {% endfor %}
@@ -32,9 +32,15 b''
32 {% endif %}
32 {% endif %}
33
33
34 <div class="thread">
34 <div class="thread">
35 {% with can_bump=thread.can_bump %}
35 {% for post in thread.get_replies %}
36 {% for post in thread.get_replies %}
36 {% post_view post moderator=moderator %}
37 {% if forloop.first %}
38 {% post_view post moderator=moderator is_opening=True thread=thread can_bump=can_bump %}
39 {% else %}
40 {% post_view post moderator=moderator is_opening=False thread=thread can_bump=can_bump %}
41 {% endif %}
37 {% endfor %}
42 {% endfor %}
43 {% endwith %}
38 </div>
44 </div>
39
45
40 {% if not thread.archived %}
46 {% if not thread.archived %}
@@ -50,27 +50,63 b' def image_actions(*args, **kwargs):'
50
50
51
51
52 @register.inclusion_tag('boards/post.html', name='post_view')
52 @register.inclusion_tag('boards/post.html', name='post_view')
53 def post_view(post, moderator=False):
53 def post_view(post, moderator=False, **kwargs):
54 """
54 """
55 Get post
55 Get post
56 """
56 """
57
57
58 if 'is_opening' in kwargs:
59 is_opening = kwargs['is_opening']
60 else:
61 is_opening = post.is_opening()
62
63 if 'thread' in kwargs:
64 thread = kwargs['thread']
65 else:
66 thread = post.thread_new
67
68 if 'can_bump' in kwargs:
69 can_bump = kwargs['can_bump']
70 else:
71 can_bump = thread.can_bump()
72
58 return {
73 return {
59 'post': post,
74 'post': post,
60 'moderator': moderator,
75 'moderator': moderator,
76 'is_opening': is_opening,
77 'thread': thread,
78 'bumpable': can_bump,
61 }
79 }
62
80
63
81
64 @register.inclusion_tag('boards/post.html', name='post_view_truncated')
82 @register.inclusion_tag('boards/post.html', name='post_view_truncated')
65 def post_view_truncated(post, need_open_link=False, moderator=False):
83 def post_view_truncated(post, need_open_link=False, moderator=False, **kwargs):
66 """
84 """
67 Get post with truncated text. If the 'open' or 'reply' link is needed, pass
85 Get post with truncated text. If the 'open' or 'reply' link is needed, pass
68 the second parameter as True.
86 the second parameter as True.
69 """
87 """
70
88
89 if 'is_opening' in kwargs:
90 is_opening = kwargs['is_opening']
91 else:
92 is_opening = post.is_opening()
93
94 if 'thread' in kwargs:
95 thread = kwargs['thread']
96 else:
97 thread = post.thread_new
98
99 if 'can_bump' in kwargs:
100 can_bump = kwargs['can_bump']
101 else:
102 can_bump = thread.can_bump()
103
71 return {
104 return {
72 'post': post,
105 'post': post,
73 'truncated': True,
106 'truncated': True,
74 'need_open_link': need_open_link,
107 'need_open_link': need_open_link,
75 'moderator': moderator,
108 'moderator': moderator,
109 'is_opening': is_opening,
110 'thread': thread,
111 'bumpable': can_bump,
76 }
112 }
@@ -227,6 +227,9 b" VERSION = '1.7 Anubis'"
227
227
228 # Debug mode middlewares
228 # Debug mode middlewares
229 if DEBUG:
229 if DEBUG:
230
231 SITE_NAME += '_debug'
232
230 MIDDLEWARE_CLASSES += (
233 MIDDLEWARE_CLASSES += (
231 'boards.profiler.ProfilerMiddleware',
234 'boards.profiler.ProfilerMiddleware',
232 'debug_toolbar.middleware.DebugToolbarMiddleware',
235 'debug_toolbar.middleware.DebugToolbarMiddleware',
General Comments 0
You need to be logged in to leave comments. Login now