feat(options): upload-a-file facility also under the logos row of Top of the page
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 <vibe@mistral.ai>
This commit is contained in:
parent
1d0161374b
commit
4f19b1a26f
2 changed files with 50 additions and 1 deletions
|
|
@ -1192,6 +1192,21 @@ $(function () {
|
||||||
addUploadedImageToSelectors(data && data.file);
|
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
|
// 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
|
// selectable immediately, without a full page reload. Falls back to a reload if the
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
|
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
|
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. #}
|
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') }}
|
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||||
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
||||||
|
|
||||||
|
|
@ -481,6 +481,40 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="row action_hide_on_inherit"><div class="col-12"><hr class="logo-columns-hr"></div></div>
|
<div class="row action_hide_on_inherit"><div class="col-12"><hr class="logo-columns-hr"></div></div>
|
||||||
|
{# 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 #}
|
||||||
|
<div class="row action_hide_on_inherit upload-file-row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="ls-space margin bottom-15 top-15">
|
||||||
|
<div class="row ls-space margin bottom-15">
|
||||||
|
<div class="col-12 mb-1">
|
||||||
|
<label class="form-label" for="upload_image_frontend_top">{{ sprintf(gT("Upload an image (maximum size: %d MB):"), templateConfiguration.maxFileSize / 1024 / 1024) }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<span id="fileselector_frontend_top">
|
||||||
|
<label class="btn btn-outline-secondary" for="upload_image_frontend_top" role="button" tabindex="0">
|
||||||
|
<input class="d-none" id="upload_image_frontend_top" name="upload_image_frontend_top" type="file">
|
||||||
|
<i class="ri-upload-fill ls-space margin right-10"></i>
|
||||||
|
{{ gT("Upload") }}
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="progress">
|
||||||
|
<div id="upload_progress_frontend_top" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
|
||||||
|
<span class="visually-hidden">0%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% elseif key not in aLogoKeys %}
|
{% elseif key not in aLogoKeys %}
|
||||||
{% set bQuestionsPane = tab.category == 'Questions' %}
|
{% set bQuestionsPane = tab.category == 'Questions' %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue