Permalink
Browse files

Use form to enable/disable comment

  • Loading branch information...
greyli committed Sep 14, 2018
1 parent 4c6622c commit 4ef28988586fc09a64e31b87722b83615416b1cd
Showing with 6 additions and 3 deletions.
  1. +6 −3 albumy/templates/main/_comment.html
@@ -4,9 +4,12 @@ <h3>{{ photo.comments|length }} Comments
<a href="{{ url_for('.show_photo', photo_id=photo.id, page=pagination.pages or 1) }}#comment-form">latest</a>
</small>
{% if current_user == photo.author %}
<a class="btn btn-xs btn-link float-right" href="{{ url_for('.set_comment', photo_id=photo.id) }}">
{% if photo.can_comment %}Disable{% else %}Enable{% endif %} comment
</a>
<form class="inline" method="post" action="{{ url_for('.set_comment', photo_id=photo.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-xs btn-link float-right">
{% if photo.can_comment %}Disable{% else %}Enable{% endif %} comment
</button>
</form>
{% endif %}
</h3>
<hr>

0 comments on commit 4ef2898

Please sign in to comment.