Repository navigation
Conversation
Member
|
Should we start grouping buttons and maybe combine together add to shop list (I'd keep it on top as edits are less frequent), edit and copy? |
Collaborator
Author
I think the grouping is important, but for this PR I think it's not needed anymore since you can easily add a link from the new edit menu. |
4 tasks
A "Copy for a Menu" button on the recipe page puts the bullet that adds
this recipe to a `.menu` on the clipboard, at the amount the page shows:
- @./Lunch/Soup{3%servings} the recipe declares servings
- @./Soup{2} scaled by a factor
- @./Soup{} as written
The path is written as the menu editor's recipe picker writes it (`./`,
forward slashes, no `.cook`), so a pasted line and a picked one look the
same, and the amount is in the forms the menu scaling code reads back.
- The line is built on the server (`templates::menu_line`) from the page's
path, scale and servings, and copied by a small script, so a static site
has the button too.
- Clipboard API on secure origins, the `execCommand` fallback otherwise,
as the shopping list's copy button does; a `role="status"` confirmation
under the button.
- The button comes after Cook, so on a phone it is the one that wraps.
- Strings in all 9 locales; one line in docs/server.md.
Part of cooklang#385 (last comment).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RXA3hAKY9Q8hLCZGeokLPK
LeMyst
force-pushed
the
feat/copy-menu-line
branch
from
October 27, 2026 18:54
525e0af to
3c4686f
Compare
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.
Part of #671 (the last comment on #385).
A comment on #385 asks for a way to copy a recipe's path "in a format that could be pasted into a manually authored .menu file, such as
- @./Lunch/Cheese, tomato and avocado sandwich{1%serving}". The menu editor's recipe picker (#558) covers menus written in the web editor; this is for menus written anywhere else.What changes
A Copy for a Menu button on the recipe page copies the bullet that adds this recipe to a
.menu, at the amount the page shows:/recipe/Risotto(servings: 4)- @./Risotto{4%servings}/recipe/Risotto?servings=6- @./Risotto{6%servings}/recipe/Breakfast/Chocolate Toast Delight(no servings)- @./Breakfast/Chocolate Toast Delight{}…?scale=2- @./Breakfast/Chocolate Toast Delight{2}referencePathwrites it (./, forward slashes, no.cook), so a pasted line and a picked one look the same. The amount uses the formsutil::menu_scalereads back (N%servings, a bare factor, or{}), so the menu then opens the recipe at that amount and the shopping list adds it at that amount.templates::menu_line, from the page's path, scale and servings) and copied by a few lines of script, so a static site has the button too.file://, theexecCommand('copy')fallback the shopping list's copy button already uses. Arole="status"confirmation ("Menu line copied") appears under the button for 2.5 s.docs/server.md.Menus get no such button here: a menu inside a menu (
@./Brunch.menu{}) is not followed by the shopping list today and belongs to the separate "menu as a day's meal" change.Screenshots
Tests
web::templates::menu_line_tests): servings, factor and{}amounts; the path forms the picker normalises (.cook,./,/, backslashes, commas in names); the line parses back as a reference to the same recipe with the same amount.tests/build.rs: the static recipe page carries the line (- @./Breakfast/Easy Pancakes{2%servings}).tests/e2e/copy-menu-line.spec.ts, clipboard permissions granted): servings, after the stepper, a sub-folder recipe without servings at ×1 and ×2, the confirmation clearing, axe.cargo fmt,cargo clippy --all-targets(also--no-default-features, no new warnings) andcargo testclean. Full chromium Playwright run: 252 passed, 5 skipped. After moving the button behind Cook,recipe-scaling.spec.ts › should send the scale when adding to shopping listfailed once and passed on repeat (1 flaky out of 63 with--repeat-each=3); it registers its route after the scale navigation and does not touch this button.🤖 Generated with Claude Code
https://claude.ai/code/session_01RXA3hAKY9Q8hLCZGeokLPK