Skip to content

Commit

Permalink
Remove comment titles
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritofeng authored and Xyene committed Jan 4, 2019
1 parent 9fbb439 commit 84aa2c1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 31 deletions.
3 changes: 1 addition & 2 deletions judge/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class CommentForm(ModelForm):
class Meta:
model = Comment
fields = ['title', 'body', 'parent']
fields = ['body', 'parent']
widgets = {
'parent': forms.HiddenInput(),
}
Expand All @@ -38,7 +38,6 @@ class Meta:
def __init__(self, request, *args, **kwargs):
self.request = request
super(CommentForm, self).__init__(*args, **kwargs)
self.fields['title'].widget.attrs.update({'placeholder': _('Comment title')})
self.fields['body'].widget.attrs.update({'placeholder': _('Comment body')})

def clean(self):
Expand Down
19 changes: 19 additions & 0 deletions judge/migrations/0079_remove_comment_title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-01-03 23:44
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('judge', '0078_add_user_notes'),
]

operations = [
migrations.RemoveField(
model_name='comment',
name='title',
),
]
1 change: 0 additions & 1 deletion judge/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Comment(MPTTModel):
page = models.CharField(max_length=30, verbose_name=_('associated page'), db_index=True,
validators=[comment_validator])
score = models.IntegerField(verbose_name=_('votes'), default=0)
title = models.CharField(max_length=200, verbose_name=_('title of comment'), blank=True)
body = models.TextField(verbose_name=_('body of comment'), max_length=8192)
hidden = models.BooleanField(verbose_name=_('hide the comment'), default=0)
parent = TreeForeignKey('self', verbose_name=_('parent'), null=True, blank=True, related_name='replies')
Expand Down
2 changes: 1 addition & 1 deletion judge/views/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_object(self, queryset=None):
class CommentEditForm(ModelForm):
class Meta:
model = Comment
fields = ['title', 'body']
fields = ['body']
if MathJaxPagedownWidget is not None:
widgets = {'body': MathJaxPagedownWidget(attrs={'id': 'id-edit-comment-body'})}

Expand Down
4 changes: 0 additions & 4 deletions resources/comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ a {
}
}

.comment-title {
font-weight: bold;
}

.comment-author {
margin-bottom: 1em;

Expand Down
26 changes: 12 additions & 14 deletions templates/comments/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,19 @@ <h2><i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments')
</span>
</div>
<div class="content content-description">
<div class="comment-title"{% if not node.title or node.title.startswith('Re:') %}
style="display: none"{% endif %}>{{ node.title }}</div>
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown('comment', MATH_ENGINE, True)|reference|str|safe }}
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown('comment', MATH_ENGINE, 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>
{% 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 %}
</div>
</div>
</div>
Expand Down
6 changes: 0 additions & 6 deletions templates/comments/media-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
max-width: calc(100% - 134px);
}

.new-comments .comment-title {
font-weight: 600;
color: black;
padding-top: 0.8em;
}

.new-comments .comment-edits {
padding-right: 0.75em;
}
Expand Down
4 changes: 1 addition & 3 deletions templates/comments/revision-ajax.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% with node=revision.field_dict %}
<div class="comment-title"{% if not node.title or node.title.startswith('Re:') %}
style="display: none"{% endif %}>{{ node.title }}</div>
<div class="comment-body">{{ node.body|markdown('comment', MATH_ENGINE)|reference|str|safe }}</div>
{% endwith %}
{% endwith %}

0 comments on commit 84aa2c1

Please sign in to comment.