Fix some bugs for new comment

This commit is contained in:
cuom1999 2023-05-22 23:11:40 +07:00
parent b5816bbcd6
commit 57ded6ff5e
8 changed files with 267 additions and 403 deletions

View file

@ -28,6 +28,9 @@ from judge.widgets import HeavyPreviewPageDownWidget
from judge.jinja2.reference import get_user_from_text from judge.jinja2.reference import get_user_from_text
DEFAULT_OFFSET = 10
def add_mention_notifications(comment): def add_mention_notifications(comment):
user_referred = get_user_from_text(comment.body).exclude(id=comment.author.id) user_referred = get_user_from_text(comment.body).exclude(id=comment.author.id)
for user in user_referred: for user in user_referred:
@ -152,44 +155,37 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
return self.render_to_response(context) return self.render_to_response(context)
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
pre_query = None target_comment = None
if "comment-id" in request.GET: if "comment-id" in request.GET:
comment_id = int(request.GET["comment-id"]) comment_id = int(request.GET["comment-id"])
try: try:
comment_obj = Comment.objects.get(pk=comment_id) comment_obj = Comment.objects.get(id=comment_id)
except Comment.DoesNotExist: except Comment.DoesNotExist:
raise Http404 raise Http404
pre_query = comment_obj target_comment = comment_obj.get_root()
while comment_obj is not None:
pre_query = comment_obj
comment_obj = comment_obj.parent
self.object = self.get_object() self.object = self.get_object()
return self.render_to_response( return self.render_to_response(
self.get_context_data( self.get_context_data(
object=self.object, object=self.object,
pre_query=pre_query, target_comment=target_comment,
comment_form=CommentForm(request, initial={"parent": None}), comment_form=CommentForm(request, initial={"parent": None}),
) )
) )
def get_context_data(self, pre_query=None, **kwargs): def _get_queryset(self, target_comment):
context = super(CommentedDetailView, self).get_context_data(**kwargs) if target_comment != None:
queryset = self.object.comments queryset = target_comment.get_descendants(include_self=True)
queryset = queryset.filter(parent=None, hidden=False) queryset = (
queryset_all = None queryset.select_related("author__user")
comment_count = len(queryset)
context["comment_remove"] = -1
if (pre_query != None):
comment_remove = pre_query.id
queryset_all = pre_query.get_descendants(include_self=True)
queryset_all = (
queryset_all.select_related("author__user")
.filter(hidden=False) .filter(hidden=False)
.defer("author__about") .defer("author__about")
.annotate(revisions=Count("versions", distinct=True)) .annotate(
revisions=Count("versions", distinct=True)
)
) )
context["comment_remove"] = comment_remove
else: else:
queryset = self.object.comments
queryset = queryset.filter(parent=None, hidden=False)
queryset = ( queryset = (
queryset.select_related("author__user") queryset.select_related("author__user")
.defer("author__about") .defer("author__about")
@ -197,24 +193,28 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
.annotate( .annotate(
count_replies=Count("replies", distinct=True), count_replies=Count("replies", distinct=True),
revisions=Count("versions", distinct=True), revisions=Count("versions", distinct=True),
)[:10] )[:DEFAULT_OFFSET]
) )
if self.request.user.is_authenticated: if self.request.user.is_authenticated:
profile = self.request.profile profile = self.request.profile
if (pre_query != None): queryset = queryset.annotate(
queryset_all = queryset_all.annotate( my_vote=FilteredRelation(
my_vote=FilteredRelation( "votes", condition=Q(votes__voter_id=profile.id)
"votes", condition=Q(votes__voter_id=profile.id) ),
), ).annotate(vote_score=Coalesce(F("my_vote__score"), Value(0)))
).annotate(vote_score=Coalesce(F("my_vote__score"), Value(0)))
else:
queryset = queryset.annotate(
my_vote=FilteredRelation(
"votes", condition=Q(votes__voter_id=profile.id)
),
).annotate(vote_score=Coalesce(F("my_vote__score"), Value(0)))
return queryset
def get_context_data(self, target_comment=None, **kwargs):
context = super(CommentedDetailView, self).get_context_data(**kwargs)
queryset = self._get_queryset(target_comment)
comment_count = self.object.comments.filter(parent=None, hidden=False).count()
context["target_comment"] = -1
if (target_comment != None):
context["target_comment"] = target_comment.id
if self.request.user.is_authenticated:
context["is_new_user"] = ( context["is_new_user"] = (
not self.request.user.is_staff not self.request.user.is_staff
and not profile.submission_set.filter( and not profile.submission_set.filter(
@ -225,19 +225,20 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
context["has_comments"] = queryset.exists() context["has_comments"] = queryset.exists()
context["comment_lock"] = self.is_comment_locked() context["comment_lock"] = self.is_comment_locked()
context["comment_list"] = queryset context["comment_list"] = queryset
context["comment_all_list"] = queryset_all
context["vote_hide_threshold"] = settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD context["vote_hide_threshold"] = settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD
if queryset.exists(): if queryset.exists():
context["comment_root_id"] = queryset[0].id context["comment_root_id"] = queryset[0].id
else: else:
context["comment_root_id"] = 0 context["comment_root_id"] = 0
context["comment_parrent_none"] = 1 context["comment_parent_none"] = 1
if (pre_query != None): if target_comment != None:
context["offset"] = 1 context["offset"] = 0
context["comment_more"] = comment_count - 1
else: else:
context["offset"] = 10 context["offset"] = DEFAULT_OFFSET
context["comment_more"] = comment_count - DEFAULT_OFFSET
context["limit"] = 10 context["limit"] = DEFAULT_OFFSET
context["comment_count"] = comment_count context["comment_count"] = comment_count
return context return context

View file

@ -110,46 +110,52 @@ def vote_comment(request, delta):
def upvote_comment(request): def upvote_comment(request):
return vote_comment(request, 1) return vote_comment(request, 1)
def downvote_comment(request): def downvote_comment(request):
return vote_comment(request, -1) return vote_comment(request, -1)
def get_comments(request, limit=10): def get_comments(request, limit=10):
try: try:
comment_id = int(request.GET["id"]) comment_id = int(request.GET["id"])
parrent_none = int(request.GET["parrent_none"]) parent_none = int(request.GET["parent_none"])
except ValueError: except ValueError:
return HttpResponseBadRequest() return HttpResponseBadRequest()
else: else:
if comment_id and not Comment.objects.filter(id=comment_id).exists(): if comment_id and not Comment.objects.filter(id=comment_id).exists():
raise Http404() raise Http404()
offset = 0 offset = 0
if "offset" in request.GET: if "offset" in request.GET:
offset = int(request.GET["offset"]) offset = int(request.GET["offset"])
comment_remove = -1
if "comment_remove" in request.GET: target_comment = -1
comment_remove = int(request.GET["comment_remove"]) if "target_comment" in request.GET:
target_comment = int(request.GET["target_comment"])
comment_root_id = 0 comment_root_id = 0
if (comment_id):
if comment_id:
comment_obj = Comment.objects.get(pk=comment_id) comment_obj = Comment.objects.get(pk=comment_id)
comment_root_id = comment_obj.id comment_root_id = comment_obj.id
else: else:
comment_obj = None comment_obj = None
queryset = comment_obj.linked_object.comments queryset = comment_obj.linked_object.comments
if parrent_none: if parent_none:
queryset = queryset.filter(parent=None, hidden=False) queryset = queryset.filter(parent=None, hidden=False)
if (comment_remove != -1): queryset = queryset.exclude(pk=target_comment)
queryset.get(pk=comment_remove).delete()
else: else:
queryset = queryset.filter(parent=comment_obj, hidden=False) queryset = queryset.filter(parent=comment_obj, hidden=False)
comment_count = len(queryset) comment_count = len(queryset)
queryset = ( queryset = (
queryset.select_related("author__user") queryset.select_related("author__user")
.defer("author__about") .defer("author__about")
.annotate( .annotate(
count_replies=Count("replies", distinct=True), count_replies=Count("replies", distinct=True),
revisions=Count("versions", distinct=True), revisions=Count("versions", distinct=True),
)[offset:offset+limit] )[offset:offset+limit]
) )
if request.user.is_authenticated: if request.user.is_authenticated:
profile = request.profile profile = request.profile
queryset = queryset.annotate( queryset = queryset.annotate(
@ -158,6 +164,8 @@ def get_comments(request, limit=10):
), ),
).annotate(vote_score=Coalesce(F("my_vote__score"), Value(0))) ).annotate(vote_score=Coalesce(F("my_vote__score"), Value(0)))
new_offset = offset + min(len(queryset), limit)
comment_html = loader.render_to_string( comment_html = loader.render_to_string(
"comments/content-list.html", "comments/content-list.html",
{ {
@ -166,22 +174,26 @@ def get_comments(request, limit=10):
"comment_list": queryset, "comment_list": queryset,
"vote_hide_threshold" : settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD, "vote_hide_threshold" : settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD,
"perms": PermWrapper(request.user), "perms": PermWrapper(request.user),
"offset": offset + min(len(queryset), limit), "offset": new_offset,
"limit": limit, "limit": limit,
"comment_count": comment_count, "comment_count": comment_count,
"comment_parrent_none": parrent_none, "comment_parent_none": parent_none,
"comment_remove": comment_remove, "target_comment": target_comment,
"comment_more": comment_count - new_offset
} }
) )
return HttpResponse(comment_html) return HttpResponse(comment_html)
def get_show_more(request): def get_show_more(request):
return get_comments(request) return get_comments(request)
def get_replies(request): def get_replies(request):
return get_comments(request) return get_comments(request)
class CommentMixin(object): class CommentMixin(object):
model = Comment model = Comment
pk_url_kwarg = "id" pk_url_kwarg = "id"

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: lqdoj2\n" "Project-Id-Version: lqdoj2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-16 16:17+0700\n" "POT-Creation-Date: 2023-05-22 23:06+0700\n"
"PO-Revision-Date: 2021-07-20 03:44\n" "PO-Revision-Date: 2021-07-20 03:44\n"
"Last-Translator: Icyene\n" "Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n" "Language-Team: Vietnamese\n"
@ -41,19 +41,19 @@ msgstr "xem lần cuối"
msgid "LQDOJ Chat" msgid "LQDOJ Chat"
msgstr "" msgstr ""
#: dmoj/settings.py:365 #: dmoj/settings.py:363
msgid "Vietnamese" msgid "Vietnamese"
msgstr "Tiếng Việt" msgstr "Tiếng Việt"
#: dmoj/settings.py:366 #: dmoj/settings.py:364
msgid "English" msgid "English"
msgstr "" msgstr ""
#: dmoj/urls.py:136 #: dmoj/urls.py:135
msgid "Login" msgid "Login"
msgstr "Đăng nhập" msgstr "Đăng nhập"
#: dmoj/urls.py:214 templates/base.html:209 #: dmoj/urls.py:212 templates/base.html:209
#: templates/organization/org-left-sidebar.html:2 #: templates/organization/org-left-sidebar.html:2
msgid "Home" msgid "Home"
msgstr "Trang chủ" msgstr "Trang chủ"
@ -426,20 +426,20 @@ msgstr "Dạng"
msgid "Online Judge" msgid "Online Judge"
msgstr "" msgstr ""
#: judge/comments.py:61 #: judge/comments.py:64
msgid "Comment body" msgid "Comment body"
msgstr "Nội dung bình luận" msgstr "Nội dung bình luận"
#: judge/comments.py:67 judge/views/ticket.py:78 #: judge/comments.py:70 judge/views/ticket.py:78
msgid "Your part is silent, little toad." msgid "Your part is silent, little toad."
msgstr "Bạn không được phép bình luận." msgstr "Bạn không được phép bình luận."
#: judge/comments.py:76 templates/comments/list.html:17 #: judge/comments.py:79 templates/comments/list.html:17
msgid "" msgid ""
"You need to have solved at least one problem before your voice can be heard." "You need to have solved at least one problem before your voice can be heard."
msgstr "Bạn phải giải ít nhất một bài trước khi được phép bình luận." msgstr "Bạn phải giải ít nhất một bài trước khi được phép bình luận."
#: judge/comments.py:125 #: judge/comments.py:128
msgid "Posted comment" msgid "Posted comment"
msgstr "Bình luận đã đăng" msgstr "Bình luận đã đăng"
@ -533,7 +533,7 @@ msgid "N j, Y, g:i a"
msgstr "g:i a j b, Y" msgstr "g:i a j b, Y"
#: judge/jinja2/datetime.py:26 templates/chat/message.html:13 #: judge/jinja2/datetime.py:26 templates/chat/message.html:13
#: templates/comments/content-list.html:35 templates/comments/list.html:77 #: templates/comments/content-list.html:36
#, python-brace-format #, python-brace-format
msgid "{time}" msgid "{time}"
msgstr "{time}" msgstr "{time}"
@ -2514,11 +2514,11 @@ msgstr "Tính lại điểm kỳ thi"
msgid "Running MOSS" msgid "Running MOSS"
msgstr "Đang chạy MOSS" msgstr "Đang chạy MOSS"
#: judge/tasks/submission.py:47 #: judge/tasks/submission.py:49
msgid "Modifying submissions" msgid "Modifying submissions"
msgstr "Chỉnh sửa bài nộp" msgstr "Chỉnh sửa bài nộp"
#: judge/tasks/submission.py:67 #: judge/tasks/submission.py:69
msgid "Recalculating user points" msgid "Recalculating user points"
msgstr "Tính lại điểm người dùng" msgstr "Tính lại điểm người dùng"
@ -2658,12 +2658,12 @@ msgstr "Bạn phải giải ít nhất 1 bài trước khi được vote."
msgid "You already voted." msgid "You already voted."
msgstr "Bạn đã vote." msgstr "Bạn đã vote."
#: judge/views/comment.py:243 judge/views/organization.py:817 #: judge/views/comment.py:255 judge/views/organization.py:817
#: judge/views/organization.py:963 judge/views/organization.py:1128 #: judge/views/organization.py:963 judge/views/organization.py:1128
msgid "Edited from site" msgid "Edited from site"
msgstr "Chỉnh sửa từ web" msgstr "Chỉnh sửa từ web"
#: judge/views/comment.py:264 #: judge/views/comment.py:276
msgid "Editing comment" msgid "Editing comment"
msgstr "Chỉnh sửa bình luận" msgstr "Chỉnh sửa bình luận"
@ -3288,8 +3288,8 @@ msgstr "Phải qua một kỳ thi"
#: judge/views/submission.py:903 #: judge/views/submission.py:903
#, python-brace-format #, python-brace-format
msgid "" msgid ""
"<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a " "<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a href="
"href=\"{5}\">{4}</a>" "\"{5}\">{4}</a>"
msgstr "" msgstr ""
"Các bài nộp của <a href=\"{1}\">{0}</a> cho <a href=\"{3}\">{2}</a> trong <a " "Các bài nộp của <a href=\"{1}\">{0}</a> cho <a href=\"{3}\">{2}</a> trong <a "
"href=\"{5}\">{4}</a>" "href=\"{5}\">{4}</a>"
@ -3502,7 +3502,7 @@ msgid "Profile"
msgstr "Trang cá nhân" msgstr "Trang cá nhân"
#: templates/base.html:276 templates/chat/chat.html:21 #: templates/base.html:276 templates/chat/chat.html:21
#: templates/comments/content-list.html:80 templates/comments/list.html:126 #: templates/comments/content-list.html:81
#: templates/contest/contest-list-tabs.html:4 #: templates/contest/contest-list-tabs.html:4
#: templates/contest/ranking-table.html:47 templates/internal/problem.html:57 #: templates/contest/ranking-table.html:47 templates/internal/problem.html:57
#: templates/organization/org-left-sidebar.html:12 #: templates/organization/org-left-sidebar.html:12
@ -3559,12 +3559,12 @@ msgstr ""
msgid " posted on %(time)s" msgid " posted on %(time)s"
msgstr "đã đăng vào %(time)s" msgstr "đã đăng vào %(time)s"
#: templates/blog/blog.html:31 templates/comments/content-list.html:61 #: templates/blog/blog.html:31 templates/comments/content-list.html:62
#: templates/comments/content-list.html:75 templates/comments/list.html:105 #: templates/comments/content-list.html:76
#: templates/comments/list.html:120 templates/contest/contest-tabs.html:35 #: templates/contest/contest-tabs.html:35 templates/contest/list.html:124
#: templates/contest/list.html:124 templates/contest/tag-title.html:9 #: templates/contest/tag-title.html:9 templates/flatpages/admin_link.html:3
#: templates/flatpages/admin_link.html:3 templates/license.html:10 #: templates/license.html:10 templates/problem/editorial.html:15
#: templates/problem/editorial.html:15 templates/problem/feed/problems.html:50 #: templates/problem/feed/problems.html:50
msgid "Edit" msgid "Edit"
msgstr "Chỉnh sửa" msgstr "Chỉnh sửa"
@ -3699,66 +3699,54 @@ msgstr "Tắt thông báo"
msgid "users are online" msgid "users are online"
msgstr "người đang trực tuyến" msgstr "người đang trực tuyến"
#: templates/comments/content-list.html:13
#: templates/comments/content-list.html:14 #: templates/comments/content-list.html:14
#: templates/comments/content-list.html:22 #: templates/comments/content-list.html:15
#: templates/comments/content-list.html:23 templates/comments/list.html:55 #: templates/comments/content-list.html:23
#: templates/comments/list.html:64 #: templates/comments/content-list.html:24
msgid "Please login to vote" msgid "Please login to vote"
msgstr "Đăng nhập để vote" msgstr "Đăng nhập để vote"
#: templates/comments/content-list.html:43 templates/comments/list.html:86 #: templates/comments/content-list.html:44
#, python-format #, python-format
msgid "edit %(edits)s" msgid "edit %(edits)s"
msgstr "chỉnh sửa %(edits)s" msgstr "chỉnh sửa %(edits)s"
#: templates/comments/content-list.html:45 templates/comments/list.html:88 #: templates/comments/content-list.html:46 templates/comments/media-js.html:96
#: templates/comments/media-js.html:96
msgid "edited" msgid "edited"
msgstr "đã chỉnh sửa" msgstr "đã chỉnh sửa"
#: templates/comments/content-list.html:54 templates/comments/list.html:97 #: templates/comments/content-list.html:55 templates/notification/list.html:14
#: templates/notification/list.html:14
msgid "Link" msgid "Link"
msgstr "Link" msgstr "Link"
#: templates/comments/content-list.html:65 #: templates/comments/content-list.html:66
#: templates/comments/content-list.html:71 templates/comments/list.html:110 #: templates/comments/content-list.html:72
#: templates/comments/list.html:117
msgid "Reply" msgid "Reply"
msgstr "Phản hồi" msgstr "Phản hồi"
#: templates/comments/content-list.html:78 templates/comments/list.html:123 #: templates/comments/content-list.html:79
msgid "Hide" msgid "Hide"
msgstr "Ẩn" msgstr "Ẩn"
#: templates/comments/content-list.html:92 #: templates/comments/content-list.html:94
#, fuzzy, python-format #, fuzzy, python-format
#| msgid "" #| msgid ""
#| "This comment is hidden due to too much negative feedback. Click <a " #| "This comment is hidden due to too much negative feedback. Click <a href="
#| "href=\"javascript:comment_show_content(%(id)s)\">here</a> to view it." #| "\"javascript:comment_show_content(%(id)s)\">here</a> to view it."
msgid "" msgid ""
"This comment is hidden due to too much negative feedback. Click <a\n" "This comment is hidden due to too much negative feedback. Click <a\n"
" href=\"javascript:" " href=\"javascript:comment_show_content(%(id)s)\">here</a> to "
"comment_show_content(%(id)s)\">here</a> to view it." "view it."
msgstr "" msgstr ""
"Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:" "Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:"
"comment_show_content(%(id)s)\">đây</a> để mở." "comment_show_content(%(id)s)\">đây</a> để mở."
#: templates/comments/content-list.html:107 #: templates/comments/content-list.html:109
msgid "replies" msgid "replies"
msgstr "phản hồi" msgstr "phản hồi"
#: templates/comments/content-list.html:114 #: templates/comments/content-list.html:129
msgid "reply" msgid "more comments"
msgstr "phản hồi"
#: templates/comments/content-list.html:130 templates/comments/list.html:160
msgid "comment more"
msgstr "bình luận nữa"
#: templates/comments/content-list.html:137 templates/comments/list.html:168
msgid "comments more"
msgstr "bình luận nữa" msgstr "bình luận nữa"
#: templates/comments/list.html:6 #: templates/comments/list.html:6
@ -3777,20 +3765,11 @@ msgstr "Nội dung không hợp lệ."
msgid "Post!" msgid "Post!"
msgstr "Đăng!" msgstr "Đăng!"
#: templates/comments/list.html:138 #: templates/comments/list.html:44
#, python-format
msgid ""
"This comment is hidden due to too much negative feedback. Click <a "
"href=\"javascript:comment_show_content(%(id)s)\">here</a> to view it."
msgstr ""
"Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:"
"comment_show_content(%(id)s)\">đây</a> để mở."
#: templates/comments/list.html:177
msgid "There are no comments at the moment." msgid "There are no comments at the moment."
msgstr "Không có bình luận nào." msgstr "Không có bình luận nào."
#: templates/comments/list.html:182 #: templates/comments/list.html:49
msgid "Comments are disabled on this page." msgid "Comments are disabled on this page."
msgstr "Bình luận bị tắt trong trang này." msgstr "Bình luận bị tắt trong trang này."
@ -3918,8 +3897,8 @@ msgstr "G:i T, j F, Y"
#: templates/contest/contest-datetime.html:39 #: templates/contest/contest-datetime.html:39
#, python-format #, python-format
msgid "" msgid ""
"<b>%(time_limit)s</b> window between <b>%(start_time)s</b> and " "<b>%(time_limit)s</b> window between <b>%(start_time)s</b> and <b>"
"<b>%(end_time)s</b>" "%(end_time)s</b>"
msgstr "" msgstr ""
"Kéo dài <b>%(time_limit)s</b> từ <b>%(start_time)s</b> đến <b>%(end_time)s</" "Kéo dài <b>%(time_limit)s</b> từ <b>%(start_time)s</b> đến <b>%(end_time)s</"
"b>" "b>"
@ -5752,6 +5731,22 @@ msgstr "Thông tin"
msgid "Check all" msgid "Check all"
msgstr "Chọn tất cả" msgstr "Chọn tất cả"
#~ msgid "reply"
#~ msgstr "phản hồi"
#~ msgid "comment more"
#~ msgstr "bình luận nữa"
#~ msgid "comments more"
#~ msgstr "bình luận nữa"
#~ msgid ""
#~ "This comment is hidden due to too much negative feedback. Click <a href="
#~ "\"javascript:comment_show_content(%(id)s)\">here</a> to view it."
#~ msgstr ""
#~ "Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:"
#~ "comment_show_content(%(id)s)\">đây</a> để mở."
#, fuzzy #, fuzzy
#~| msgid "short name" #~| msgid "short name"
#~ msgid "first name" #~ msgid "first name"
@ -5804,7 +5799,6 @@ msgstr "Chọn tất cả"
#~ msgid "Django administration" #~ msgid "Django administration"
#~ msgstr "Quản trị viên Django" #~ msgstr "Quản trị viên Django"
#, python-format
#~ msgid "" #~ msgid ""
#~ "Please enter the correct %(username)s and password for an admin account. " #~ "Please enter the correct %(username)s and password for an admin account. "
#~ "Note that both fields may be case-sensitive." #~ "Note that both fields may be case-sensitive."
@ -5812,7 +5806,6 @@ msgstr "Chọn tất cả"
#~ "Hãy nhập %(username)s và mật khẩu hợp lệ cho tài khoản quản trị. Chú ý cả " #~ "Hãy nhập %(username)s và mật khẩu hợp lệ cho tài khoản quản trị. Chú ý cả "
#~ "hai trường có phân biệt chữ Hoa-thường." #~ "hai trường có phân biệt chữ Hoa-thường."
#, python-format
#~ msgid "" #~ msgid ""
#~ "Please enter the correct %(username)s and password for an user account. " #~ "Please enter the correct %(username)s and password for an user account. "
#~ "Note that both fields may be case-sensitive." #~ "Note that both fields may be case-sensitive."

View file

@ -33,6 +33,9 @@ msgstr "Đề xuất bài tập"
msgid "TanKhoa" msgid "TanKhoa"
msgstr "Tân Khoa" msgstr "Tân Khoa"
msgid "Name"
msgstr "Đăng ký tên"
msgid "Report" msgid "Report"
msgstr "Báo cáo" msgstr "Báo cáo"
@ -342,9 +345,6 @@ msgstr ""
msgid "ltt" msgid "ltt"
msgstr "" msgstr ""
msgid "Luyện tập"
msgstr ""
msgid "manacher" msgid "manacher"
msgstr "" msgstr ""
@ -593,6 +593,3 @@ msgstr ""
msgid "z-function" msgid "z-function"
msgstr "" msgstr ""
#~ msgid "Name"
#~ msgstr "Đăng ký tên"

View file

@ -306,6 +306,10 @@ a {
} }
} }
.show_more_comment {
margin-left: -20px;
}
@media (max-width: 799px) { @media (max-width: 799px) {
.hide_texts_on_mobile .actionbar-text { .hide_texts_on_mobile .actionbar-text {
display: none; display: none;

View file

@ -1,139 +1,131 @@
{% set logged_in = request.user.is_authenticated %} {% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %} {% set profile = request.profile if logged_in else None %}
{% for node in mptt_tree(comment_list) recursive %} {% for node in mptt_tree(comment_list) recursive %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}" <li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment"> data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}"> <div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info"> <div class="info">
<div class="vote"> <div class="vote">
{% if logged_in %} {% if logged_in %}
<a href="javascript:comment_upvote({{ node.id }})" <a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a> class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
</div>
<div class="detail">
<div class="header">
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user comment-img">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
{{ link_user(node.author) }},&nbsp;
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
{% if node.revisions > 1 %}
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)" class="previous-revision">&larr;</a>
<span class="comment-edit-text">
{% if node.revisions > 2 %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% else %} {% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" {{ _('edited') }}
title="{{ _('Please login to vote') }}" class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %} {% endif %}
<br> </span>
<div class="comment-score">{{ node.score }}</div> <a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
{% if logged_in %} class="next-revision">&rarr;</a>
<a href="javascript:comment_downvote({{ node.id }})" </span>
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a> {% else %}
{% else %} <span class="comment-edits"></span>
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
</div>
<div class="detail">
<div class="header">
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user comment-img">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
{{ link_user(node.author) }},&nbsp;
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
{% if node.revisions > 1 %}
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)" class="previous-revision">&larr;</a>
<span class="comment-edit-text">
{% if node.revisions > 2 %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% else %}
{{ _('edited') }}
{% endif %}
</span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span>
{% else %}
<span class="comment-edits"></span>
{% endif %}
<a href="#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
{% if logged_in and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
{% else %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"><i
class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link"><i
class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}" class="hide-comment"><i
class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}" title="{{ _('Admin') }}"><i
class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %}
</span>
</div>
<div class="content content-description">
<div class="comment-body" {% if node.score <=vote_hide_threshold %} style="display:none" {% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div>
{% if node.score <= vote_hide_threshold %} <div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a
href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div>
{% endif %} {% endif %}
<a href="?comment-id={{node.id}}#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
{% if logged_in and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
{% else %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"><i
class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link"><i
class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}" class="hide-comment"><i
class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}" title="{{ _('Admin') }}"><i
class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %}
</span>
</div>
<div class="content content-description">
<div class="comment-body" {% if node.score <=vote_hide_threshold %} style="display:none" {% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div> </div>
{% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a
href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div>
{% endif %}
</div>
</div> </div>
</div> </div>
{% if node.count_replies > 1 %} {% if node.count_replies %}
<a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply"> <a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path> <path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path>
</svg> </svg>
{{ node.count_replies }} {{ _('replies') }} </a> {{ node.count_replies }} {{ _('replies') if node.count_replies > 1 else _('reply') }}
{% elif node.count_replies %} </a>
<a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply"> {% endif %}
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path>
</svg>
{{ node.count_replies }} {{ _('reply') }} </a>
{% endif %}
</li> </li>
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul> <ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
<ul id="comment-{{ node.id }}-children" class="comments"> </ul> {% with children=node.get_children() %}
{% if children %}
<ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
{% else %}
<ul id="comment-{{ node.id }}-children" class="comments"></ul>
{% endif %}
{% endwith %}
{% endfor %} {% endfor %}
{% if comment_more > 0 %}
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parent_none }}, {{ offset }}, {{ target_comment }})" class="show_more_comment">
{% set comment_more = comment_count - offset %}
{% if comment_more == 1 %}
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path> <path d="M6 9l6 6l6 -6"></path>
</svg> </svg>
{{ comment_count - offset }} {{ _('comment more') }}</a> {{ comment_more }} {{ _('more comments') if comment_more > 1 else _('more comment') }}
{% elif comment_more > 1 %} </a>
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path>
</svg>
{{ comment_count - offset }} {{ _('comments more') }}</a>
{% endif %} {% endif %}

View file

@ -36,142 +36,9 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% if has_comments or comment_all_list %} {% if has_comments %}
<ul class="comments top-level-comments new-comments" id="comment-0"> <ul class="comments top-level-comments new-comments" id="comment-0">
{% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %}
{% if comment_all_list %}
{% for node in mptt_tree(comment_all_list) recursive %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}"
data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info">
<div class="vote">
{% if logged_in %}
<a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
</div>
<div class="detail">
<div class="header">
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user comment-img">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
{{ link_user(node.author) }},&nbsp;
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
{% if node.revisions > 1 %}
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)"
class="previous-revision">&larr;</a>
<span class="comment-edit-text">
{% if node.revisions > 2 %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% else %}
{{ _('edited') }}
{% endif %}
</span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span>
{% else %}
<span class="comment-edits"></span>
{% endif %}
<a href="#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
{% if logged_in and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}"
title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
{% else %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}"><i class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}"
class="edit-link"><i class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}"
class="hide-comment"><i class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}"
title="{{ _('Admin') }}"><i class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %}
</span>
</div>
<div class="content content-description">
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div>
{% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div>
{% endif %}
</div>
</div>
</div>
</li>
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
{% with children=node.get_children() %}
{% if children %}
<ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
{% endif %}
{% endwith %}
{% endfor %}
{% set comment_more = comment_count - offset %}
{% if comment_more == 1 %}
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path>
</svg>
{{ comment_count - offset }} {{ _('comment more') }}
</a>
{% elif comment_more > 1 %}
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path>
</svg>
{{ comment_count - offset }} {{ _('comments more') }}
</a>
{% endif %}
{% else %}
{% include "comments/content-list.html" %} {% include "comments/content-list.html" %}
{% endif %}
</ul> </ul>
{% elif not comment_lock %} {% elif not comment_lock %}
<p class="no-comments-message">{{ _('There are no comments at the moment.') }}</p> <p class="no-comments-message">{{ _('There are no comments at the moment.') }}</p>

View file

@ -121,24 +121,23 @@
} }
const queryString = window.location.search; const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const comment_remove = urlParams.get('comment-id'); const target_comment = urlParams.get('comment-id');
console.log(comment_remove);
window.comment_get_replies = function (id, parrent_none) { window.comment_get_replies = function (id, parent_none) {
var $comment_show_btn = $("#comment-" + id + " .show_more_reply"); var $comment_show_btn = $("#comment-" + id + " .show_more_reply");
$comment_show_btn.hide(); $comment_show_btn.hide();
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append("<p class='loading'> Loading... </p>"); $comment.append("<p class='loading'> Loading... </p>");
ajax_get_reply('{{ url('comment_get_replies') }}', id, parrent_none); ajax_get_reply('{{ url('comment_get_replies') }}', id, parent_none);
} }
function ajax_get_reply(url, id, parrent_none) { function ajax_get_reply(url, id, parent_none) {
return $.ajax({ return $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
data: { data: {
id: id, id: id,
parrent_none: parrent_none, parent_none: parent_none,
}, },
success: function(data) { success: function(data) {
var $comment_loading = $("#comment-" + id + "-children .loading"); var $comment_loading = $("#comment-" + id + "-children .loading");
@ -149,9 +148,8 @@
}) })
} }
window.comment_show_more = function (id, parrent_none, offset, comment_remove) { window.comment_show_more = function (id, parent_none, offset, target_comment) {
console.log(parrent_none) if (parent_none == 1) {
if (parrent_none == 1) {
var $comment_show_btn = $("#comment-0" + " .show_more_comment"); var $comment_show_btn = $("#comment-0" + " .show_more_comment");
$comment_show_btn.hide(); $comment_show_btn.hide();
var $comment = $("#comment-0"); var $comment = $("#comment-0");
@ -162,21 +160,21 @@
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append("<p class='loading'> Loading... </p>"); $comment.append("<p class='loading'> Loading... </p>");
} }
ajax_comment_show_more('{{ url('comment_show_more') }}', id, parrent_none, offset, comment_remove); ajax_comment_show_more('{{ url('comment_show_more') }}', id, parent_none, offset, target_comment);
} }
function ajax_comment_show_more(url, id, parrent_none, offset, comment_remove) { function ajax_comment_show_more(url, id, parent_none, offset, target_comment) {
return $.ajax({ return $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
data: { data: {
id: id, id: id,
parrent_none: parrent_none, parent_none: parent_none,
offset: offset, offset: offset,
comment_remove: comment_remove, target_comment: target_comment,
}, },
success: function(data) { success: function(data) {
if (parrent_none == 1) { if (parent_none == 1) {
var $comment_loading = $("#comment-0" + " .loading"); var $comment_loading = $("#comment-0" + " .loading");
$comment_loading.hide(); $comment_loading.hide();
var $comment = $("#comment-0"); var $comment = $("#comment-0");