book_detail.html 2.6 KB

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