Fix instance settings prefs JS 404 on static route.
Register instance_settings_prefs.js (and options_panel.js) in install_instance_theme_static; add delegated click handlers for embed lazy tabs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -373,6 +373,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
function installDelegatedHandlers() {
|
||||
if (document.documentElement.dataset.prefsDelegateBound === "1") return;
|
||||
document.documentElement.dataset.prefsDelegateBound = "1";
|
||||
document.addEventListener("click", (ev) => {
|
||||
const target = ev.target;
|
||||
if (!(target instanceof Element)) return;
|
||||
if (target.closest("#display-prefs-save")) {
|
||||
ev.preventDefault();
|
||||
void saveDisplayPrefs();
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-save")) {
|
||||
ev.preventDefault();
|
||||
void saveEnvConfig(false);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-save-restart")) {
|
||||
ev.preventDefault();
|
||||
void saveEnvConfig(true);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-reload")) {
|
||||
ev.preventDefault();
|
||||
void loadEnvConfig(true);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#pwd-save-btn")) {
|
||||
ev.preventDefault();
|
||||
void savePassword();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindClickOnce(id, handler) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el || el.dataset.bound === "1") return;
|
||||
@@ -389,6 +422,7 @@
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
installDelegatedHandlers();
|
||||
bindEvents();
|
||||
loadDisplayPrefsForm(false);
|
||||
loadEnvConfig(false);
|
||||
|
||||
@@ -69,6 +69,8 @@ def install_instance_theme_static(app) -> None:
|
||||
"instance_page.css": "text/css; charset=utf-8",
|
||||
"instance_embed.js": "application/javascript; charset=utf-8",
|
||||
"instance_live.js": "application/javascript; charset=utf-8",
|
||||
"instance_settings_prefs.js": "application/javascript; charset=utf-8",
|
||||
"options_panel.js": "application/javascript; charset=utf-8",
|
||||
"order_entry_model.js": "application/javascript; charset=utf-8",
|
||||
"focus_chart_page.js": "application/javascript; charset=utf-8",
|
||||
"focus_chart_page.css": "text/css; charset=utf-8",
|
||||
|
||||
@@ -103,7 +103,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
|
||||
<script>
|
||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||
</script>
|
||||
<script src="/static/instance_settings_prefs.js?v=11"></script>
|
||||
<script src="/static/instance_settings_prefs.js?v=12"></script>
|
||||
<script src="/static/instance_live.js?v=4"></script>
|
||||
<script src="/static/instance_embed.js?v=21"></script>
|
||||
</body>
|
||||
|
||||
@@ -2038,6 +2038,6 @@ setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }})
|
||||
<script>
|
||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||
</script>
|
||||
<script src="/static/instance_settings_prefs.js?v=11"></script>
|
||||
<script src="/static/instance_settings_prefs.js?v=12"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user