| 1 | {% extends "base.html" %} |
| 2 | {% block title %}{{ user.name }} - Movie List{% endblock %} |
| 3 | |
| 4 | {% block content %} |
| 5 | <h1 class="title">{{ user.name }} - Movie List</h1> |
| 6 | |
| 7 | <div class="status-message"> |
| 8 | {% if success %} |
| 9 | <p>Movie added successfully!</p> |
| 10 | {% elif success == False %} |
| 11 | <p>Failed to add movie. |
| 12 | Please try again.</p> |
| 13 | {% endif %} |
| 14 | {% if movie_deleted %} |
| 15 | <p>Movie deleted successfully!</p> |
| 16 | {% elif movie_deleted == False %} |
| 17 | <p>Failed to delete movie. |
| 18 | Please try again.</p> |
| 19 | {% endif %} |
| 20 | </div> |
| 21 | |
| 22 | <div class="actions"> |
| 23 | <form action="/users/{{ user.id }}/recommend_movie" method="POST"> |
| 24 | <button type="submit">Recommend Movie</button> |
| 25 | </form> |
| 26 | |
| 27 | <form action="/users/{{ user.id }}" method="POST"> |
| 28 | <label for="name">Name:</label> |
| 29 | <input type="text" id="name" name="name" required> |
| 30 | <button type="submit">Add Movie</button> |
| 31 | </form> |
| 32 | </div> |
| 33 | |
| 34 | <div class="movie-list"> |
| 35 | <div class="css-carousel" tabindex="0" aria-label="User's movies carousel"> |
| 36 | {% for movie in user_movies %} |
| 37 | <div class="carousel-item" role="group" aria-roledescription="slide" aria-label="{{ loop.index }} of {{ user_movies|length }}"> |
| 38 | <a href="/users/{{ user.id }}/{{ movie.id }}"> |
| 39 | <img src="{{ movie.poster }}" alt="{{ movie.name }}" height="200"></a> |
| 40 | <ul> |
| 41 | <li>{{ movie.name }} ({{ movie.year }})</li> |
| 42 | <li>Director: {{ movie.director }}</li> |
| 43 | <li>Rating: {{ movie.rating }}</li> |
| 44 | <li>User Rating: {{ movie.user_rating }}</li> |
| 45 | <li> |
| 46 | <form action="/users/{{ user.id }}/{{ movie.id }}" method="POST"> |
| 47 | <label for="user_rating_{{ movie.id }}">New User Rating:</label> |
| 48 | <input type="text" id="user_rating_{{ movie.id }}" name="user_rating" min="0.1" max="10.0" step="0.1" required> |
| 49 | <button type="submit">Update</button> |
| 50 | </form> |
| 51 | </li> |
| 52 | <li> |
| 53 | <form action="/users/{{ user.id }}/delete/{{ movie.id }}" method="POST"> |
| 54 | <button type="submit" name="movie_id" value="{{ movie.id }}">Delete</button> |
| 55 | </form> |
| 56 | </li> |
| 57 | </ul> |
| 58 | </div> |
| 59 | {% endfor %} |
| 60 | </div> |
| 61 | <p class="scroll-instruction">Drag or scroll horizontally with pressing shift and |
| 62 | using your mouse or trackpad to browse movies.</p> |
| 63 | </div> |
| 64 | {% endblock %} |