Repository navigation
feat(ui): show folder.jpg as a folder's picture in the recipe list - #847
Open
SebastienSyd wants to merge 1 commit into
Open
SebastienSyd wants to merge 1 commit into
SebastienSyd wants to merge 1 commit into
Conversation
A folder card shows `folder.jpg` (or .jpeg, .png, .webp) from the folder in place of the 📁 icon, laid out like a recipe card's title picture. The server already serves it through /api/static and `cook build` already copies it. A linked picture outside the collection is skipped, as /api/static would refuse it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #846.
A folder's card in the recipe list shows a picture in place of 📁 when the folder holds a
folder.jpg.folder.jpeg,folder.pngandfolder.webpalso work, tried in that order.Change
src/web/builders.rs: a newfolder_picture(dir)returns the firstFOLDER_PICTURESname that is a file. Directory items inbuild_recipes_templateget it asimage_path, built through the existingget_image_path, so prefixes, URL-encoding and static mode all behave like recipe pictures. On the server, a picture that resolves outside the collection is skipped, becauseonly_pictureswould refuse to serve it (Recipe endpoints and /api/static follow symlinks out of the collection #698).templates/recipes.html: the directory card rendersitem.image_pathin the sameh-48banner asrecipe_card.html, and falls back to the 📁 icon.docs/server.md: a short "Folder pictures" section.Serving needed no changes:
/api/staticalready serves pictures, guests of--recipes-onlyincluded, andcook buildalready copies every picture.No upload UI in this PR. A Picture button on the folder page could follow, re-using the title-picture dialog.
Tests
folder_picture_tests: no picture,folder.jpg, jpg preferred over png, and a directory namedfolder.jpgignored.cook server: the card withfolder.jpggets<img src="/api/static/Dessert/folder.jpg">and a folder without one keeps 📁. The picture comes back as 200image/jpeg.cook server --url-prefix /cook --recipes-only: the card links/cook/api/static/Dessert/folder.jpg, and a guest gets 200.cook build web:folder.jpgis copied andindex.htmllinks./api/static/Dessert/folder.jpg.cargo fmt --allandcargo clippy --all-targets -- -D warningsare clean.cargo testpasses exceptupdate::tests::release_workflow_builds_this_platform, which fails only because I ran it on aarch64 Linux, a platform the release matrix doesn't build.🤖 Generated with Claude Code