flask-htmx-board1/templates/i-posts.html

63 lines
3.9 KiB
HTML
Raw Normal View History

2023-07-13 19:59:56 +10:00
{% if postos | length > 0 %}
2023-07-14 13:19:50 +10:00
{% for posto in postos %}
<div class="row">
{% if posto.root_post %}
2023-07-19 01:30:56 +10:00
<div class="card s5 deep-orange accent-4 darken-1">
2023-07-14 13:19:50 +10:00
{% else %}
2023-07-19 01:30:56 +10:00
<div class="card s5 blue-grey darken-1">
2023-07-14 13:19:50 +10:00
{% endif %}
<div class="row" id="post-{{ posto._key }}">
<div class="col s4">
<div class="card-image">
<div class="hex-main">
<div class="hex-container">
<a href="https://loremflickr.com/g/320/240/paris" target="_blank" ">
<img src="https://loremflickr.com/g/320/240/paris">
</a>
</div>
</div>
</div>
2023-07-14 13:16:05 +10:00
</div>
2023-07-14 13:19:50 +10:00
<div class="col s8">
<div class="card-content white-text">
<span class="card-title">#{{ posto._key }}
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
</span>
{% if posto.parent_post %}
<a class="card-action" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
{% endif %}
<p>{{ posto.texto }}</p>
2023-07-19 01:03:05 +10:00
2023-07-19 01:14:36 +10:00
{% if posto.answers_list[0] | length > 0 %}
2023-07-19 01:03:05 +10:00
<br>
<p>Ответы:</p>
2023-07-19 01:04:55 +10:00
<div class="collection">
2023-07-19 01:22:07 +10:00
{% for ans in posto.answers_list[0] %}
2023-07-19 01:26:52 +10:00
{% if (posto.answers_list[1])[loop.index-1] > 0 %}
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
{% endif %}
2023-07-19 01:24:55 +10:00
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
{% endif %}
2023-07-19 01:03:05 +10:00
{% endfor %}
2023-07-19 01:04:55 +10:00
</div>
2023-07-19 01:03:05 +10:00
{% endif %}
2023-07-14 13:19:50 +10:00
</div>
2023-07-14 13:16:05 +10:00
</div>
2023-07-14 13:19:50 +10:00
<div class="col s12">
2023-07-19 01:48:55 +10:00
<!-- TODO !подгрузка следующего поста в конец треда без перезагрузки всего треда! -->
2023-07-14 13:19:50 +10:00
<div class="card-action right">
2023-07-19 00:28:45 +10:00
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
<a href="#answer-post" hx-post="/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
2023-07-14 13:19:50 +10:00
</div>
2023-07-14 13:16:05 +10:00
</div>
2023-07-13 20:23:27 +10:00
</div>
2023-07-13 21:34:06 +10:00
</div>
2023-07-14 13:19:50 +10:00
</div>
2023-07-14 13:16:32 +10:00
{% endfor %}
2023-07-13 19:50:45 +10:00
{% endif %}