We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FYI @davidbrochart - Feel free to do a PR, otherwise I will add it when I get time if you're ok with it
Add File browser to gallery as widget.
from pathlib import Path from fasthtml.common import * FILE = "📄" FOLDER = "📁" SPACE = "\u2800" app, rt = fast_app() @rt("/{path:path}") def get(path: str): p1 = Path(path) content1 = {p2.name: p2.is_dir() for p2 in p1.iterdir()} directories = [name for name, is_dir in content1.items() if is_dir] files = [name for name, is_dir in content1.items() if not is_dir] directories.sort() files.sort() content2 = [] if p1.parts: content2.append(P(SPACE * (len(p1.parts) - 1) + "⌄" + FOLDER + p1.name)) spaces = SPACE * len(p1.parts) for name in directories: content2.append(P(spaces + ">" + FOLDER + name, hx_get=f"{path}/{name}", hx_swap="outerHTML")) for name in files: content2.append(P(spaces + SPACE + FILE + name)) return Div(*content2) serve()
The text was updated successfully, but these errors were encountered:
otherwise I will add it when I get time if you're ok with it
Sure, thanks!
Sorry, something went wrong.
No branches or pull requests
FYI @davidbrochart - Feel free to do a PR, otherwise I will add it when I get time if you're ok with it
Add File browser to gallery as widget.
The text was updated successfully, but these errors were encountered: