This commit is contained in:
vladislav 2026-08-31 16:02:45 -04:00
parent 588793f66c
commit 42be861364
Signed by: Vladislav
GPG Key ID: D97C9E5E4860EE45

View File

@ -145,7 +145,11 @@
.c_la1ap { color: rgba(58, 58, 58, 0.75); font-family: Inter; font-size: 14px; font-style: normal; font-weight: 400; line-height: normal; }
.c_w6ecf { -webkit-box-orient: vertical; -webkit-line-clamp: 1; align-self: stretch; color: #000; display: -webkit-box; font-family: Inter; font-size: 20px; font-style: normal; font-weight: 700; line-height: normal; overflow: hidden; text-overflow: ellipsis; }
.c_m3jeo { align-content: flex-start; align-items: flex-start; background: #FFF; display: flex; flex-wrap: wrap; gap: 30px; justify-content: center; width: 1600px; }
}</style>
}
.b_gagrr { align-items: center; align-self: stretch; display: flex; justify-content: space-between; }
.b_rhbo8 { color: #5F1798; font-family: Inter; font-size: 14px; font-style: normal; font-weight: 400; line-height: normal; }
.c_eiyz0{cursor: pointer;}
</style>
{{ footer.style() }}
{% endblock %}
@ -182,12 +186,18 @@
</div>
<p class="c_zlnpy b_7efyd">{{paint.description or ''}}</p>
<p class="c_sbnel b_frv5u">{{ (paint._id.generation_time.strftime('%d.%m.%Y')) if paint._id else ''}}</p>
{% if user and user._id == post.user._id %}
<div class="c_ybfp2 b_gagrr">
<a class="c_eiyz0 b_rhbo8" href="/form/post/{{post._id}}">Редактировать</a>
<button class="c_eiyz0 b_rhbo8" onclick="deletePost('{{post._id}}')">Удалить</button>
</div>
{% else %}
<a class="c_75ykb b_gk0ob" href="https://telegram.me/gennadiy0605"><span class="c_dlut5 b_v0d1u">Обсудить покупку картины </span></a>
{% endif %}
<div class="c_sbnel b_frv5u">{{ share.share('/paintings/{}'.format(paint._id), paint.title, '/b/posts/{}'.format(paint.medias[0])) }}</div>
<p class="c_sbnel b_frv5u">👁 {{total_watch_count}} (+{{today_watch_count}} Сегодня)</p>
</div>
</section>
</div>
<script>
const images = [
@ -296,9 +306,35 @@
init();
setTimeout(updateTransform, 100); // даём браузеру время на рендер
</script>
<script>
function deletePost(postId) {
fetch(`/api/post/${postId}`, {
method: 'DELETE'
})
.then(response => {
if (response.ok) {
// Find and delete the parent figure
const postElement = document.querySelector(`figure[data-postId='${postId}']`);
if (postElement) {
postElement.remove();
}
} else {
showToast({
message: 'Ошибка соединения с сервером!',
status: 'error',
duration: 2500
});
}
})
.catch(error => {
// Handle network errors
showToast({
message: 'Ошибка соединения с сервером!',
status: 'error',
duration: 2500
});
});
}
</script>
{{ footer.section(user) }}
{% endblock %}