check posts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-13 21:26:04 +10:00
parent 9488d197dc
commit 3361533b62
4 changed files with 49 additions and 40 deletions

17
app.py
View File

@ -66,9 +66,20 @@ def page_posts_from_db():
return render_template("interactive-posts.html", postos=postos)
# @app.route('/post_my_post', method=['POST'])
# def post_a_post():
# pass
@app.route('/post_my_post', method=['POST'])
def post_a_post():
postos = db.collection('posts')
novenkiy = {
'texto': 'next post is this',
}
#### TODO проверить как-то по-умному что мы таки его добавили
metadata = postos.insert(novenkiy, overwrite_mode='update')
return render_template("i-posts.html", postos=[novenkiy])
# @app.route('/post_my_file', method=['POST'])
# def post_a_file():

View File

@ -1,38 +1,36 @@
{% if postos | length > 0 %}
{% for posto in postos %}
<div class="row">
<div class="col s12 m6">
{% if posto.root_post %}
<div class="card deep-orange accent-4 darken-1">
{% else %}
<div class="card blue-grey darken-1">
{% endif %}
<div class="row">
<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 class="col s12 m6">
{% if posto.root_post %}
<div class="card deep-orange accent-4 darken-1">
{% else %}
<div class="card blue-grey darken-1">
{% endif %}
<div class="row">
<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 class="col s8">
<div class="card-content white-text">
<span class="card-title">#{{ posto._key }}</span>
<p>{{ posto.texto }}</p>
</div>
</div>
<div class="col s12">
<div class="card-action right">
<a href="#">Answer me!</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col s8">
<div class="card-content white-text">
<span class="card-title">#{{ posto._key }}</span>
<p>{{ posto.texto }}</p>
</div>
</div>
<div class="col s12">
<div class="card-action right">
<a href="#" hx-post="/post_my_post" hx-target="#neu-posts" >Answer me!</a>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}

View File

@ -9,6 +9,9 @@
</nav>
{% include 'i-posts.html' %}
<div class="row" id="neu-posts">
{% include 'i-posts.html' %}
</div>
{% endblock content %}

View File

@ -13,10 +13,7 @@
</ul>
</div>
</nav>
<div id="particles-js"></div>
<script src="particles.js"></script>
<div id="multi-bg">
<div class="container">