From: Chris Fulljames Date: Mon, 17 Feb 2025 01:18:45 +0000 (-0500) Subject: Initial work on ajaxification X-Git-Url: https://littlesong.place/gitweb/?a=commitdiff_plain;h=d80a446a78253210ec37b51dc784b67b92c18162;p=littlesongplace.git Initial work on ajaxification --- diff --git a/main.py b/main.py index ada6574..3e16b75 100644 --- a/main.py +++ b/main.py @@ -929,7 +929,8 @@ def get_current_user_playlists(): @app.context_processor def inject_global_vars(): - return dict(gif_data=get_gif_data(), current_user_playlists=get_current_user_playlists()) + use_json = request.args.get("request-type", None) == "ajax" + return dict(gif_data=get_gif_data(), current_user_playlists=get_current_user_playlists(), use_json=use_json, dumps=json.dumps) ################################################################################ diff --git a/templates/base.html b/templates/base.html index 693afd3..91759b7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,6 +9,29 @@ {% block head %} {% endblock %} + diff --git a/templates/index.html b/templates/index.html index f04887a..64e53c9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% if use_json %}{% extends "base.json" %}{% else %}{% extends "base.html" %}{% endif %} {% block title %}Little Song Place{% endblock %} diff --git a/todo.txt b/todo.txt index 646d236..8f64c6b 100644 --- a/todo.txt +++ b/todo.txt @@ -1,10 +1,13 @@ NOW - -SOON -- Break up main.py, test_offline.py - AJAX pages so songs can play during navigation + - Nav bar + - Forms + - Back (history stack) + - Other on-site links (songs, profiles, tags, etc.) +- Break up main.py, test_offline.py - Pinned profile playlists +SOON - Image support in comments, descriptions, bios, etc. - Player minimize button - Shuffle all page