Clean up No Comments rendering

This commit is contained in:
Scot Hacker 2018-03-13 23:33:28 -07:00
parent 675210586c
commit 2bab3ec703
2 changed files with 30 additions and 27 deletions

View file

@ -6,18 +6,6 @@
{% block content %}
<script type="text/javascript">
$(document).ready(function () {
// Initially hide the TaskEdit form
$('#TaskEdit').hide();
// toggle slide to show the Add Task form when link clicked
$('#slideToggle').click(function () {
$(this).siblings('#TaskEdit').slideToggle();
});
});
</script>
<h2>{{ task }}</h2>
<form action="" method="POST">
@ -106,9 +94,9 @@
</form>
<h3>Comments on this task</h3>
<div class="task_comments">
{% if comment_list %}
<h3>Comments on this task</h3>
{% for comment in comment_list %}
<p>
<strong>{{ comment.author.first_name }}
@ -117,9 +105,24 @@
</strong>
</p>
{{ comment.body|safe|urlize|linebreaks }}
{% empty %}
<p>No Comments</p>
{% endfor %}
{% else %}
<h3>No comments (yet).</h3>
{% endif %}
</div>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(document).ready(function () {
// Initially hide the TaskEdit form
$('#TaskEdit').hide();
// toggle slide to show the Add Task form when link clicked
$('#slideToggle').click(function () {
$(this).siblings('#TaskEdit').slideToggle();
});
});
</script>
{% endblock extra_js %}

View file

@ -96,7 +96,7 @@ def list_detail(request, list_id=None, list_slug=None, view_completed=False):
raise PermissionDenied
if request.POST:
# Process completed and deleted requests on each POST
# Process completed and deleted items on each POST
toggle_done(request, request.POST.getlist('toggle_done_tasks'))
toggle_deleted(request, request.POST.getlist('toggle_deleted_tasks'))