Compare commits
41 Commits
e6ae7440aa
...
315e6f8142
Author | SHA1 | Date | |
---|---|---|---|
|
315e6f8142 | ||
|
17fc89ebbd | ||
|
fbb586b56c | ||
|
f9bbd5e6af | ||
|
412b26244a | ||
|
32f1d87831 | ||
|
216d60c84d | ||
|
ad6feb7afb | ||
|
a95d556e8c | ||
|
956b59c2fa | ||
|
a325ea91fe | ||
|
a84da0a6f9 | ||
|
9838f7f024 | ||
|
d21e5e0bf6 | ||
|
38842ec947 | ||
|
5ad7f7514d | ||
|
365c4909fe | ||
|
71f72c66f3 | ||
|
d4e585fb13 | ||
|
92bb87c816 | ||
|
9e90bd2458 | ||
|
2b5fd02929 | ||
|
d4131c26c8 | ||
|
edd102e5e3 | ||
|
2a5a3fd8e4 | ||
|
a7e17694c2 | ||
|
d0163a8963 | ||
|
e83dfebee5 | ||
|
c8241f2613 | ||
|
25e5430b4c | ||
|
e34be51a16 | ||
|
e30077bf4d | ||
|
3320baf0f2 | ||
|
68e455fe7b | ||
|
134297911b | ||
|
d89ba3f582 | ||
|
14057ead4d | ||
|
1b2bfb601b | ||
|
b3d20faec3 | ||
|
2a68a6d8c2 | ||
|
c36968ec16 |
173
app.py
173
app.py
@ -1,4 +1,5 @@
|
||||
from flask import Flask, render_template, request
|
||||
from flask import Flask, render_template, request, jsonify, make_response
|
||||
|
||||
from flask_assets import Bundle, Environment
|
||||
from arango import ArangoClient
|
||||
from minio import Minio
|
||||
@ -30,9 +31,16 @@ db = arango_client.db('board1', username='root', password='stolendick527')
|
||||
|
||||
|
||||
# предполагается что меняться список будет весьма редко, поэтому подхватываем при лишь при перезапуске
|
||||
boards0 = db.collection('boards')
|
||||
print(boards0)
|
||||
board_list = [ k['_key'] for k in boards0]
|
||||
# # boards0 = db.collection('boards')
|
||||
# # print(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')
|
||||
@ -49,45 +57,133 @@ def healthz():
|
||||
|
||||
|
||||
@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)
|
||||
|
||||
|
||||
|
||||
@app.route('/db_posts')
|
||||
@app.route("/db_posts/<target_post_id>")
|
||||
def page_posts_from_db(target_post_id=None):
|
||||
|
||||
#### TODO если борды нет, то возвращать 404 мемную
|
||||
#### TODO если треда нет, то возвращать 404 мемную
|
||||
|
||||
|
||||
#### DONE route :: /{board}/
|
||||
@app.route('/<board>')
|
||||
def board_posts(board=None):
|
||||
postos = db.collection('posts')
|
||||
postos = [ p for p in postos]
|
||||
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 = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
||||
|
||||
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)
|
||||
|
||||
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("/<board>/create-thread/<target_post_id>", methods=['POST'])
|
||||
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("/answer_post/<target_post_id>", methods=['POST'])
|
||||
def answer_post(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 = [ p for p in postos]
|
||||
postos = [ p for p in postos ]
|
||||
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
|
||||
|
||||
## ?? wut
|
||||
if not target_post_id:
|
||||
target_post_id = postos[0]['_key']
|
||||
|
||||
return render_template("answer-post.html", target_post_id=target_post_id)
|
||||
return render_template("answer-post.html", board=board, target_post_id=target_post_id)
|
||||
|
||||
|
||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'mp4', 'webm', 'webp'}
|
||||
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('/post_to_another_post/<post_key>', methods=['POST'])
|
||||
def post_to_post(post_key):
|
||||
@app.route('/<board>/post_to_another_post/<post_key>', methods=['POST'])
|
||||
def post_to_post(board, 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
|
||||
@ -110,13 +206,28 @@ def post_to_post(post_key):
|
||||
print(f'somebody tried to put this inside minio: {file.filename} size: {size}')
|
||||
|
||||
|
||||
postos = db.collection('posts')
|
||||
|
||||
postos = db.collection('posts')
|
||||
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({
|
||||
'texto': data,
|
||||
'parent_post': f'{post_key}'
|
||||
'texto': data,
|
||||
'parent_post': f'{post_key}',
|
||||
'images': [],
|
||||
"thread": thread
|
||||
}, overwrite_mode='update')
|
||||
|
||||
metadata = db.collection('post_parents').insert({
|
||||
@ -125,6 +236,7 @@ def post_to_post(post_key):
|
||||
}, overwrite_mode='update')
|
||||
|
||||
|
||||
#### TODO оптимайз для только тредовых штук
|
||||
cursor = db.aql.execute(
|
||||
"""FOR ppp IN posts
|
||||
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
|
||||
@ -145,15 +257,22 @@ def post_to_post(post_key):
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
|
||||
return render_template("i-posts.html", board=board, host_id=docker_short_id, postos=postos)
|
||||
|
||||
|
||||
|
||||
#### TODO websockets
|
||||
#### TODO sse
|
||||
#### TODO kafka
|
||||
#### TODO shards
|
||||
#### TODO shards
|
||||
#### TODO grpc
|
||||
|
||||
|
||||
|
@ -1,35 +1,54 @@
|
||||
<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">Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
|
||||
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
||||
<form hx-encoding='multipart/form-data' _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||
<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 class="input-field col s6">
|
||||
<input id="file" name="file" type="file" multiple>
|
||||
<label for="file">Upload</label>
|
||||
<progress id='progress' value='0' max='100'></progress>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<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">
|
||||
<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="#answer-post">
|
||||
<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="/post_to_another_post/{{ target_post_id }}"
|
||||
hx-post="/{{board}}/post_to_another_post/{{ target_post_id }}"
|
||||
hx-target="#neu-posts"
|
||||
hx-include="[name='send_this_text'], [name='file']"
|
||||
hx-include="[name='send_this_text'], [name='file']"
|
||||
>
|
||||
Отправить!!
|
||||
<i class="material-icons right">send</i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
<!-- <div class="row">
|
||||
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||
|
23
templates/board-posts.html
Normal file
23
templates/board-posts.html
Normal file
@ -0,0 +1,23 @@
|
||||
{% 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 %}
|
48
templates/create-thread.html
Normal file
48
templates/create-thread.html
Normal file
@ -0,0 +1,48 @@
|
||||
<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,19 +6,45 @@
|
||||
{% 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="#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="col s4">
|
||||
<div class="card-image">
|
||||
<div class="hex-main">
|
||||
|
||||
{% if posto.images | length > 0 %}
|
||||
<div class="col s12">
|
||||
<!-- <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>
|
||||
</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 class="col s8">
|
||||
{% endif %}
|
||||
<!-- <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>
|
||||
@ -26,50 +52,38 @@
|
||||
</span>
|
||||
|
||||
{% if posto.parent_post %}
|
||||
<a class="card-action" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
||||
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
||||
{% endif %}
|
||||
<p>{{ posto.texto }}</p>
|
||||
|
||||
<!-- {% if posto.answers_list[0] | length > 0 %}
|
||||
<br>
|
||||
<p>Ответы:</p>
|
||||
<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 %}
|
||||
{% 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>
|
||||
{% endif %} -->
|
||||
<p>{{ posto.texto }}</p>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="col s12 card-content white-text">
|
||||
{% if posto.parent_post %}
|
||||
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
|
||||
{% endif %}
|
||||
<p>{{ posto.texto }}</p>
|
||||
</div>
|
||||
<div class="col s12">
|
||||
<div class="card-action right">
|
||||
<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="#answer-post" hx-post="/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
|
||||
<a href="#answer-post" hx-post="/{{board}}/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12">
|
||||
<div class="col s12 card-content white-text">
|
||||
<!-- TODO !подгрузка следующего поста в конец треда без перезагрузки всего треда! -->
|
||||
<div class="card-action left">
|
||||
<div class="left">
|
||||
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
|
||||
{% if posto.answers_list[0] | length > 0 %}
|
||||
<p>Ответы:</p>
|
||||
{% 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>
|
||||
<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>
|
||||
{% 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>
|
||||
<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>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
<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>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col s7 m6" id="answer-post">
|
||||
<div class="col s3 m3 " id="aa"></div>
|
||||
<div class="col s7 m6 " id="answer-post">
|
||||
{% include 'answer-post.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,7 +3,12 @@
|
||||
<div class="nav-wrapper purple darken-3">
|
||||
<ul id="nav-mobile" class="left ">
|
||||
<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>
|
||||
<a href="#">Вас закинуло сюда: <span class="new badge blue" data-badge-caption="">{{host_id}}</span></a>
|
||||
</li>
|
||||
|
53
templates/op-posts.html
Normal file
53
templates/op-posts.html
Normal file
@ -0,0 +1,53 @@
|
||||
{% 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