Skip to content

Commit

Permalink
comment: Add unapprove button, fix table
Browse files Browse the repository at this point in the history
  • Loading branch information
illume committed Oct 5, 2023
1 parent 9abd183 commit 5f6c583
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
5 changes: 4 additions & 1 deletion pygameweb/comment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def mark_comment(comment_post_id, action):
flash('Comment marked spam.')
elif action == 'approve':
comment.is_approved = True
flash('Comment marked spam.')
flash('Comment approved.')
elif action == 'unapprove':
comment.is_approved = False
flash('Comment unapproved.')
else:
abort(404)

Expand Down
19 changes: 8 additions & 11 deletions pygameweb/templates/comment/recent.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>Newest Comments</h1>
<table class="table table-condensed custom-table">
<thead>
<tr>
<th>approved?</th>
<th>name</th>
<th>message</th>
<th>created_at</th>
Expand All @@ -39,13 +38,6 @@ <h1>Newest Comments</h1>
<tbody>
{% for post in posts if ((not post.is_spam) and (not post.is_deleted)) %}
<tr>
<td>
{% if post.is_approved %}
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{% else %}
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
{% endif %}
</td>
<td>
{{ post.author.name }}
<a href="{{ post.thread.link_path }}">{{ post.thread.link_path }}</a>
Expand All @@ -54,10 +46,15 @@ <h1>Newest Comments</h1>
<td>{{ post.created_at }}</td>
<td>
{{ mark_post_button(post, 'spam', 'Spam') }}
<br/>
{{ mark_post_button(post, 'delete', 'Delete') }}
<br/>
{{ mark_post_button(post, 'approve', 'Approve') }}

{% if post.is_approved is none %}
{{ mark_post_button(post, 'approve', 'Approve') }}
{% elif post.is_approved %}
{{ mark_post_button(post, 'unapprove', 'UnApprove') }}
{% else %}
{{ mark_post_button(post, 'approve', 'Approve') }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 5f6c583

Please sign in to comment.