From 4f19b1a26fb47099c78d0867c9c49009ae90c09d Mon Sep 17 00:00:00 2001 From: Tammo ter Hark Date: Thu, 26 Nov 2026 19:46:18 +0100 Subject: [PATCH] feat(options): upload-a-file facility also under the logos row of Top of the page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Row 139: the "Upload an image" widget is no longer tied to the Images tab — a new row with a single element (the upload control + progress bar) is rendered directly under the logos row of the "Top of the page" tab, with its own ids (#upload_image_frontend_top / #upload_progress_frontend_top). options.js binds a second BindUpload instance on the same shared #upload_frontend form for those ids, so both widgets upload and both feed addUploadedImageToSelectors (a fresh upload becomes selectable in the image dropdowns immediately). The original Images-tab widget is unchanged. OPTIONS_JS_TOKEN -> 20261126.16. Verified: render tc=648 (new ids exactly once, original id once, widget sits after logo-columns-hr, divs 324/324, options.js?v=20261126.16), jsdom 7/7 incl. new pins (id uniqueness, position under the logos row, change handler bound on BOTH file inputs), export exit 0. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- options/options.js | 15 +++++++++++++++ options/options.twig | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/options/options.js b/options/options.js index 4e39775..c56e2e0 100644 --- a/options/options.js +++ b/options/options.js @@ -1192,6 +1192,21 @@ $(function () { addUploadedImageToSelectors(data && data.file); } }); + // row 139: second upload widget in the "Top of the page" tab (under the logos + // row) — own input/progress ids, same shared upload form; uploads land in the + // same image selectors via addUploadedImageToSelectors + new BindUpload({ + form: '#upload_frontend', + input: '#upload_image_frontend_top', + progress: '#upload_progress_frontend_top', + onBeforeSend: function () { + $('.simple-template-edit-loading').css('display', 'block'); + }, + onSuccess: function (inputId, data) { + $('.simple-template-edit-loading').css('display', 'none'); + addUploadedImageToSelectors(data && data.file); + } + }); // Adds a freshly uploaded image to the theme options image selectors so it becomes // selectable immediately, without a full page reload. Falls back to a reload if the diff --git a/options/options.twig b/options/options.twig index 65f3bdb..4f08b30 100644 --- a/options/options.twig +++ b/options/options.twig @@ -43,7 +43,7 @@ heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control). Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever options/options.js changes, so every browser fetches the new file once. #} -{% set OPTIONS_JS_TOKEN = '20261126.15' %} +{% set OPTIONS_JS_TOKEN = '20261126.16' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} @@ -481,6 +481,40 @@ {% endfor %}

+ {# row 139: a new row directly under the logos row, with just one + element: the file-upload facility (same widget as in the Images + tab, but with its own ids so both work — options.js binds a + BindUpload per input/progress pair on the shared #upload_frontend + form). The actual upload form is rendered by themeOptions/update.php #} +
+
+
+
+
+ +
+
+ + + +
+
+
+
+
+
+ 0% +
+
+
+
+
+
+
{% elseif key not in aLogoKeys %} {% set bQuestionsPane = tab.category == 'Questions' %}