# HG changeset patch # User neko259 # Date 2014-01-24 19:36:59 # Node ID 1f06cbcc1d6b55b51e1c43c3f06733b38f65cbf5 # Parent 0e05549aa78c6bc9c98c22111bccffd92bf2cb02 Removed truncated post view, using an argument for this mode. Fixed bumpable argument in thread diff --git a/boards/templates/boards/api_post.html b/boards/templates/boards/api_post.html --- a/boards/templates/boards/api_post.html +++ b/boards/templates/boards/api_post.html @@ -1,7 +1,3 @@ {% load board %} -{% if truncated %} - {% post_view_truncated post %} -{% else %} - {% post_view post %} -{% endif %} +{% post_view post truncated=truncated %} \ No newline at end of file diff --git a/boards/templates/boards/posting_general.html b/boards/templates/boards/posting_general.html --- a/boards/templates/boards/posting_general.html +++ b/boards/templates/boards/posting_general.html @@ -75,7 +75,7 @@ {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
{% with can_bump=thread.can_bump %} - {% post_view_truncated thread.get_opening_post True moderator is_opening=True thread=thread can_bump=can_bump %} + {% post_view thread.get_opening_post moderator is_opening=True thread=thread can_bump=can_bump truncated=True need_open_link=True %} {% if not thread.archived %} {% if thread.get_last_replies.exists %} {% if thread.get_skipped_replies_count %} @@ -87,7 +87,7 @@ {% endif %}
{% for post in thread.get_last_replies %} - {% post_view_truncated post moderator=moderator is_opening=False thread=thread can_bump=can_bump %} + {% post_view post moderator=moderator is_opening=False thread=thread can_bump=can_bump truncated=True %} {% endfor %}
{% endif %} diff --git a/boards/templatetags/board.py b/boards/templatetags/board.py --- a/boards/templatetags/board.py +++ b/boards/templatetags/board.py @@ -42,7 +42,8 @@ def image_actions(*args, **kwargs): @register.inclusion_tag('boards/post.html', name='post_view') -def post_view(post, moderator=False, **kwargs): +def post_view(post, moderator=False, need_open_link=False, truncated=False, + **kwargs): """ Get post """ @@ -57,37 +58,6 @@ def post_view(post, moderator=False, **k else: thread = post.thread_new -# if 'can_bump' in kwargs: -# can_bump = kwargs['can_bump'] -# else: - can_bump = thread.can_bump() - - return { - 'post': post, - 'moderator': moderator, - 'is_opening': is_opening, - 'thread': thread, - 'bumpable': can_bump, - } - - -@register.inclusion_tag('boards/post.html', name='post_view_truncated') -def post_view_truncated(post, need_open_link=False, moderator=False, **kwargs): - """ - Get post with truncated text. If the 'open' or 'reply' link is needed, pass - the second parameter as True. - """ - - if 'is_opening' in kwargs: - is_opening = kwargs['is_opening'] - else: - is_opening = post.is_opening() - - if 'thread' in kwargs: - thread = kwargs['thread'] - else: - thread = post.thread_new - if 'can_bump' in kwargs: can_bump = kwargs['can_bump'] else: @@ -95,10 +65,10 @@ def post_view_truncated(post, need_open_ return { 'post': post, - 'truncated': True, - 'need_open_link': need_open_link, 'moderator': moderator, 'is_opening': is_opening, 'thread': thread, 'bumpable': can_bump, - } + 'need_open_link': need_open_link, + 'truncated': truncated, + } \ No newline at end of file