Compare commits
No commits in common. "315e6f8142a549e7ec2aa24aa85fc54f53a031a0" and "e6ae7440aa547a5e53c72aed0950629134815523" have entirely different histories.
315e6f8142
...
e6ae7440aa
155
app.py
155
app.py
@ -1,5 +1,4 @@
|
|||||||
from flask import Flask, render_template, request, jsonify, make_response
|
from flask import Flask, render_template, request
|
||||||
|
|
||||||
from flask_assets import Bundle, Environment
|
from flask_assets import Bundle, Environment
|
||||||
from arango import ArangoClient
|
from arango import ArangoClient
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
@ -31,16 +30,9 @@ db = arango_client.db('board1', username='root', password='stolendick527')
|
|||||||
|
|
||||||
|
|
||||||
# предполагается что меняться список будет весьма редко, поэтому подхватываем при лишь при перезапуске
|
# предполагается что меняться список будет весьма редко, поэтому подхватываем при лишь при перезапуске
|
||||||
# # boards0 = db.collection('boards')
|
boards0 = db.collection('boards')
|
||||||
# # print(boards0)
|
print(boards0)
|
||||||
# # board_list = [ k['_key'] for k in boards0]
|
board_list = [ k['_key'] for k in boards0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/get_my_ip")
|
|
||||||
def get_my_ip():
|
|
||||||
return jsonify({'ip': request.remote_addr,
|
|
||||||
'real-ip': request.environ.get('HTTP_X_REAL_IP', request.remote_addr)}), 200
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/liveness')
|
@app.route('/liveness')
|
||||||
@ -58,132 +50,44 @@ def healthz():
|
|||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def homepage():
|
def homepage():
|
||||||
boards0 = db.collection('boards')
|
|
||||||
board_list = [ k['_key'] for k in boards0]
|
|
||||||
return render_template("main-page.html", host_id=docker_short_id, boards=board_list)
|
return render_template("main-page.html", host_id=docker_short_id, boards=board_list)
|
||||||
|
|
||||||
|
|
||||||
#### TODO если борды нет, то возвращать 404 мемную
|
|
||||||
#### TODO если треда нет, то возвращать 404 мемную
|
|
||||||
|
|
||||||
|
@app.route('/db_posts')
|
||||||
|
@app.route("/db_posts/<target_post_id>")
|
||||||
|
def page_posts_from_db(target_post_id=None):
|
||||||
|
|
||||||
#### DONE route :: /{board}/
|
|
||||||
@app.route('/<board>')
|
|
||||||
def board_posts(board=None):
|
|
||||||
postos = db.collection('posts')
|
postos = db.collection('posts')
|
||||||
postos = [ p for p in postos if p.get('root_post') == True and p.get('board') == board ]
|
|
||||||
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
|
||||||
|
|
||||||
boards0 = db.collection('boards')
|
|
||||||
board_list = [ k['_key'] for k in boards0]
|
|
||||||
return render_template("board-posts.html", host_id=docker_short_id, postos=postos, board=board, target_post_id=None, boards=board_list)
|
|
||||||
|
|
||||||
|
|
||||||
#### TODO route :: /{board}/{thread}/
|
|
||||||
#### TODO убрать отсюда чужие рут-потсы
|
|
||||||
@app.route("/<board>/<int:target_post_id>")
|
|
||||||
def thread_posts(board=None, target_post_id=None):
|
|
||||||
|
|
||||||
## взять рут-пост
|
|
||||||
## взять всех его детей
|
|
||||||
|
|
||||||
# postos = db.collection('posts')
|
|
||||||
# postos = [ p for p in postos]
|
|
||||||
# postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
|
||||||
|
|
||||||
cursor = db.aql.execute(
|
|
||||||
f"""FOR ppp IN posts
|
|
||||||
FILTER ppp.root_post == True and ppp._key == "{target_post_id}"
|
|
||||||
FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v"""
|
|
||||||
)
|
|
||||||
|
|
||||||
postos = [ ]
|
|
||||||
while not cursor.empty(): # Pop until nothing is left on the cursor.
|
|
||||||
postos.append(cursor.pop())
|
|
||||||
cursor = db.aql.execute(
|
|
||||||
f'RETURN DOCUMENT("posts/{target_post_id}")'
|
|
||||||
)
|
|
||||||
while not cursor.empty(): # Pop until nothing is left on the cursor.
|
|
||||||
postos.append(cursor.pop())
|
|
||||||
postos = [ p for p in postos]
|
postos = [ p for p in postos]
|
||||||
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
||||||
|
|
||||||
if not target_post_id:
|
if not target_post_id:
|
||||||
target_post_id = postos[0]['_key']
|
target_post_id = postos[0]['_key']
|
||||||
|
|
||||||
|
return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos, target_post_id=target_post_id)
|
||||||
boards0 = db.collection('boards')
|
|
||||||
board_list = [ k['_key'] for k in boards0]
|
|
||||||
return render_template("interactive-posts.html", board=board, host_id=docker_short_id, postos=postos, target_post_id=target_post_id, boards=board_list)
|
|
||||||
|
|
||||||
|
|
||||||
#### TODO route :: /{board}/create_thread/{target_post_id}
|
@app.route("/answer_post/<target_post_id>", methods=['POST'])
|
||||||
@app.route("/<board>/create-thread/<target_post_id>", methods=['POST'])
|
def answer_post(target_post_id):
|
||||||
def create_thread(board=None, target_post_id=None):
|
|
||||||
|
|
||||||
postos = db.collection('posts')
|
|
||||||
data = request.form['send_this_text']
|
|
||||||
|
|
||||||
metadata = postos.insert({
|
|
||||||
'texto': data,
|
|
||||||
"root_post": True,
|
|
||||||
'board': board,
|
|
||||||
'images': [],
|
|
||||||
"children_num": 0,
|
|
||||||
"answers_num": 0,
|
|
||||||
"answers_list": [ [], [], [] ]
|
|
||||||
}, overwrite_mode='update')
|
|
||||||
|
|
||||||
response = make_response()
|
|
||||||
response.headers["HX-Redirect"] = f"/{board}/{metadata['_key']}"
|
|
||||||
response.status_code = 200
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
#### TODO route :: /{board}/{thread}/answer_post/
|
|
||||||
|
|
||||||
#### TODO route :: /{board}/{thread}/post_to_another_post/
|
|
||||||
|
|
||||||
|
|
||||||
# @app.route('/db_posts')
|
|
||||||
# @app.route("/db_posts/<target_post_id>")
|
|
||||||
# def page_posts_from_db(target_post_id=None):
|
|
||||||
|
|
||||||
# postos = db.collection('posts')
|
|
||||||
# postos = [ p for p in postos]
|
|
||||||
# postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
|
||||||
|
|
||||||
|
|
||||||
# for p in postos:
|
|
||||||
# #if p['root_post']:
|
|
||||||
# print(p)
|
|
||||||
|
|
||||||
# if not target_post_id:
|
|
||||||
# target_post_id = postos[0]['_key']
|
|
||||||
|
|
||||||
# return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos, target_post_id=target_post_id)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/<board>/answer_post/<target_post_id>", methods=['POST'])
|
|
||||||
def answer_post(board, target_post_id):
|
|
||||||
|
|
||||||
postos = db.collection('posts')
|
postos = db.collection('posts')
|
||||||
postos = [ p for p in postos]
|
postos = [ p for p in postos]
|
||||||
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
||||||
|
|
||||||
## ?? wut
|
|
||||||
if not target_post_id:
|
if not target_post_id:
|
||||||
target_post_id = postos[0]['_key']
|
target_post_id = postos[0]['_key']
|
||||||
|
|
||||||
return render_template("answer-post.html", board=board, target_post_id=target_post_id)
|
return render_template("answer-post.html", target_post_id=target_post_id)
|
||||||
|
|
||||||
|
|
||||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'mp4', 'webm', 'webp'}
|
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'mp4', 'webm', 'webp'}
|
||||||
def allowed_file(filename):
|
def allowed_file(filename):
|
||||||
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
return '.' in filename and \
|
||||||
|
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||||
|
|
||||||
@app.route('/<board>/post_to_another_post/<post_key>', methods=['POST'])
|
@app.route('/post_to_another_post/<post_key>', methods=['POST'])
|
||||||
def post_to_post(board, post_key):
|
def post_to_post(post_key):
|
||||||
|
|
||||||
|
|
||||||
#### TODO resize pics https://stackoverflow.com/questions/53337318/how-can-i-resize-image-with-pil-on-upload-and-serve-them-with-flask-cloudy
|
#### TODO resize pics https://stackoverflow.com/questions/53337318/how-can-i-resize-image-with-pil-on-upload-and-serve-them-with-flask-cloudy
|
||||||
@ -207,27 +111,12 @@ def post_to_post(board, post_key):
|
|||||||
|
|
||||||
|
|
||||||
postos = db.collection('posts')
|
postos = db.collection('posts')
|
||||||
|
|
||||||
data = request.form['send_this_text']
|
data = request.form['send_this_text']
|
||||||
|
|
||||||
|
|
||||||
cursor = db.aql.execute(
|
|
||||||
f'RETURN DOCUMENT("posts/{post_key}")'
|
|
||||||
)
|
|
||||||
p = cursor.pop()
|
|
||||||
|
|
||||||
if p.get('root_post') == True:
|
|
||||||
thread = p.get('_key')
|
|
||||||
elif not p.get('root_post'):
|
|
||||||
thread = p.get('thread')
|
|
||||||
else:
|
|
||||||
thread = 'ERROR'
|
|
||||||
|
|
||||||
print(p)
|
|
||||||
metadata = postos.insert({
|
metadata = postos.insert({
|
||||||
'texto': data,
|
'texto': data,
|
||||||
'parent_post': f'{post_key}',
|
'parent_post': f'{post_key}'
|
||||||
'images': [],
|
|
||||||
"thread": thread
|
|
||||||
}, overwrite_mode='update')
|
}, overwrite_mode='update')
|
||||||
|
|
||||||
metadata = db.collection('post_parents').insert({
|
metadata = db.collection('post_parents').insert({
|
||||||
@ -236,7 +125,6 @@ def post_to_post(board, post_key):
|
|||||||
}, overwrite_mode='update')
|
}, overwrite_mode='update')
|
||||||
|
|
||||||
|
|
||||||
#### TODO оптимайз для только тредовых штук
|
|
||||||
cursor = db.aql.execute(
|
cursor = db.aql.execute(
|
||||||
"""FOR ppp IN posts
|
"""FOR ppp IN posts
|
||||||
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
|
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
|
||||||
@ -257,20 +145,13 @@ def post_to_post(board, post_key):
|
|||||||
)
|
)
|
||||||
|
|
||||||
postos = db.collection('posts')
|
postos = db.collection('posts')
|
||||||
postos = [ p for p in postos if (not p.get('root_post')) and p.get('thread') == thread ]
|
|
||||||
cursor = db.aql.execute(
|
|
||||||
f'RETURN DOCUMENT("posts/{thread}")'
|
|
||||||
)
|
|
||||||
postos.append(cursor.pop())
|
|
||||||
|
|
||||||
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
||||||
|
|
||||||
return render_template("i-posts.html", board=board, host_id=docker_short_id, postos=postos)
|
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### TODO websockets
|
#### TODO websockets
|
||||||
#### TODO sse
|
|
||||||
#### TODO kafka
|
#### TODO kafka
|
||||||
#### TODO shards
|
#### TODO shards
|
||||||
#### TODO grpc
|
#### TODO grpc
|
||||||
|
@ -1,37 +1,19 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<form
|
|
||||||
hx-encoding='multipart/form-data'
|
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
|
|
||||||
hx-on::after-request="this.reset()"
|
|
||||||
>
|
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="card-title">Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
|
<span class="card-title">Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
|
||||||
</div>
|
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
||||||
<div class="row">
|
<form hx-encoding='multipart/form-data' _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||||
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>>{{ target_post_id }}</i></a>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="input-field col s6">
|
<div class="input-field col s6">
|
||||||
<input id="send_this_text" name="send_this_text" type="text" >
|
<input id="send_this_text" name="send_this_text" type="text" >
|
||||||
<label for="send_this_text">Печатать сюда</label>
|
<label for="send_this_text">Печатать сюда</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="input-field col s6">
|
<div class="input-field col s6">
|
||||||
<div class="file-field input-field">
|
|
||||||
<div class="btn">
|
|
||||||
<span>File</span>
|
|
||||||
<input id="file" name="file" type="file" multiple>
|
<input id="file" name="file" type="file" multiple>
|
||||||
</div>
|
<label for="file">Upload</label>
|
||||||
<div class="file-path-wrapper">
|
|
||||||
<input class="file-path validate" type="text" placeholder="Upload one or more files">
|
|
||||||
<progress id='progress' value='0' max='100'></progress>
|
<progress id='progress' value='0' max='100'></progress>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="file-progress">
|
</form>
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
@ -39,7 +21,7 @@
|
|||||||
<button class="btn waves-effect waves-light"
|
<button class="btn waves-effect waves-light"
|
||||||
type="submit" name="action" hx-encoding='multipart/form-data'
|
type="submit" name="action" hx-encoding='multipart/form-data'
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
|
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
|
||||||
hx-post="/{{board}}/post_to_another_post/{{ target_post_id }}"
|
hx-post="/post_to_another_post/{{ target_post_id }}"
|
||||||
hx-target="#neu-posts"
|
hx-target="#neu-posts"
|
||||||
hx-include="[name='send_this_text'], [name='file']"
|
hx-include="[name='send_this_text'], [name='file']"
|
||||||
>
|
>
|
||||||
@ -48,7 +30,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
<!-- <div class="row">
|
<!-- <div class="row">
|
||||||
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'navbar.html' %}
|
|
||||||
|
|
||||||
<div class="row" >
|
|
||||||
{% include 'create-thread.html' %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" >
|
|
||||||
<div class="col s6 m5" id="op-posts">
|
|
||||||
{% include 'op-posts.html' %}
|
|
||||||
</div>
|
|
||||||
<!-- <div class="col s6 m5" id="thread-viz">
|
|
||||||
<iframe src="https://thread-visualizah-dev.board.vdk2ch.ru/" scrolling="no" frameborder="0" style="position: relative; height: 600px; width: 100%; margin:10px;"></iframe>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock content %}
|
|
@ -1,48 +0,0 @@
|
|||||||
<div class="card">
|
|
||||||
<form
|
|
||||||
hx-encoding='multipart/form-data'
|
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
|
|
||||||
hx-on::after-request="this.reset()"
|
|
||||||
>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="row">
|
|
||||||
<span class="card-title">Создавай тред уже!</span>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<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 class="row">
|
|
||||||
<div class="input-field col s6">
|
|
||||||
<div class="file-field input-field">
|
|
||||||
<div class="btn">
|
|
||||||
<span>File</span>
|
|
||||||
<input id="file" name="file" type="file" multiple>
|
|
||||||
</div>
|
|
||||||
<div class="file-path-wrapper">
|
|
||||||
<input class="file-path validate" type="text" placeholder="Upload one or more files">
|
|
||||||
<progress id='progress' value='0' max='100'></progress>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="file-progress">
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-action">
|
|
||||||
<a href="/{{board}}/create-thread/{{ target_post_id }}">
|
|
||||||
<button class="btn waves-effect waves-light"
|
|
||||||
type="submit" name="action" hx-encoding='multipart/form-data'
|
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
|
|
||||||
hx-post="/{{board}}/create-thread/{{ target_post_id }}"
|
|
||||||
hx-include="[name='send_this_text'], [name='file']"
|
|
||||||
>
|
|
||||||
Отправить!!
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
@ -6,45 +6,19 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<div class="card s5 blue-grey darken-1">
|
<div class="card s5 blue-grey darken-1">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="card-content white-text">
|
|
||||||
<span class="new badge yellow" data-badge-caption="">
|
|
||||||
<a class="purple-text" href="#post-{{ posto._key }}"> #{{ posto._key }} </a>
|
|
||||||
</span>
|
|
||||||
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
|
|
||||||
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="row" id="post-{{ posto._key }}">
|
<div class="row" id="post-{{ posto._key }}">
|
||||||
|
<div class="col s4">
|
||||||
{% if posto.images | length > 0 %}
|
<div class="card-image">
|
||||||
<div class="col s12">
|
<div class="hex-main">
|
||||||
<!-- <div class="hex-main">
|
|
||||||
<div class="hex-container">
|
<div class="hex-container">
|
||||||
<a href="https://loremflickr.com/g/320/240/paris" target="_blank" ">
|
<a href="https://loremflickr.com/g/320/240/paris" target="_blank" ">
|
||||||
<img src="https://loremflickr.com/g/320/240/paris">
|
<img src="https://loremflickr.com/g/320/240/paris">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
|
||||||
<div class="nav-wrapper">
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li>
|
|
||||||
<a href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank" ">
|
|
||||||
<img src="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" width="300px">
|
|
||||||
</a>
|
|
||||||
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank"> photo_2023-05-16_00-49-34.jpg </a> </span>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank" ">
|
|
||||||
<img src="https://static.guaranteedstruggle.host/thread-pics/109.png" width="300px">
|
|
||||||
</a>
|
|
||||||
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank"> 109.png </a> </span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</div>
|
||||||
<!-- <div class="col s8">
|
<div class="col s8">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
<span class="card-title">#{{ posto._key }}
|
<span class="card-title">#{{ posto._key }}
|
||||||
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
|
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
|
||||||
@ -52,38 +26,50 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% if posto.parent_post %}
|
{% if posto.parent_post %}
|
||||||
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
<a class="card-action" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ posto.texto }}</p>
|
<p>{{ posto.texto }}</p>
|
||||||
</div>
|
|
||||||
</div> -->
|
<!-- {% if posto.answers_list[0] | length > 0 %}
|
||||||
<div class="col s12 card-content white-text">
|
<br>
|
||||||
{% if posto.parent_post %}
|
<p>Ответы:</p>
|
||||||
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
<div class="collection">
|
||||||
|
{% for ans in posto.answers_list[0] %}
|
||||||
|
{% 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" style="padding: 2px 2px;">>>{{ (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" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ posto.texto }}</p>
|
{% else %}
|
||||||
|
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 card-action white-text">
|
{% endif %} -->
|
||||||
<div class="right">
|
</div>
|
||||||
|
</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="/{{board}}/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
|
<a href="#answer-post" hx-post="/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 card-content white-text">
|
<div class="col s12">
|
||||||
<!-- TODO !подгрузка следующего поста в конец треда без перезагрузки всего треда! -->
|
<!-- TODO !подгрузка следующего поста в конец треда без перезагрузки всего треда! -->
|
||||||
<div class="left">
|
<div class="card-action left">
|
||||||
<!-- <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> -->
|
||||||
{% if posto.answers_list[0] | length > 0 %}
|
{% if posto.answers_list[0] | length > 0 %}
|
||||||
<p>Ответы:</p>
|
<p>Ответы:</p>
|
||||||
{% for ans in posto.answers_list[0] %}
|
{% for ans in posto.answers_list[0] %}
|
||||||
{% if (posto.answers_list[1])[loop.index-1] > 0 %}
|
{% if (posto.answers_list[1])[loop.index-1] > 0 %}
|
||||||
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
|
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
|
||||||
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
|
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
|
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
|
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s3 m3 " id="aa"></div>
|
|
||||||
<div class="col s7 m6" id="answer-post">
|
<div class="col s7 m6" id="answer-post">
|
||||||
{% include 'answer-post.html' %}
|
{% include 'answer-post.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,12 +3,7 @@
|
|||||||
<div class="nav-wrapper purple darken-3">
|
<div class="nav-wrapper purple darken-3">
|
||||||
<ul id="nav-mobile" class="left ">
|
<ul id="nav-mobile" class="left ">
|
||||||
<li> <a href="/">glavnaya</a> </li>
|
<li> <a href="/">glavnaya</a> </li>
|
||||||
|
<li><a href="/db_posts"><span class="new badge red" data-badge-caption="">and here we go again..</span></a> </li>
|
||||||
{% if boards | length > 0 %}
|
|
||||||
{% for board in boards %}
|
|
||||||
<li><a href="/{{board}}"><span class="new badge red" data-badge-caption="">{{board}}</span></a> </li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#">Вас закинуло сюда: <span class="new badge blue" data-badge-caption="">{{host_id}}</span></a>
|
<a href="#">Вас закинуло сюда: <span class="new badge blue" data-badge-caption="">{{host_id}}</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
{% if postos | length > 0 %}
|
|
||||||
{% for posto in postos %}
|
|
||||||
<div class="row">
|
|
||||||
{% if posto.root_post %}
|
|
||||||
<div class="card s5 deep-orange accent-4 darken-1">
|
|
||||||
{% else %}
|
|
||||||
<div class="card s5 blue-grey darken-1">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="card-content white-text">
|
|
||||||
<span class="new badge yellow" data-badge-caption="">
|
|
||||||
<a class="purple-text" href="/{{board}}/{{ posto._key }}"> #{{ posto._key }} </a>
|
|
||||||
</span>
|
|
||||||
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
|
|
||||||
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="row" id="post-{{ posto._key }}">
|
|
||||||
|
|
||||||
{% if posto.images | length > 0 %}
|
|
||||||
<div class="col s12">
|
|
||||||
<!-- <div class="nav-wrapper">
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li>
|
|
||||||
<a href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank" ">
|
|
||||||
<img src="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" width="300px">
|
|
||||||
</a>
|
|
||||||
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank"> photo_2023-05-16_00-49-34.jpg </a> </span>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank" ">
|
|
||||||
<img src="https://static.guaranteedstruggle.host/thread-pics/109.png" width="300px">
|
|
||||||
</a>
|
|
||||||
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank"> 109.png </a> </span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="col s12 card-content white-text">
|
|
||||||
<p>{{ posto.texto }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="col s12 card-action white-text">
|
|
||||||
<div class="right">
|
|
||||||
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
|
|
||||||
<a href="/{{board}}/{{ posto._key }}" >В тред!</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
Loading…
Reference in New Issue
Block a user