I’ve packaged up a very simple behavior for listing files. It’s
I originally created it to allow a radiant user to easily put files
in a directory and have them automatically served on a download page.
It uses Dir.glob to iterate over whichever files you’re interested
in. Here’s the syntax (example currently reproduced at http://
h3. Textile-formatted list of every PNG under /images
- “<r:name />”:<r:uri />
By default, access is limited to files within /public, but this
restriction can easily be altered by editing the valid_dir? method to
suit your needs.
I’ll probably add support for getting more information about the
files (like creation dates or permissions, for example), and I’ll
definitely be adding parameters for customizing the order of output.
I’d love to get whatever feedback people can give me on this. Is it
useful to anyone besides myself? What changes would make it most
useful? Am I doing anything strange or unnecessary in my code that I
could improve upon (for example, concerning my ‘files’ tag definition)?