movieclub/templates/watchlist/movie_detail.html

46 lines
3.2 KiB
HTML

{% extends 'base.html' %}
{% block content %}
<div class="container-lg">
<h1 class="display-1">{{ movie.name }}</h1>
<p class="text-secondary">Suggested by: {{movie.suggested_by.username}}</p>
<div class="mb-2">
{% if request.user.is_staff or movie.suggested_by == request.user %}<a class="btn btn-sm btn-danger" href="{% url 'watchlist:edit' movie.id %}">Edit</a>{% endif %}
<a class="btn btn-sm btn-secondary" href="{% if movie.imdb_id %}https://www.imdb.com/title/{{movie.imdb_id}}/{%else%}https://www.imdb.com/find/?q={{movie.name}}{%endif%}" referrerpolicy="no-referrer" target="_blank">IMDB{% if movie.imdb_id == '' %}*{%endif%}</a>
<a class="btn btn-sm btn-secondary" href="{% if movie.csfd_id %}https://www.csfd.cz/film/{{movie.csfd_id}}{%else%}https://www.csfd.cz/hledat/?q={{movie.name}}{%endif%}" referrerpolicy="no-referrer" target="_blank">ČSFD{% if movie.csfd_id == '' %}*{%endif%}</a></div>
<h2>Votes</h2>
{% if votes|length == 0 %}
<p>Nobody voted yet, be first...</p>
{% else %}
<p>Total score: {{ movie.score }}, seen by: {{ movie.seen_score }}.
<ul>
{% for vote in votes %}
<li>{{vote.user.username}} {% if vote.seen %}(seen){% endif %} &ndash; {% if vote.vote == 1 %}👍{% elif vote.vote == 0 %}No opinion{% elif vote.vote == -1 %}👎{%endif%}{% if vote.comment != "" %} &ndash; {{vote.comment}}{% endif %}</li>
{% endfor %}
</ul>
{% endif %}
{% if request.user.is_authenticated %}
<h2>Your opinion</h2>
<form action="{% url 'watchlist:vote' movie.id %}" method="post">
{% csrf_token %}
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-upvote" value="1" {% if user_vote and user_vote.vote == 1 %} checked {% endif %}><label class="form-check-label" for="vote-upvote">Want to watch</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-novote" value="0" {% if user_vote is None or user_vote.vote == 0 %} checked {% endif %}><label class="form-check-label" for="vote-novote">No opinion</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-downvote" value="-1" {% if user_vote and user_vote.vote == -1 %} checked {% endif %}><label class="form-check-label" for="vote-downvote">Don't want to watch</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="seen" name="seen" {% if user_vote and user_vote.seen %} checked {%endif%}><label class="form-check-label" for="seen">I saw this movie already</label><br>
</div>
<div>
<label class="form-check-label" for="comment">Comment</label>
<input class="form-control" type="text" id="comment" name="comment" {% if user_vote and user_vote.comment %} value="{{user_vote.comment}}"{% endif %}>
</div>
<input class="btn btn-primary" type="submit" value="Submit">
</form>
</h2>
{% endif %}
</div>
{% endblock %}