Show More
@@ -1,7 +1,3 b'' | |||||
1 | {% load board %} |
|
1 | {% load board %} | |
2 |
|
2 | |||
3 | {% if truncated %} |
|
3 | {% post_view post truncated=truncated %} No newline at end of file | |
4 | {% post_view_truncated post %} |
|
|||
5 | {% else %} |
|
|||
6 | {% post_view post %} |
|
|||
7 | {% endif %} |
|
@@ -75,7 +75,7 b'' | |||||
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 | {% with can_bump=thread.can_bump %} |
|
77 | {% with can_bump=thread.can_bump %} | |
78 |
{% post_view |
|
78 | {% post_view thread.get_opening_post moderator is_opening=True thread=thread can_bump=can_bump truncated=True need_open_link=True %} | |
79 | {% if not thread.archived %} |
|
79 | {% if not thread.archived %} | |
80 | {% if thread.get_last_replies.exists %} |
|
80 | {% if thread.get_last_replies.exists %} | |
81 | {% if thread.get_skipped_replies_count %} |
|
81 | {% if thread.get_skipped_replies_count %} | |
@@ -87,7 +87,7 b'' | |||||
87 | {% endif %} |
|
87 | {% endif %} | |
88 | <div class="last-replies"> |
|
88 | <div class="last-replies"> | |
89 | {% for post in thread.get_last_replies %} |
|
89 | {% for post in thread.get_last_replies %} | |
90 |
{% post_view |
|
90 | {% post_view post moderator=moderator is_opening=False thread=thread can_bump=can_bump truncated=True %} | |
91 | {% endfor %} |
|
91 | {% endfor %} | |
92 | </div> |
|
92 | </div> | |
93 | {% endif %} |
|
93 | {% endif %} |
@@ -42,7 +42,8 b' def image_actions(*args, **kwargs):' | |||||
42 |
|
42 | |||
43 |
|
43 | |||
44 | @register.inclusion_tag('boards/post.html', name='post_view') |
|
44 | @register.inclusion_tag('boards/post.html', name='post_view') | |
45 |
def post_view(post, moderator=False, |
|
45 | def post_view(post, moderator=False, need_open_link=False, truncated=False, | |
|
46 | **kwargs): | |||
46 | """ |
|
47 | """ | |
47 | Get post |
|
48 | Get post | |
48 | """ |
|
49 | """ | |
@@ -57,37 +58,6 b' def post_view(post, moderator=False, **k' | |||||
57 | else: |
|
58 | else: | |
58 | thread = post.thread_new |
|
59 | thread = post.thread_new | |
59 |
|
60 | |||
60 | # if 'can_bump' in kwargs: |
|
|||
61 | # can_bump = kwargs['can_bump'] |
|
|||
62 | # else: |
|
|||
63 | can_bump = thread.can_bump() |
|
|||
64 |
|
||||
65 | return { |
|
|||
66 | 'post': post, |
|
|||
67 | 'moderator': moderator, |
|
|||
68 | 'is_opening': is_opening, |
|
|||
69 | 'thread': thread, |
|
|||
70 | 'bumpable': can_bump, |
|
|||
71 | } |
|
|||
72 |
|
||||
73 |
|
||||
74 | @register.inclusion_tag('boards/post.html', name='post_view_truncated') |
|
|||
75 | def post_view_truncated(post, need_open_link=False, moderator=False, **kwargs): |
|
|||
76 | """ |
|
|||
77 | Get post with truncated text. If the 'open' or 'reply' link is needed, pass |
|
|||
78 | the second parameter as True. |
|
|||
79 | """ |
|
|||
80 |
|
||||
81 | if 'is_opening' in kwargs: |
|
|||
82 | is_opening = kwargs['is_opening'] |
|
|||
83 | else: |
|
|||
84 | is_opening = post.is_opening() |
|
|||
85 |
|
||||
86 | if 'thread' in kwargs: |
|
|||
87 | thread = kwargs['thread'] |
|
|||
88 | else: |
|
|||
89 | thread = post.thread_new |
|
|||
90 |
|
||||
91 | if 'can_bump' in kwargs: |
|
61 | if 'can_bump' in kwargs: | |
92 | can_bump = kwargs['can_bump'] |
|
62 | can_bump = kwargs['can_bump'] | |
93 | else: |
|
63 | else: | |
@@ -95,10 +65,10 b' def post_view_truncated(post, need_open_' | |||||
95 |
|
65 | |||
96 | return { |
|
66 | return { | |
97 | 'post': post, |
|
67 | 'post': post, | |
98 | 'truncated': True, |
|
|||
99 | 'need_open_link': need_open_link, |
|
|||
100 | 'moderator': moderator, |
|
68 | 'moderator': moderator, | |
101 | 'is_opening': is_opening, |
|
69 | 'is_opening': is_opening, | |
102 | 'thread': thread, |
|
70 | 'thread': thread, | |
103 | 'bumpable': can_bump, |
|
71 | 'bumpable': can_bump, | |
104 | } |
|
72 | 'need_open_link': need_open_link, | |
|
73 | 'truncated': truncated, | |||
|
74 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now