My directory browsing app shows lists of file. If the item is a folder,
show a folder icon and link to the action that shows directory contents.
If the item is a graphics file, show a thumbnail and link to a larger
view. If the item is a non-graphics file, show an appropriate icon and
stream the file if the link is clicked.
The controller creates an array of arrays of items in the current
folder, with flags indicating the type of the item. The view iterates
over the array to create the page.
But the view code looks a lot like programming code, with if-then and
case statements to handle all the possibilities. It feels like it
belongs in the controller. I could remove some code into partials and
helpers, but that’s really just distributing the ugliness around.
On the other hand, using a controller to build an array of html links
doesn’t seem right either.
Philosophically, which way should I go?