some structure
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-03 23:45:49 +10:00
parent e7a2a6cac3
commit da998af863
4 changed files with 63 additions and 4 deletions

5
app.py
View File

@ -3,6 +3,7 @@ from flask_assets import Bundle, Environment
from todo import todos from todo import todos
from boards import board_list from boards import board_list
from threads import threads_lists from threads import threads_lists
from threads_with_posts import open_threads
import socket import socket
@ -43,7 +44,9 @@ def homepage():
### stolen ### stolen
@app.route("/boards/<board_id>") @app.route("/boards/<board_id>")
def page_board(board_id): def page_board(board_id):
return render_template("board.html", board_id=board_id, boards=board_list, board_threads=threads_lists[board_id])
b_threads = [ open_threads[thread_id] for thread_id in open_threads if thread_id in threads_lists[board_id]]
return render_template("board.html", board_id=board_id, boards=board_list, board_threads=b_threads)
### stolen ### stolen

View File

@ -24,13 +24,24 @@
<table class="border-collapse w-small w-2/3 mx-auto"> <table class="border-collapse w-small w-2/3 mx-auto">
<thead> <thead>
<tr> <tr>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">#</th> <th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">номер треда</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">номер поста</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">автор(ка)</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">пикча эта ваша</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">текст</th>
</tr> </tr>
</thead> </thead>
<tbody id="thread-results"> <tbody id="thread-results">
{% for thread in board_threads %} {% for thread in board_threads %}
<tr class="bg-white lg:hover:bg-gray-100 flex lg:table-row flex-row lg:flex-row flex-wrap lg:flex-no-wrap mb-10 lg:mb-0"> <tr class="bg-white lg:hover:bg-gray-100 flex lg:table-row flex-row lg:flex-row flex-wrap lg:flex-no-wrap mb-10 lg:mb-0">
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{thread}}</td> <td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{thread.thread_num}}</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{thread.post_num}}</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{thread.name}}</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">
<img src="https://static.vdk2ch.ru/thread-pics/{{thread.pic_link}}" alt="" width="200" height="200">
</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{thread.txt}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -22,7 +22,7 @@
</ul> </ul>
</div> </div>
</nav> </nav>
<img src="http://static.vdk2ch.ru:15555/test-public/sin.jpg"> <img src="https://static.vdk2ch.ru/test-public/sin.jpg">
{% endblock content %} {% endblock content %}

45
threads_with_posts.py Normal file
View File

@ -0,0 +1,45 @@
# <id>: {<post_num>, <pic_link>, <texto>, <name>}
open_threads = {
'123': {
'thread_num': '123',
'post_num': '9999',
'pic_link': '16216445863900.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'124': {
'thread_num': '124',
'post_num': '456',
'pic_link': '16672846165910.png',
'txt': 'Test',
'name': 'anonius'
},
'1': {
'thread_num': '123',
'post_num': '1',
'pic_link': '16211265989190.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'44': {
'thread_num': '44',
'post_num': '12',
'pic_link': '15937598937440.png',
'txt': 'I hate my brother-nation..',
'name': 'Владимир Владимирович'
},
'99': {
'thread_num': '99',
'post_num': '55',
'pic_link': 'Экран-смерти.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'1230': {
'thread_num': '1230',
'post_num': '1234',
'pic_link': '15906018690140.png',
'txt': '33333!',
'name': 'SIRNA'
}
}