and again
@@ -0,0 +1 @@
|
||||
@font-face{font-family:"django-filer-iconfont";src:url("../fonts/django-filer-iconfont.eot?v=3.2.0");src:url("../fonts/django-filer-iconfont.eot?v=3.2.0#iefix") format("eot"),url("../fonts/django-filer-iconfont.woff2?v=3.2.0") format("woff2"),url("../fonts/django-filer-iconfont.woff?v=3.2.0") format("woff"),url("../fonts/django-filer-iconfont.ttf?v=3.2.0") format("truetype"),url("../fonts/django-filer-iconfont.svg?v=3.2.0#django-filer-iconfont") format("svg");font-weight:normal;font-style:normal}.filer-icon{display:inline-block;font-family:django-filer-iconfont;font-size:inherit;text-rendering:auto;line-height:1;transform:translate(0, 0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.filer-icon-arrow-down:before{content:"\E001"}.filer-icon-caret-down:before{content:"\E002"}.filer-icon-chevron-right:before{content:"\E003"}.filer-icon-download:before{content:"\E004"}.filer-icon-expand:before{content:"\E005"}.filer-icon-link:before{content:"\E006"}.filer-icon-move-to-folder:before{content:"\E007"}.filer-icon-picture:before{content:"\E008"}.filer-icon-remove-selection:before{content:"\E009"}.filer-icon-select:before{content:"\E00A"}.filer-icon-th-large:before{content:"\E00B"}.filer-icon-th-list:before{content:"\E00C"}.filer-icon-upload:before{content:"\E00D"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["components/_iconography.scss"],"names":[],"mappings":"AAIA,WACI,mCAAA,CACA,qDAAA,CACA,0WAAA,CAKA,kBAAA,CACA,iBAAA,CAGJ,YACI,oBAAA,CACA,iCAAA,CACA,iBAAA,CACA,mBAAA,CACA,aAAA,CACA,yBAAA,CACA,kCAAA,CACA,iCAAA,CAqDA,8BACI,eAAA,CADJ,8BACI,eAAA,CADJ,iCACI,eAAA,CADJ,4BACI,eAAA,CADJ,0BACI,eAAA,CADJ,wBACI,eAAA,CADJ,kCACI,eAAA,CADJ,2BACI,eAAA,CADJ,oCACI,eAAA,CADJ,0BACI,eAAA,CADJ,4BACI,eAAA,CADJ,2BACI,eAAA,CADJ,0BACI,eAAA","file":"../admin_filer.cms.icons.css","sourcesContent":["//######################################################################################################################\n// #ICONOGRAPHY#\n\n// default font file generated by gulp\n@font-face {\n font-family: \"django-filer-iconfont\";\n src: url(\"../fonts/django-filer-iconfont.eot?v=3.2.0\");\n src: url(\"../fonts/django-filer-iconfont.eot?v=3.2.0#iefix\") format(\"eot\"),\n url(\"../fonts/django-filer-iconfont.woff2?v=3.2.0\") format(\"woff2\"),\n url(\"../fonts/django-filer-iconfont.woff?v=3.2.0\") format(\"woff\"),\n url(\"../fonts/django-filer-iconfont.ttf?v=3.2.0\") format(\"truetype\"),\n url(\"../fonts/django-filer-iconfont.svg?v=3.2.0#django-filer-iconfont\") format(\"svg\");\n font-weight: normal;\n font-style: normal;\n}\n\n%icon {\n display: inline-block;\n font-family: django-filer-iconfont;\n font-size: inherit;\n text-rendering: auto;\n line-height: 1;\n transform: translate(0, 0);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n@function icon-char($filename) {\n $char: \"\";\n\n @if $filename == arrow-down {\n $char: \"E001\";\n }\n @if $filename == caret-down {\n $char: \"E002\";\n }\n @if $filename == chevron-right {\n $char: \"E003\";\n }\n @if $filename == download {\n $char: \"E004\";\n }\n @if $filename == expand {\n $char: \"E005\";\n }\n @if $filename == link {\n $char: \"E006\";\n }\n @if $filename == move-to-folder {\n $char: \"E007\";\n }\n @if $filename == picture {\n $char: \"E008\";\n }\n @if $filename == remove-selection {\n $char: \"E009\";\n }\n @if $filename == select {\n $char: \"E00A\";\n }\n @if $filename == th-large {\n $char: \"E00B\";\n }\n @if $filename == th-list {\n $char: \"E00C\";\n }\n @if $filename == upload {\n $char: \"E00D\";\n }\n\n @return $char;\n}\n\n.filer-icon {\n @extend %icon;\n}\n@mixin icon($filename, $insert: before) {\n &:#{$insert} {\n content: #{\"\\\"\\\\\"}#{icon-char($filename) + \"\\\"\"};\n }\n}\n\n// #####################################################################################################################\n// #ICONS:start#\n// use unicode characters for accessibility reasons and use aria-hidden=\"true\" for decorative icons\n// DOCS: http://filamentgroup.com/lab/bulletproof_icon_fonts.html\n\n.filer-icon-arrow-down {\n @include icon(arrow-down);\n}\n\n.filer-icon-caret-down {\n @include icon(caret-down);\n}\n\n.filer-icon-chevron-right {\n @include icon(chevron-right);\n}\n\n.filer-icon-download {\n @include icon(download);\n}\n\n.filer-icon-expand {\n @include icon(expand);\n}\n\n.filer-icon-link {\n @include icon(link);\n}\n\n.filer-icon-move-to-folder {\n @include icon(move-to-folder);\n}\n\n.filer-icon-picture {\n @include icon(picture);\n}\n\n.filer-icon-remove-selection {\n @include icon(remove-selection);\n}\n\n.filer-icon-select {\n @include icon(select);\n}\n\n.filer-icon-th-large {\n @include icon(th-large);\n}\n\n.filer-icon-th-list {\n @include icon(th-list);\n}\n\n.filer-icon-upload {\n @include icon(upload);\n}\n"]}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="512"
|
||||
height="512"
|
||||
fill="currentColor"
|
||||
class="bi bi-arrow-down"
|
||||
viewBox="0 0 512 512"
|
||||
version="1.1"
|
||||
id="svg11"
|
||||
sodipodi:docname="arrow-down.svg"
|
||||
inkscape:version="1.2.2 (b0a84865, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs15" />
|
||||
<sodipodi:namedview
|
||||
id="namedview13"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.91803279"
|
||||
inkscape:cx="255.98214"
|
||||
inkscape:cy="7.625"
|
||||
inkscape:window-width="1344"
|
||||
inkscape:window-height="668"
|
||||
inkscape:window-x="54"
|
||||
inkscape:window-y="38"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg11" />
|
||||
<path
|
||||
id="path9"
|
||||
d="M 255.99994,11.9998 A 17.428676,17.428676 0 0 0 238.57126,29.42848 V 440.50016 L 128.89314,330.82202 a 17.450692,17.450692 0 0 0 -24.64523,24.64527 L 243.67732,494.8967 a 17.428676,17.428676 0 0 0 24.64523,0 L 407.75198,355.46729 A 17.450692,17.450692 0 0 0 383.10671,330.82202 L 273.42861,440.50016 V 29.42848 A 17.428676,17.428676 0 0 0 255.99994,11.9998 Z"
|
||||
style="stroke-width:34.8574" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-down-fill" viewBox="0 0 16 16">
|
||||
<path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 266 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 292 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-download" viewBox="0 0 16 16">
|
||||
<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/>
|
||||
<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 428 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrows-angle-expand" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707zm4.344-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 463 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16">
|
||||
<path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>
|
||||
<path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243L6.586 4.672z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-folder" viewBox="0 0 16 16">
|
||||
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4H2.19zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 557 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-image" viewBox="0 0 16 16">
|
||||
<path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/>
|
||||
<path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 411 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 333 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 312 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-border-all" viewBox="0 0 160 160">
|
||||
<path d="M0 0h160v160H0V0zm10 10v65h65V10H10zm75 0v65H150V10H85zM150 85H85V150H150V85zM75 150V85H10V150h65z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 251 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-list-task" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M2 2.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5H2zM3 3H2v1h1V3z"/>
|
||||
<path d="M5 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM5.5 7a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1h-9zm0 4a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1h-9z"/>
|
||||
<path fill-rule="evenodd" d="M1.5 7a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V7zM2 7h1v1H2V7zm0 3.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5H2zm1 .5H2v1h1v-1z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 648 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-upload-fill" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M8 0a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 4.095 0 5.555 0 7.318 0 9.366 1.708 11 3.781 11H7.5V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V11h4.188C14.502 11 16 9.57 16 7.773c0-1.636-1.242-2.969-2.834-3.194C12.923 1.999 10.69 0 8 0zm-.5 14.5V11h1v3.5a.5.5 0 0 1-1 0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 523 B |
@@ -0,0 +1,22 @@
|
||||
/*global opener */
|
||||
(function () {
|
||||
'use strict';
|
||||
const dataElement = document.getElementById('django-admin-popup-response-constants');
|
||||
let initData;
|
||||
|
||||
if (dataElement) {
|
||||
initData = JSON.parse(dataElement.dataset.popupResponse);
|
||||
switch (initData.action) {
|
||||
case 'change':
|
||||
// Specific function for file editing popup opened from widget
|
||||
opener.dismissRelatedImageLookupPopup(window, initData.new_value, null, initData.obj, null);
|
||||
break;
|
||||
case 'delete':
|
||||
opener.dismissDeleteRelatedObjectPopup(window, initData.value);
|
||||
break;
|
||||
default:
|
||||
opener.dismissAddRelatedObjectPopup(window, initData.value, initData.obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,57 @@
|
||||
/*!
|
||||
* Dropzone.js
|
||||
* https://www.dropzonejs.com/
|
||||
*/
|
||||
LICENSE
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2021 Matias Meno <m@tias.me>
|
||||
Logo (c) 2015 "1910" www.weare1910.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* Mediator.js
|
||||
* https://github.com/ajacksified/Mediator.js
|
||||
*/
|
||||
MIT License Terms
|
||||
=================
|
||||
|
||||
Copyright (c) 2013 Jack Lawson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,30 @@
|
||||
// Admin File Widget JavaScript
|
||||
'use strict';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Find all file widgets and clean up "add new" buttons
|
||||
const cleanupAddButtons = () => {
|
||||
document.querySelectorAll('.filer-widget').forEach((widget) => {
|
||||
const hiddenInput = widget.querySelector('input[type="text"][id]');
|
||||
if (hiddenInput) {
|
||||
const widgetId = hiddenInput.id;
|
||||
const addButton = document.querySelector(`#add_${widgetId}`);
|
||||
if (addButton) {
|
||||
addButton.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
cleanupAddButtons();
|
||||
|
||||
// Also handle dynamically added widgets (e.g., in inline formsets)
|
||||
const observer = new MutationObserver(() => {
|
||||
cleanupAddButtons();
|
||||
});
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
// Admin Folder Widget JavaScript
|
||||
'use strict';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const initFolderWidget = (widget) => {
|
||||
const clearButton = widget.querySelector('.filerClearer');
|
||||
const input = widget.querySelector('input[type="text"]');
|
||||
const folderName = widget.querySelector('.description_text');
|
||||
const thumbnailImg = widget.querySelector('.thumbnail_img');
|
||||
const addFolderButton = widget.querySelector('.related-lookup');
|
||||
|
||||
if (!clearButton || !input) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid duplicate initialization
|
||||
if (clearButton.dataset.initialized) {
|
||||
return;
|
||||
}
|
||||
clearButton.dataset.initialized = 'true';
|
||||
|
||||
clearButton.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (folderName) {
|
||||
folderName.textContent = '';
|
||||
}
|
||||
if (input) {
|
||||
input.removeAttribute('value');
|
||||
input.value = '';
|
||||
}
|
||||
if (thumbnailImg) {
|
||||
thumbnailImg.classList.add('hidden');
|
||||
}
|
||||
clearButton.classList.add('hidden');
|
||||
if (addFolderButton) {
|
||||
addFolderButton.classList.remove('hidden');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Initialize all folder widgets
|
||||
document.querySelectorAll('.filer-dropzone-folder').forEach(initFolderWidget);
|
||||
|
||||
// Handle dynamically added widgets (e.g., in inline formsets)
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((node) => {
|
||||
if (node.nodeType === 1) { // Element node
|
||||
if (node.classList?.contains('filer-dropzone-folder')) {
|
||||
initFolderWidget(node);
|
||||
}
|
||||
// Also check child nodes
|
||||
node.querySelectorAll?.('.filer-dropzone-folder').forEach(initFolderWidget);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||