From 39aa0a9687db81e814b03651aa693f75a37ccd96 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Fri, 14 Jul 2023 01:52:00 +1000 Subject: [PATCH] check posts --- app.py | 12 ++++++------ templates/board.html | 3 +-- templates/interactive-posts.html | 5 +---- templates/main-page.html | 12 +----------- templates/navbar.html | 13 +++++++++++++ 5 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 templates/navbar.html diff --git a/app.py b/app.py index ccce6b8..31fdb9a 100644 --- a/app.py +++ b/app.py @@ -23,6 +23,7 @@ js.build() +docker_short_id = socket.gethostname() arango_client = ArangoClient(hosts='https://arango.vdk2ch.ru') db = arango_client.db('board1', username='root', password='stolendick527') @@ -45,7 +46,6 @@ def healthz(): @app.route("/") def homepage(): - docker_short_id = socket.gethostname() return render_template("main-page.html", host_id=docker_short_id, boards=board_list) @@ -53,7 +53,7 @@ def homepage(): def page_board(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) + return render_template("board.html", host_id=docker_short_id, board_id=board_id, boards=board_list, board_threads=b_threads) @@ -64,7 +64,7 @@ def page_posts_from_db(): postos = [ p for p in postos] postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) - return render_template("interactive-posts.html", postos=postos) + return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos) @app.route('/post_my_post/', methods=['POST']) @@ -101,7 +101,7 @@ def post_a_post(post_key): postos = db.collection('posts') postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) - return render_template("i-posts.html", postos=postos) + return render_template("i-posts.html", host_id=docker_short_id, postos=postos) # @app.route('/post_my_file', method=['POST']) @@ -120,14 +120,14 @@ def search_todo(): search_term = request.form.get("search") if not len(search_term): - return render_template("todo.html", todos=[]) + return render_template("todo.html", host_id=docker_short_id, todos=[]) res_todos = [] for todo in todos: if search_term in todo["title"]: res_todos.append(todo) - return render_template("todo.html", todos=res_todos) + return render_template("todo.html", host_id=docker_short_id, todos=res_todos) ### /stolen diff --git a/templates/board.html b/templates/board.html index 250e8fd..c12d10d 100644 --- a/templates/board.html +++ b/templates/board.html @@ -19,8 +19,7 @@ - -
  • + {% include 'posts.html' %} diff --git a/templates/interactive-posts.html b/templates/interactive-posts.html index 0ea1ab7..15a9558 100644 --- a/templates/interactive-posts.html +++ b/templates/interactive-posts.html @@ -3,10 +3,7 @@ {% block content %} - +{% include 'navbar.html' %}
    diff --git a/templates/main-page.html b/templates/main-page.html index 5dc5012..ccb89f2 100644 --- a/templates/main-page.html +++ b/templates/main-page.html @@ -2,17 +2,7 @@ {% block content %} - +{% include 'navbar.html' %}
    diff --git a/templates/navbar.html b/templates/navbar.html new file mode 100644 index 0000000..8ba986f --- /dev/null +++ b/templates/navbar.html @@ -0,0 +1,13 @@ + + + \ No newline at end of file