diff --git a/tildes/scss/modules/_comment.scss b/tildes/scss/modules/_comment.scss index cd20c2a..387e542 100644 --- a/tildes/scss/modules/_comment.scss +++ b/tildes/scss/modules/_comment.scss @@ -78,12 +78,12 @@ margin-left: 0.4rem; } -.comment-replies { +.top-level-comment, .comment-replies { margin-left: 0.4rem; padding-top: 0.4rem; list-style: none; - .comment-reply { + li { margin: 0; padding: 0; max-width: none; diff --git a/tildes/static/js/behaviors/comment-reply-button.js b/tildes/static/js/behaviors/comment-reply-button.js index cd9d7d1..260662c 100644 --- a/tildes/static/js/behaviors/comment-reply-button.js +++ b/tildes/static/js/behaviors/comment-reply-button.js @@ -10,7 +10,7 @@ $.onmount('[data-js-comment-reply-button]', function() { var $comment = $(this).parents('.comment').first(); - // get the replies div, or create one if it doesn't already exist + // get the replies list, or create one if it doesn't already exist var $replies = $comment.children('.comment-replies'); if (!$replies.length) { var repliesDiv = document.createElement('ol'); diff --git a/tildes/tildes/templates/intercooler/single_comment.jinja2 b/tildes/tildes/templates/intercooler/single_comment.jinja2 index 675f00f..becc3c1 100644 --- a/tildes/tildes/templates/intercooler/single_comment.jinja2 +++ b/tildes/tildes/templates/intercooler/single_comment.jinja2 @@ -3,5 +3,4 @@ {% from 'macros/comments.jinja2' import render_single_comment with context %} -{% set is_top_level = True if topic is defined else False %} -{{ render_single_comment(comment, is_top_level) }} +{{ render_single_comment(comment) }} diff --git a/tildes/tildes/templates/macros/comments.jinja2 b/tildes/tildes/templates/macros/comments.jinja2 index bdcd244..b718619 100644 --- a/tildes/tildes/templates/macros/comments.jinja2 +++ b/tildes/tildes/templates/macros/comments.jinja2 @@ -4,48 +4,37 @@ {% from 'datetime.jinja2' import time_ago_responsive %} {% from 'links.jinja2' import username_linked %} -{% macro render_single_comment(comment, is_new_topic=False) %} - {{ render_comment_tree([comment], is_individual_comment=True, is_new_topic=is_new_topic) }} +{% macro render_single_comment(comment) %} + {{ render_comment_tree([comment], is_individual_comment=True) }} {% endmacro %} -{% macro render_comment_tree(comments, mark_newer_than=None, is_individual_comment=False, is_new_topic=False) %} +{% macro render_comment_tree(comments, mark_newer_than=None, is_individual_comment=False) %} {% if comments is defined and comments|length > 0 %} - {# if this is a list of comments wrap in an ordered list #} - {% if is_new_topic or not is_individual_comment %} -
    - {{ render_comments(comments, mark_newer_than, is_individual_comment) }} -
- {% else %} - {{ render_comments(comments, mark_newer_than, is_individual_comment) }} - {% endif %} - {% endif %} -{% endmacro %} - -{% macro render_comments(comments, mark_newer_than=None, is_individual_comment=False) %} - {% for comment in comments recursive %} -
  • - {{ render_comment_contents(comment, is_individual_comment) }} + {% if request.has_permission("label", comment) %} + data-comment-user-labels="{{ comment.labels_by_user(request.user)|join(' ') }}" + {% endif %} + > + {{ render_comment_contents(comment, is_individual_comment) }} - {% if comment.replies is defined and comment.replies %} -
      - {# Recursively display reply comments #} - {{ loop(comment.replies) }} -
    - {% endif %} -
  • - {% endfor %} + {% if comment.replies is defined and comment.replies %} +
      + {# Recursively display reply comments #} + {{ loop(comment.replies) }} +
    + {% endif %} + + {% endfor %} + {% endif %} {% endmacro %} {% macro render_comment_contents(comment, is_individual_comment=False) %} diff --git a/tildes/tildes/templates/topic.jinja2 b/tildes/tildes/templates/topic.jinja2 index 6deacd9..4431d23 100644 --- a/tildes/tildes/templates/topic.jinja2 +++ b/tildes/tildes/templates/topic.jinja2 @@ -173,8 +173,8 @@
    This topic is locked. New comments can not be posted.
    {% endif %} -{% if comments %} -
    +
    + {% if comments %}

    {% trans num_comments=topic.num_comments %} @@ -208,18 +208,22 @@

    - {{ render_comment_tree(comments, mark_newer_than=topic.last_visit_time) }} -
    -{% endif %} +
      + {{ render_comment_tree(comments, mark_newer_than=topic.last_visit_time) }} +
    + {% else %} +
      + {% endif %} +
      {% if request.has_permission('comment', topic) %} -
      +

      Post a comment