From 72c214c92cf9044fbe02c49606773bb9e340d5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net> Date: Sun, 17 Nov 2024 16:43:51 +0100 Subject: [PATCH] fix: backend menu bug following MR !21 --- src/wgl.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wgl.jl b/src/wgl.jl index c21d40f..9bdb2a7 100644 --- a/src/wgl.jl +++ b/src/wgl.jl @@ -905,7 +905,7 @@ end function filemenu(controller; kwargs...) wd = getworkingdir(controller) dir = joinpath(wd.root, wd.path[]) - browser = FileBrowser(dir; root=wd.root, upload_button=true) + browser = FileBrowser(dir; root=wd.root, upload_button=false) on(FileBrowsers.selectedfile(browser)) do file tryopenfile(controller, file; reload=true) end @@ -916,9 +916,11 @@ function filemenu(controller; kwargs...) wd.path[] = dir wd.content[] = [d for (_, d) in browser.model.content[]] end - on(FilePickers.uploadedfile(browser)) do fileinfo - filepath = joinpath(workingdir[], fileinfo["name"]) - saveinputfile(filepath, fileinfo["content"]) + if FileBrowsers.supports_upload(browser) + on(FilePickers.uploadedfile(browser)) do fileinfo + filepath = joinpath(workingdir[], fileinfo["name"]) + saveinputfile(filepath, fileinfo["content"]) + end end return FileMenu(gethub(controller), browser) end @@ -990,7 +992,7 @@ end function Bonito.jsrender(session::Session, bs::BackendMenu) node = lowerdom(session, bs) onjs(session, bs.backends.model_instances, js"""(options) => { - select = document.querySelector($(dom_selector(bs)) + ' > select'); + select = document.querySelectorAll($(dom_selector(bs)) + ' > select')[1]; LarvaTagger.updateSelectOptions(select, options); }""") return node -- GitLab