Adds commenting

works on #59
This commit is contained in:
Mouse Reeve
2020-03-21 16:50:49 -07:00
parent 3f96c8cd9d
commit 7862af9729
16 changed files with 222 additions and 31 deletions

View File

@ -9,24 +9,32 @@
</h2>
<div class="tabs secondary">
<div class="tab active">
Review
<div class="tab active" data-id="tab-review-{{ book.id }}" data-category="tab-option-{{ book.id }}">
<a href="{{ book.absolute_id }}/review" onclick="tabChange(event)">Review</a>
</div>
<div class="tab">
Comment
<div class="tab" data-id="tab-comment-{{ book.id }}" data-category="tab-option-{{ book.id }}">
<a href="{{ book.absolute_id }}/comment" onclick="tabChange(event)">Comment</a>
</div>
<div class="tab">
<div class="tab" data-id="tab-quote-{{ book.id }}" data-category="tab-option-{{ book.id }}">
Quote
</div>
</div>
<div class="book-preview">
{% include 'snippets/book_cover.html' with book=book %}
<form class="review-form" name="review" action="/review/" method="post">
<form class="tab-option-{{ book.id }} review-form" name="review" action="/review/" method="post" id="tab-review-{{ book.id }}">
{% csrf_token %}
{# TODO: this shouldn't use the openlibrary key #}
{# todo: this shouldn't use the openlibrary key #}
<input type="hidden" name="book" value="{{ book.openlibrary_key }}"></input>
{{ review_form.as_p }}
<button type="submit">Post review</button>
<button type="submit">post review</button>
</form>
<form class="hidden tab-option-{{ book.id }} review-form" name="comment" action="/comment/" method="post" id="tab-comment-{{ book.id }}">
{% csrf_token %}
{# todo: this shouldn't use the openlibrary key #}
<input type="hidden" name="book" value="{{ book.openlibrary_key }}"></input>
{{ comment_form.as_p }}
<button type="submit">post comment</button>
</form>
</div>

View File

@ -1,11 +1,11 @@
{% load fr_display %}
<div class="interaction">
<form name="comment" action="/comment" method="post" onsubmit="return comment(e_">
<form name="reply" action="/reply" method="post" onsubmit="return reply(event)">
{% csrf_token %}
<input type="hidden" name="parent" value="{{ activity.id }}"></input>
<textarea name="content" placeholder="Leave a comment..." id="id_content" required="true"></textarea>
<button type="submit" class="comment">
<button type="submit">
<span class="icon icon-comment">
<span class="hidden-text">Comment</span>
</span>

View File

@ -8,6 +8,8 @@
{{ status.content | safe }}
{% elif status.status_type == 'Review' %}
reviewed {{ status.book.title }}
{% elif status.status_type == 'Comment' %}
commented on {{ status.book.title }}
{% elif status.reply_parent %}
{% with parent_status=status|parent %}
replied to {% include 'snippets/username.html' with user=parent_status.user possessive=True %} <a href="{{parent_status.absolute_id }}">{{ parent_status.status_type|lower }}</a>