From cddd4baa8a697f77f56ed1a572725e68b7c42785 Mon Sep 17 00:00:00 2001 From: Lephe Date: Thu, 2 Nov 2023 22:54:51 +0100 Subject: [PATCH] shoutbox: update chat and show it on homepage --- app/routes/chat.py | 11 ----------- app/static/css/shoutbox.css | 1 + app/static/scripts/v5shoutbox_ui.js | 1 + app/templates/base/scripts.html | 1 - app/templates/chat.html | 1 + app/templates/index.html | 6 ++---- app/utils/render.py | 6 ++++++ submodules/v5shoutbox | 2 +- 8 files changed, 12 insertions(+), 17 deletions(-) create mode 120000 app/static/scripts/v5shoutbox_ui.js diff --git a/app/routes/chat.py b/app/routes/chat.py index 1498aa4..4b3389f 100644 --- a/app/routes/chat.py +++ b/app/routes/chat.py @@ -5,21 +5,10 @@ from flask import send_file, url_for @app.route('/chat') def chat(): return render('chat.html', - styles=[ - '+css/v5shoutbox.css', - '+css/shoutbox.css'], scripts=[ '-scripts/trigger_menu.js', '-scripts/editor.js']) -@app.route('/v5shoutbox.js') -def v5shoutbox_js(): - return send_file('static/scripts/v5shoutbox.js') - -@app.route('/v5shoutbox_irc.js') -def v5shoutbox_irc_js(): - return send_file('static/scripts/v5shoutbox_irc.js') - @app.route('/v5shoutbox_worker.js') def v5shoutbox_worker_js(): return send_file('static/scripts/v5shoutbox_worker.js') diff --git a/app/static/css/shoutbox.css b/app/static/css/shoutbox.css index 94224c1..6ef83fe 100644 --- a/app/static/css/shoutbox.css +++ b/app/static/css/shoutbox.css @@ -3,4 +3,5 @@ --shoutbox-border-color: var(--border, #d8d8d8); --shoutbox-header-bg: var(--background-alt); --shoutbox-link-color: var(--links); + height: 240px; } diff --git a/app/static/scripts/v5shoutbox_ui.js b/app/static/scripts/v5shoutbox_ui.js new file mode 120000 index 0000000..c7047ef --- /dev/null +++ b/app/static/scripts/v5shoutbox_ui.js @@ -0,0 +1 @@ +../../../submodules/v5shoutbox/v5shoutbox_ui.js \ No newline at end of file diff --git a/app/templates/base/scripts.html b/app/templates/base/scripts.html index 7086f4a..15194f4 100644 --- a/app/templates/base/scripts.html +++ b/app/templates/base/scripts.html @@ -1,7 +1,6 @@ {% for s in scripts %} {% endfor %} - {% for m in modules %} {% endfor %} diff --git a/app/templates/chat.html b/app/templates/chat.html index ecf2d28..7e1fb69 100644 --- a/app/templates/chat.html +++ b/app/templates/chat.html @@ -4,6 +4,7 @@ {% include "base/head.html" with context %} +
{% include "widgets/v5shoutbox.html" %} {% include "base/scripts.html" %} diff --git a/app/templates/index.html b/app/templates/index.html index 96f4849..3e12405 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -60,10 +60,8 @@
  • Voir toutes les news

  • -
    -
    - Ici y’aura la shoutbox (plus tard) -
    +
    + {% include "widgets/v5shoutbox.html" %}

    Projets du moment

    diff --git a/app/utils/render.py b/app/utils/render.py index 348a302..bc9ca27 100644 --- a/app/utils/render.py +++ b/app/utils/render.py @@ -20,6 +20,9 @@ def render(*args, styles=[], scripts=[], modules=[], **kwargs): 'css/programs.css', 'css/editor.css', 'css/search.css', + # The order of these two is important; shoutbox.css overrides + 'css/v5shoutbox.css', + 'css/shoutbox.css', ] scripts_ = [ 'scripts/trigger_menu.js', @@ -29,6 +32,9 @@ def render(*args, styles=[], scripts=[], modules=[], **kwargs): 'scripts/filter.js', 'scripts/tag_selector.js', 'scripts/editor.js', + 'scripts/v5shoutbox_irc.js', + 'scripts/v5shoutbox_ui.js', + 'scripts/v5shoutbox.js', ] modules_ = [ 'scripts/emoji-picker-element/index.js', diff --git a/submodules/v5shoutbox b/submodules/v5shoutbox index 4e3118c..2317e97 160000 --- a/submodules/v5shoutbox +++ b/submodules/v5shoutbox @@ -1 +1 @@ -Subproject commit 4e3118c779ce3048182033f79206b5f57e3d13a3 +Subproject commit 2317e973d4464e81a3838159c987597c3ca2a927