You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
7.9KB

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