##// END OF EJS Templates
Refactored post_view template tag
neko259 -
r1094:362f1a52 default
parent child Browse files
Show More
@@ -2,13 +2,19 b' import re'
2 from django.shortcuts import get_object_or_404
2 from django.shortcuts import get_object_or_404
3 from django import template
3 from django import template
4
4
5 ELLIPSIZER = '...'
6
7 REGEX_LINES = re.compile(r'(<div class="br"></div>)', re.U | re.S)
8 REGEX_TAG = re.compile(r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>', re.S)
9
5
10 IMG_ACTION_URL = '[<a href="{}">{}</a>]'
6 IMG_ACTION_URL = '[<a href="{}">{}</a>]'
11
7
8 PARAM_POST = 'post'
9 PARAM_MODERATOR = 'moderator'
10 PARAM_OP = 'is_opening'
11 PARAM_THREAD = 'thread'
12 PARAM_CSS_CLASS = 'css_class'
13 PARAM_OPEN_LINK = 'need_open_link'
14 PARAM_TRUNCATED = 'truncated'
15 PARAM_OP_ID = 'opening_post_id'
16 PARAM_REPLY_LINK = 'reply_link'
17
12
18
13 register = template.Library()
19 register = template.Library()
14
20
@@ -65,14 +71,14 b' def post_view(post, moderator=False, nee'
65 css_class += ' dead_post'
71 css_class += ' dead_post'
66
72
67 return {
73 return {
68 'post': post,
74 PARAM_POST: post,
69 'moderator': moderator,
75 PARAM_MODERATOR: moderator,
70 'is_opening': is_opening,
76 PARAM_OP: is_opening,
71 'thread': thread,
77 PARAM_THREAD: thread,
72 'css_class': css_class,
78 PARAM_CSS_CLASS: css_class,
73 'need_open_link': need_open_link,
79 PARAM_OPEN_LINK: need_open_link,
74 'truncated': truncated,
80 PARAM_TRUNCATED: truncated,
75 'opening_post_id': opening_post_id,
81 PARAM_OP_ID: opening_post_id,
76 'reply_link': reply_link,
82 PARAM_REPLY_LINK: reply_link,
77 }
83 }
78
84
General Comments 0
You need to be logged in to leave comments. Login now