snapshots_grid.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. {% load i18n admin_urls static admin_list %}
  2. {% load core_tags %}
  3. {% block extrastyle %}
  4. <style>
  5. #changelist-search #searchbar {
  6. min-height: 24px;
  7. }
  8. .cards {
  9. padding-top: 10px;
  10. display: grid;
  11. grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* see notes below */
  12. grid-auto-rows: minmax(200px, auto);
  13. grid-gap: 14px 14px;
  14. }
  15. .cards .card {
  16. position: relative;
  17. max-height: 380px;
  18. overflow: hidden;
  19. background-color: #fffcfc;
  20. border: 1px solid #f1efef;
  21. border-radius: 4px;
  22. box-shadow: 4px 4px 2px 2px rgba(0, 0, 0, 0.01);
  23. text-align: center;
  24. color: #5d5e5e;
  25. }
  26. .cards .card.selected-card {
  27. border: 3px solid #2196f3;
  28. box-shadow: 2px 3px 6px 2px rgba(0, 0, 221, 0.14);
  29. }
  30. .cards .card .card-thumbnail {
  31. display: block;
  32. width: 100%;
  33. height: 345px;
  34. overflow: hidden;
  35. border-radius: 4px;
  36. background-color: #fffcfc;
  37. }
  38. .cards .card .card-thumbnail img {
  39. width: 100%;
  40. height: auto;
  41. border: 0;
  42. }
  43. .cards .card .card-thumbnail.missing img {
  44. opacity: 0.03;
  45. width: 20%;
  46. height: auto;
  47. margin-top: 84px;
  48. }
  49. .cards .card .card-tags {
  50. width: 100%;
  51. }
  52. .cards .card .card-tags span {
  53. display: inline-block;
  54. padding: 2px 5px;
  55. border-radius: 5px;
  56. opacity: 0.95;
  57. background-color: #bfdfff;
  58. color: #679ac2;
  59. font-size: 12px;
  60. margin-bottom: 3px;
  61. }
  62. .cards .card .card-footer {
  63. width: 100%;
  64. position: absolute;
  65. bottom: 0;
  66. text-align: center;
  67. }
  68. .cards .card .card-title {
  69. padding: 4px 5px;
  70. background-color: #fffcfc;
  71. /*height: 50px;
  72. vertical-align: middle;
  73. line-height: 50px;*/
  74. }
  75. .cards .card .card-title h4 {
  76. color: initial;
  77. display: block;
  78. vertical-align: middle;
  79. line-height: normal;
  80. margin: 0px;
  81. padding: 5px 0px;
  82. font-size: 13.5px;
  83. font-weight: 400;
  84. word-break: break-all;
  85. overflow: hidden;
  86. text-overflow: ellipsis;
  87. max-height: 46px;
  88. }
  89. .cards .card .card-title h4 .title-text {
  90. user-select: all;
  91. }
  92. .cards .card .card-title .link-favicon {
  93. height: 15px;
  94. margin: 2px;
  95. vertical-align: -5px;
  96. display: inline-block;
  97. }
  98. .cards .card .card-info {
  99. padding: 2px 4px;
  100. /*border-top: 1px solid #ddd;*/
  101. background-color: #fffcfc;
  102. font-size: 11px;
  103. color: #333;
  104. }
  105. .cards .card .card-info input[type=checkbox] {
  106. float: right;
  107. width: 18px;
  108. height: 18px;
  109. }
  110. .cards .card .card-info label {
  111. display: inline-block;
  112. height: 20px;
  113. width: 145px;
  114. font-size: 11px;
  115. }
  116. .cards .card .card-info .timestamp {
  117. font-weight: 600;
  118. }
  119. .cards .card .card-progress {
  120. display: flex;
  121. align-items: center;
  122. gap: 6px;
  123. padding: 4px 0;
  124. }
  125. .cards .card .card-progress .progress-text {
  126. font-size: 11px;
  127. color: #3b82f6;
  128. font-weight: 500;
  129. }
  130. .cards .card.archiving {
  131. border-color: #3b82f6;
  132. box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  133. }
  134. .cards .card .card-footer code {
  135. display: inline-block;
  136. width: 100%;
  137. margin-top: 2px;
  138. font-size: 10px;
  139. opacity: 0.4;
  140. user-select: all;
  141. white-space: nowrap;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. }
  145. </style>
  146. {% endblock %}
  147. {% block content %}
  148. <section class="cards">
  149. {% for obj in results %}
  150. <div class="card{% if obj.status == 'started' %} archiving{% endif %}">
  151. <div class="card-info">
  152. <a href="{% url 'admin:core_snapshot_change' obj.pk %}">
  153. <span class="timestamp">{{obj.bookmarked_at}}</span>
  154. </a>
  155. {% if obj.status == 'started' %}
  156. <div class="card-progress">
  157. <span class="snapshot-progress-spinner"></span>
  158. <span class="progress-text">Archiving...</span>
  159. </div>
  160. {% else %}
  161. <div style="padding: 4px 0;">
  162. {{ obj.icons|safe }}
  163. </div>
  164. {% endif %}
  165. <label>
  166. <span>🗄&nbsp; {{ obj.archive_size | file_size }}</span>
  167. <input type="checkbox" name="_selected_action" value="{{obj.pk}}"/>
  168. </label>
  169. </div>
  170. <a href="{% snapshot_base_url obj %}/index.html" class="card-thumbnail {% if not obj.thumbnail_url %}missing{% endif %}">
  171. <img src="{{obj.thumbnail_url|default:'/static/spinner.gif' }}" alt="{{obj.title|default:'Not yet archived...'}}" />
  172. </a>
  173. <div class="card-footer">
  174. {% if obj.tags_str %}
  175. <div class="card-tags">
  176. {% for tag in obj.tags_str|split:',' %}
  177. <span>
  178. {{tag}}
  179. </span>
  180. {% endfor %}
  181. </div>
  182. {% endif %}
  183. <div class="card-title" title="{{obj.title}}">
  184. <a href="{% snapshot_base_url obj %}/index.html">
  185. <h4>
  186. {% if obj.is_archived %}
  187. <img src="{% snapshot_base_url obj %}/favicon.ico" onerror="this.style.display='none'" class="link-favicon" decoding="async"/>
  188. {% else %}
  189. <img src="{% static 'spinner.gif' %}" onerror="this.style.display='none'" class="link-favicon" decoding="async"/>
  190. {% endif %}
  191. <span class="title-text">{{obj.title|default:'Pending...' }}</span>
  192. </h4>
  193. </a>
  194. <code title="{{obj.url}}">{{obj.url}}</code>
  195. </div>
  196. </div>
  197. </div>
  198. {% endfor %}
  199. </section>
  200. <br/>
  201. {% endblock %}