This commit is contained in:
parent
586b76bc25
commit
7f94bade46
16
app.py
16
app.py
@ -63,6 +63,22 @@ def page_posts_from_db(target_post_id=None):
|
||||
|
||||
return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos, target_post_id=target_post_id)
|
||||
|
||||
|
||||
@app.route("/answer_post/<target_post_id>")
|
||||
def page_posts_from_db(target_post_id):
|
||||
|
||||
postos = db.collection('posts')
|
||||
postos = [ p for p in postos]
|
||||
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
|
||||
|
||||
if not target_post_id:
|
||||
target_post_id = postos[0]['_key']
|
||||
|
||||
return render_template("answer-post.html", target_post_id=target_post_id)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route('/post_my_post/<post_key>', methods=['POST'])
|
||||
def post_a_post(post_key):
|
||||
|
30
templates/answer-post.html
Normal file
30
templates/answer-post.html
Normal file
@ -0,0 +1,30 @@
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<div class="row">
|
||||
<span class="card-title">Создай то, о чем будут говорить многие.</span>
|
||||
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
||||
<div class="input-field col s6">
|
||||
<input id="send_this_text" name="send_this_text" type="text" >
|
||||
<label for="send_this_text">Печатать сюда</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<button class="btn waves-effect waves-light"
|
||||
type="submit" name="action"
|
||||
hx-post="/post_to_another_post/{{ target_post_id }}"
|
||||
hx-target="#neu-posts"
|
||||
hx-include="[name='send_this_text']"
|
||||
>
|
||||
Отправить!!
|
||||
<i class="material-icons right">send</i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- <h1>Загрузить картинку:</h1>
|
||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||
<div *ngFor="let singlePic of inputImages" >Картинка: {{singlePic}}</div>
|
||||
<p>
|
||||
<button (click)="eraseData()" >Убрать картинку</button>
|
||||
</p> -->
|
||||
</div>
|
@ -33,7 +33,8 @@
|
||||
</div>
|
||||
<div class="col s12">
|
||||
<div class="card-action right">
|
||||
<a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a>
|
||||
<!-- <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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,39 +6,8 @@
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col s7 m6">
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<div class="row">
|
||||
<span class="card-title">Создай то, о чем будут говорить многие.</span>
|
||||
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
||||
<div class="input-field col s6">
|
||||
<input id="send_this_text" name="send_this_text" type="text" >
|
||||
<label for="send_this_text">Печатать сюда</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<button class="btn waves-effect waves-light"
|
||||
type="submit" name="action"
|
||||
hx-post="/post_to_another_post/{{ target_post_id }}"
|
||||
hx-target="#neu-posts"
|
||||
hx-include="[name='send_this_text']"
|
||||
>
|
||||
Отправить!!
|
||||
<i class="material-icons right">send</i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- <h1>Загрузить картинку:</h1>
|
||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||
<div *ngFor="let singlePic of inputImages" >Картинка: {{singlePic}}</div>
|
||||
<p>
|
||||
<button (click)="eraseData()" >Убрать картинку</button>
|
||||
</p> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s7 m6" id="andswer-posts">
|
||||
{% include 'answer-post.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user