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.

142 lines
4.9KB

  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <div class="cell-margin grid grid-cols-[2fr,1fr]">
  4. <div class="left">
  5. <div class="mb-8">
  6. <div class="mb-2">Book</div>
  7. {% if book['thumbnail'] %}
  8. <div class="float-right">
  9. <img class="w-40 h-40 object-contain m-16 rotate-[15deg]" src={{ book['thumbnail'] }} alt="cover for {{ book['Title'] }}">
  10. </div>
  11. {% endif %}
  12. <h2 class="book mb-2 max-w-[30rem]">{% block title %} {{ book['Title'] or resource['name'] }} {% endblock %}</h2>
  13. {% if book['Year'] %}
  14. {{ book['Year'] }}
  15. {% endif %}
  16. {% if book['Authors'] %}
  17. <div class="">
  18. {% if book['Authors']|length > 1 %}
  19. <div class="">
  20. {% for author in book['Authors'] %}
  21. {{ author }}</br>
  22. {% endfor %}
  23. </div>
  24. {% else %}
  25. <div>
  26. {% for author in book['Authors'] %}
  27. {{ author }}
  28. {% endfor %}
  29. </div>
  30. {% endif %}
  31. </div>
  32. {% endif %}
  33. </div>
  34. <div class="">
  35. {% if current_user.is_authenticated %}
  36. <div class="">
  37. <a href="{{ url_for('book.edit_book', book_id=resource['id']) }}">
  38. <span class="badge bg-dark">Edit</span>
  39. </a>
  40. </div>
  41. {% endif %}
  42. <div class="facts">
  43. {% if resource['typology'] %}
  44. <div class="">
  45. <h3>Typology category</h3>
  46. <a href="/books?typology={{ resource['typology'] }}">{{ resource['typology'] }}</a>
  47. </div>
  48. {% endif %}
  49. {% if resource['bookUrl'] %}
  50. <div class="">
  51. <h3>URL</h3>
  52. <a target="_blank" href="{{ resource['bookUrl'] }}">{{ resource['bookUrl'] }}</a>
  53. </div>
  54. {% endif %}
  55. {% if book %}
  56. <!-- fields for books from isbntools -->
  57. {% if book['ISBN-13'] %}
  58. <div class="">
  59. <h3>
  60. ISBN-13
  61. </h3>
  62. <div>
  63. {{ book['ISBN-13'] }}
  64. </div>
  65. </div>
  66. {% endif %}
  67. {% if book['Publisher'] %}
  68. <div class="">
  69. <h3>
  70. Publisher
  71. </h3>
  72. <div>
  73. {{ book['Publisher'] }}
  74. </div>
  75. </div>
  76. {% endif %}
  77. {% else %}
  78. <!-- fields for books from database -->
  79. {% if resource['name'] %}
  80. <!-- <div class="">
  81. <h3>Title</h3>
  82. <div class="">{{ resource['name'] }}</div>
  83. </div> -->
  84. {% endif %}
  85. {% if resource['author'] %}
  86. <div class="">
  87. <h3>Author</h3>
  88. <div class="">{{ resource['author'] }}</div>
  89. </div>
  90. {% endif %}
  91. {% if resource['year'] %}
  92. <div class="">
  93. <h3>Publication year</h3>
  94. <div>
  95. {{ resource['year'] }}
  96. </div>
  97. </div>
  98. {% endif %}
  99. {% endif %}
  100. {% if book['desc'] %}
  101. <div class="col-span-2">
  102. <h3>Publisher's description</h3>
  103. <div class="">{{ book['desc'] }}</div>
  104. </div>
  105. {% endif %}
  106. {% if resource['description'] %}
  107. <div class="col-span-2">
  108. <h3>
  109. Experimental aspects:
  110. </h3>
  111. <div>
  112. {{ resource['description'] }}
  113. </div>
  114. </div>
  115. {% endif %}
  116. </div>
  117. </div>
  118. </div>
  119. <div class="right lg:mt-16">
  120. <div class=" max-w-[30rem] mx-auto p-4">
  121. {{ relationships_links(relationships) }}
  122. </div>
  123. </div>
  124. </div>
  125. {% endblock %}