Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

205 lines
7.5KB

  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {% if book['thumbnail'] %}
  4. <img class="img-fluid mx-auto d-block py-3" src={{ book['thumbnail'] }} alt="cover for {{ book['Title'] }}">
  5. {% else %}
  6. <div class="row">
  7. <div class="col">
  8. <h1 class="text-center">{% block title %} {{ book['Title'] or resource['name'] }} {% endblock %}</h1>
  9. </div>
  10. </div>
  11. {% endif %}
  12. {% if current_user.is_authenticated %}
  13. <div class="row text-center py-3">
  14. <a href="{{ url_for('book.edit_book', book_id=resource['id']) }}">
  15. <span class="badge bg-dark">Edit</span>
  16. </a>
  17. </div>
  18. {% endif %}
  19. <div class="row">
  20. <div class="col">
  21. <table class="table table-hover">
  22. <tbody>
  23. {% if resource['bookUrl'] %}
  24. <tr>
  25. <th>
  26. URL:
  27. </th>
  28. <td>
  29. <a href="{{ resource['bookUrl'] }}">{{ resource['bookUrl'] }}</a>
  30. </td>
  31. </tr>
  32. {% endif %}
  33. {% if book %}
  34. <!-- fields for books from isbntools -->
  35. {% if book['Title'] %}
  36. <tr>
  37. <th>
  38. Title:
  39. </th>
  40. <td>
  41. {{ book['Title'] }}
  42. </td>
  43. </tr>
  44. {% endif %}
  45. {% if book['Authors'] %}
  46. <tr>
  47. {% if book['Authors']|length > 1 %}
  48. <th>
  49. Authors:
  50. </th>
  51. <td>
  52. {% for author in book['Authors'] %}
  53. {{ author }}</br>
  54. {% endfor %}
  55. </td>
  56. {% else %}
  57. <th>
  58. Author:
  59. </th>
  60. <td>
  61. {% for author in book['Authors'] %}
  62. {{ author }}
  63. {% endfor %}
  64. </td>
  65. {% endif %}
  66. </tr>
  67. {% endif %}
  68. {% if book['ISBN-13'] %}
  69. <tr>
  70. <th>
  71. ISBN-13:
  72. </th>
  73. <td>
  74. {{ book['ISBN-13'] }}
  75. </td>
  76. </tr>
  77. {% endif %}
  78. {% if book['Year'] %}
  79. <tr>
  80. <th>
  81. Publication year:
  82. </th>
  83. <td>
  84. {{ book['Year'] }}
  85. </td>
  86. </tr>
  87. {% endif %}
  88. {% if book['Publisher'] %}
  89. <tr>
  90. <th>
  91. Publisher:
  92. </th>
  93. <td>
  94. {{ book['Publisher'] }}
  95. </td>
  96. </tr>
  97. {% endif %}
  98. {% if book['desc'] %}
  99. <tr>
  100. <th>
  101. Summary:
  102. </th>
  103. <td>
  104. {{ book['desc'] }}
  105. </td>
  106. </tr>
  107. {% endif %}
  108. {% else %}
  109. <!-- fields for books from database -->
  110. {% if resource['name'] %}
  111. <tr>
  112. <th>
  113. Title:
  114. </th>
  115. <td>
  116. {{ resource['name'] }}
  117. </td>
  118. </tr>
  119. {% endif %}
  120. {% if resource['author'] %}
  121. <tr>
  122. <th>
  123. Author:
  124. </th>
  125. <td>
  126. {{ resource['author'] }}
  127. </td>
  128. </tr>
  129. {% endif %}
  130. {% if resource['year'] %}
  131. <tr>
  132. <th>
  133. Publication year:
  134. </th>
  135. <td>
  136. {{ resource['year'] }}
  137. </td>
  138. </tr>
  139. {% endif %}
  140. {% if resource['description'] %}
  141. <tr>
  142. <th>
  143. Summary:
  144. </th>
  145. <td>
  146. {{ resource['description'] }}
  147. </td>
  148. </tr>
  149. {% endif %}
  150. {% endif %}
  151. </tbody>
  152. </table>
  153. </div>
  154. </div>
  155. {% if relationships %}
  156. <div class="row">
  157. <div class="col">
  158. <h2 class="text-center">Linked resources:</h2>
  159. </div>
  160. </div>
  161. <div class="row">
  162. {% for relationship in relationships %}
  163. <div class="col-md-4 col-sm-6 py-3">
  164. {% if relationship['type'] == 'tool' %}
  165. <div class="card text-dark bg-tool mb-3">
  166. <div class="card-body">
  167. <a href="{{ url_for('tool.show_tool', tool_id=relationship['id']) }}">
  168. <h3 class="card-title text-center text-dark">{{ relationship['name'] }}</h3>
  169. </a>
  170. <p class="card-text">
  171. {{ relationship['description']|truncate(100) }}
  172. </p>
  173. </div>
  174. </div>
  175. {% elif relationship['type'] == 'practice' %}
  176. <div class="card text-dark bg-practice mb-3">
  177. <div class="card-body">
  178. <a href="{{ url_for('practice.show_practice', practice_id=relationship['id']) }}">
  179. <h3 class="card-title text-center text-dark">{{ relationship['name'] }}</h3>
  180. </a>
  181. <p class="card-text">
  182. {{ relationship['description']|truncate(100) }}
  183. </p>
  184. </div>
  185. </div>
  186. {% elif relationship['type'] == 'book' %}
  187. <div class="card text-dark bg-book mb-3">
  188. <div class="card-body">
  189. <a href="{{ url_for('book.show_book', book_id=relationship['id']) }}">
  190. <h3 class="card-title text-center text-dark">{{ relationship['name'] }}</h3>
  191. </a>
  192. <p class="card-text">
  193. {{ relationship['description']|truncate(100) }}
  194. </p>
  195. </div>
  196. </div>
  197. {% endif %}
  198. </div>
  199. {% endfor %}
  200. </div>
  201. {% endif %}
  202. {% endblock %}