book_detail.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {% extends "base_list.html" %}
  2. {% load mathfilters %}
  3. {% load static %}
  4. {% load naturalduration %}
  5. {% block title %}{{object.title}}{% endblock %}
  6. {% block lists %}
  7. <div class="row">
  8. {% if object.cover%}
  9. <p style="float:left; width:402px; padding:0; border: 1px solid #ccc">
  10. <img src="{{object.cover.url}}" width=400 />
  11. </p>
  12. {% endif %}
  13. <div style="float:left; width:600px; margin-left:10px; ">
  14. {% if object.summary %}
  15. <p>{{object.summary|safe|linebreaks|truncatewords:160}}</p>
  16. <hr />
  17. {% endif %}
  18. <p style="float:right;">
  19. <a href="{{object.openlibrary_link}}"><img src="{% static " images/openlibrary-logo.png" %}" width=35></a>
  20. <a href="{{object.amazon_link}}"><img src="{% static " images/amazon-logo.png" %}" width=35></a>
  21. </p>
  22. </div>
  23. </div>
  24. <div class="row">
  25. <p>{{object.scrobble_set.count}} scrobbles</p>
  26. <p>Read {{object.scrobble_set.last.book_pages_read}} pages{% if object.scrobble_set.last.long_play_complete %} and completed{% else %}{% endif %}</p>
  27. <p>
  28. {% if object.scrobble_set.last.long_play_complete == True %}
  29. <a href="">Read again</a>
  30. {% else %}
  31. <a href="">Resume reading</a>
  32. {% endif %}
  33. </p>
  34. </div>
  35. <div class="row">
  36. <div class="col-md">
  37. <h3>Last scrobbles</h3>
  38. <div class="table-responsive">
  39. <table class="table table-striped table-sm">
  40. <thead>
  41. <tr>
  42. <th scope="col">Date</th>
  43. <th scope="col">Completed</th>
  44. <th scope="col">Pages read</th>
  45. <th scope="col">Authors</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. {% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
  50. <tr>
  51. <td>{{scrobble.local_timestamp}}</td>
  52. <td>{% if scrobble.long_play_complete == True %}Yes{% endif %}</td>
  53. <td>{% if scrobble.in_progress %}Now reading{% else %}{{scrobble.session_pages_read}}{% endif %}</td>
  54. <td>{% for author in scrobble.book.authors.all %}<a href="{{author.get_absolute_url}}">{{author}}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
  55. </tr>
  56. {% endfor %}
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. </div>
  62. {% endblock %}