Commit Graph
24 Commits
Author SHA1 Message Date
Brenda Wallace 6bebff9251 Merge remote-tracking branch 'origin/main' into posts/tiptap-editor-page 2026-10-27 13:55:01 +13:00
Brenda WallaceandDaniel O'Connor 75595350bc Easier recording of harvests from the front page (#5077)
* Implement AddSeedsPicker component and enhance planting selection UI; update styles and serializers for better seed management

* Enhance PlantingPicker component: add hints and titles for harvest and seed actions; update test to reflect changes in seed saving behavior

* Enhance harvest recording: allow harvesting from crops without plantings; update forms and modals for better user experience

* Refactor code structure for improved readability and maintainability

* Remove AddSeedsPicker component and its associated tests

* Add planting picker functionality for harvesting and seed saving

- Introduced PlantingPickersController to handle JSON responses for member's plantings.
- Updated HomeHelper to include crop ID in planting picker properties.
- Refactored PlantPicker and PlantSomethingModal components to support multiple gardens.
- Created PlantingFlow component to manage planting actions (harvest and save seeds).
- Implemented RecordDialog component to handle server-rendered links for harvesting and seed saving.
- Updated various views to include data attributes for triggering the record dialog.
- Added routes for planting picker and corresponding request specs for testing.
- Adjusted styles in _plantings.scss for better layout and spacing.

* Add job management features including job creation and wishlist functionality

* Remove WishlistJobsController and associated views and tests

* Add suggestion links rendering and fix routes formatting

* Refactor AddJobModal and JobPicker components to simplify props and enhance user experience

* Update seed addition test to check dialog presence and current path

* Apply suggestion from @CloCkWeRX

---------

Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2026-10-26 21:38:12 +10:30
Brenda Wallace 334e7a8370 feat: integrate Tiptap editor for post body editing
- Updated post actions menu to link directly to the edit post path.
- Enhanced post form to include a React-based body editor using Tiptap, with a fallback to a plain textarea.
- Added Tiptap dependencies to package.json and updated yarn.lock.
- Created a feature spec to verify navigation to the edit page from the post actions menu.
2026-10-26 15:22:45 +13:00
Brenda Wallace 5aa751f0f3 Refactor crop name fields: replace manual input handling with reusable components for scientific and alternate names, and integrate GBIF name suggestions. 2026-10-20 13:11:49 +13:00
Brenda Wallace 88624d2ac8 Implement alternate names functionality with React component and update related specs 2026-10-20 13:06:04 +13:00
Brenda Wallace 074a72d719 Refactor nursery and planting features: introduce planned and sown scopes, enhance nursery chip component, update views for planned plantings, and improve test coverage for nursery functionality. 2026-10-17 17:57:21 +13:00
Brenda Wallace 099f2f58c1 Merge remote-tracking branch 'origin/main' into nursery 2026-10-17 13:37:22 +13:00
Brenda Wallace ca7fd81439 Tidy/login signup (#4958)
* Add authentication dialogs for sign in and sign up

- Implemented AuthDialog component to manage sign in and sign up modals.
- Created SignInModal and SignUpModal components for handling respective authentication processes.
- Added AuthFields component for reusable form fields and error handling.
- Updated various views to utilize the new authentication dialogs instead of traditional links.
- Enhanced user experience by allowing sign in and sign up actions to occur without full page reloads.
- Added feature specs for testing the functionality of the new dialogs.

* Refactor modals and input fields for improved accessibility and styling; adjust button sizes and text formatting

* Refactor authentication forms and modals for improved usability and accessibility; integrate reCAPTCHA handling and enhance error messaging

* Refactor SignUpModal layout for improved responsiveness and accessibility; organize fields into rows and enhance styling

* Refactor session view spec to streamline field checks; remove redundant test and retain essential content expectations
2026-10-17 09:26:39 +10:30
Brenda Wallace 747efe4b4a Implement nursery feature: add nursery management actions in GardensController, create NurseryPlanter component, update views for nursery setup, and enhance member model for nursery acceptance and decline. 2026-10-16 23:38:20 +13:00
Brenda WallaceandClaude Sonnet 5.5 b7dbb84ebd Add a garden and plant from the home page without leaving it
The garden dialog now adds a garden as well as edits one (new.json and
create.json on GardensController), and a GardenPicker button opens it from the
home page. A plant_picker helper replaces the home page's separate plant
links and the plant_button partial. The plant dialog asks when it was
planted (Today, Yesterday, Enter date), using a WhenPicker shared with the
harvest dialog. Members with no garden still get the full-page plant link.

Part of #4933

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 22:21:26 +13:00
Brenda Wallace c8c32014bb tidying up, as react components 2026-10-16 17:32:09 +13:00
Brenda Wallace 5926047199 Implement SeedStack component and enhance seed display with owner avatars and improved styles 2026-10-16 17:32:09 +13:00
Brenda Wallace 3b06325e62 Add friends and neighbours feature with member dismissal functionality
- Implement RecentActivity service to track recent planting, harvesting, and trading events.
- Enhance TimelineService to include garden layouts in event queries.
- Update navigation menu to include a link to friends and neighbours.
- Create member card partial for displaying gardener information.
- Add follow button partial for managing follow actions.
- Refactor members index view to use the new member card partial.
- Introduce neighbours feed view with daily updates and entries.
- Implement entry partial for displaying individual neighbour activities.
- Create layout partial for visualizing garden layouts.
- Add posts section to neighbours view for displaying recent posts.
- Implement reach section to show nearby gardeners.
- Add suggestions section for recommending gardeners to follow.
- Create routes for neighbours functionality and member dismissals.
- Add migrations for member dismissals and garden layout timestamps.
- Write feature and request specs for neighbours functionality.
- Include support for creating located members in tests.
2026-10-13 17:08:18 +13:00
Brenda Wallace 31978698c2 the growing/ready on the home page should also be react, so it changes without a page reload 2026-10-13 13:10:12 +13:00
Brenda Wallace 29c9cb2ef6 show harvests by count, not weight 2026-10-13 13:08:02 +13:00
Brenda Wallace a06b281a1d overlay modal forms for the homepage 2026-10-12 21:45:53 +13:00
Brenda Wallace 54258de6c4 Refactor home dashboard and related components
- Removed unused styles and helper methods from _garden_layout.scss, _homepage.scss, and overrides.scss.
- Updated _home_dashboard.scss to enhance button styles and added new harvest picker styles.
- Introduced HarvestPicker component for improved harvest recording functionality.
- Refactored home dashboard views to utilize new home_section helper for consistent layout.
- Simplified and optimized existing methods in application_helper.rb, activity.rb, and harvest.rb.
- Removed deprecated homepage_records methods from Activity and Harvest models.
- Updated tests to reflect changes in helper methods and removed obsolete tests.
2026-10-12 19:24:55 +13:00
Brenda Wallace ef06bab74f Add crop suggestions feature and dashboard enhancements
- Introduced crop suggestions functionality allowing users to receive tailored crop recommendations based on their location and preferences.
- Implemented the ability for users to dismiss specific crop suggestions, preventing them from receiving recommendations for crops they are not interested in.
- Added a location picker for users to set their gardening location, enhancing the accuracy of crop suggestions.
- Enhanced the dashboard to display relevant statistics, including plantings and harvests, with comparisons to previous years.
- Created new views and partials for displaying statistics, crop suggestions, and user interactions on the dashboard.
- Updated routes to accommodate new features related to crop suggestions and member locations.
- Added migrations for new database tables and columns to support crop dismissal and suggestion preferences.
- Developed tests for the new features, ensuring functionality and user experience are maintained.
2026-10-12 19:12:18 +13:00
Brenda Wallace 1a95b293bd Add PhotoDialog component and integrate with harvest actions for adding photos 2026-10-11 11:39:04 +13:00
Daniel O'Connor bdbaaf5d63 Merge branch 'dev' into tidy/plantings-show 2026-09-27 11:44:56 +09:30
3dc8379238 Add a garden layout page for mapping where plants sit in a bed (#4835)
* Share the three-dots button style outside planting rows

The round three-dots toggle was scoped to .planting-row. Move it to a
generic .actions-toggle-dots so other menus can reuse it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Show the garden card actions menu as three dots

Matches the planting rows, and gives the button an aria-label naming
the garden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let garden cards update a planting as JSON

PATCH /plantings/:slug.json now returns the garden's refreshed card, as
create does, or the validation errors as 422. Annual plantings in the
card say whether the viewer can edit them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add a PATCH helper and a shared way to swap in a garden card

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let owners edit the planted date on garden cards

The date on an annual planting row is a button with a pencil hint for
plantings the viewer can edit. It opens the browser's date picker, saves
with the tick or Enter, and swaps in the refreshed card so predictions
follow the new date.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Serve a planting's form values as JSON for the edit dialog

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add a shared isPlainClick helper

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Edit a planting in a dialog over the garden list

Three dots > Edit opens the planting's form in a modal instead of going to
the edit page. It saves as JSON and swaps in the refreshed garden card, so
the page is never left. Ctrl/cmd-click still opens the edit page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Drop the garden choice from the planting edit dialog

Moving a planting between gardens isn't part of quick editing. The
dialog no longer asks, or sends, which garden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Rate a planting with stars in the edit dialog

Overall rating is five clickable stars (real radio buttons underneath, so
the keyboard works) with a Clear button, in place of a select.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Only ask for a finished date once a planting is marked finished

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Show planting menu items in lowercase

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add an Add planting button to garden cards

The way to plant in a garden was an item in its actions menu. Put a green
button in the card header, next to the menu, that opens the same dialog.
It only shows for gardens you can plant in.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Take Plant something here out of the garden card menu

The Add planting button does that now. The card data carries its link as
plant_url, instead of it being borrowed from a menu item.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add a gallery page of a member's past gardens

/members/:slug/gardens/past shows their inactive gardens as photo cards:
when each was in use, how many plantings, and the crops grown in it. The
owner (or a collaborator) can mark a garden active again from its card.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Replace the include in-active tickbox with a link to past gardens

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Call them inactive gardens, and explain what that page is

Rename the past gardens page to inactive gardens throughout (label, route,
action, view, styles). Move its link on the gardens page to below the
member's card, with a line saying what it holds, and add an explanation
to the page itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Line the breadcrumb up with the page content

The breadcrumb bar is the same colour as the page, but its side padding
pushed the text 1rem in from the edge the heading and content sit on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Line the sidebar text up with the text in the member card

The skip link, nav links, button, blurb and inactive gardens link sat at
the card's edge while the card's own text is inset. Give them the same
inset, left-align the blurb, and add a little space between the links.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the sidebar nav links look like links

Link colour and underline, with the page you are on in bold and marked
aria-current.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let garden cards record a harvest as JSON

GET /plantings/:slug/harvests/new.json gives the form's starting values
and choices; POST /harvests.json returns the garden's refreshed card, or
the validation errors as 422.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Record a harvest in a dialog over the garden list

Three dots > record harvest opens a quick entry form (how many, weight,
when, plant part, notes) in a modal, with the crop and today's date
filled in. It saves as JSON and swaps in the refreshed card, so the page
is never left. Ctrl/cmd-click still opens the full harvest page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Pass the harvest handler to the planting row, not the perennial chip

The record harvest prop had been attached to the first matching element
in GardenCard, the perennials' CropChip, so the row's menu item fell
through to a normal link.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Share the dialog step indicator

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Record a harvest in two steps, styled like Add planting

Step 1 is what part you harvested: a big text box, with the cursor in it,
that completes from the plant parts (the crop's usual one first). Step 2
is how much: quantity, weight, when and notes, with the choice shown back
and a Change button. Same look as the Add planting dialog.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Harvest dialog: add When and Any notes steps, drop Cancel

Step 3 is when (Today, Yesterday, or Enter date), step 4 is any notes,
and that step saves. The choices so far are shown back with Change
buttons, and there is a Back button. Closing the dialog is how you cancel.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Mark the planting that has just had a harvest recorded

For a few seconds the row goes amber and gets a Harvest recorded tag, and
the notice names the garden, so it is clear which planting it was.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Only offer Yesterday when a harvest then would be after planting

The server needs a harvest to come after the planted date, so a planting
made today (or yesterday) has no Yesterday, and the date box starts the
day after it was planted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix the JSON request specs, and tolerate an empty harvest param

The update helper took its hash as keywords, and the form GET sent a JSON
content type, which Rails wraps into an empty harvest param that new then
rejected. The specs are fixed, and new ignores a blank harvest param.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Put Mark as finished last in the planting menu, below a divider

It takes the planting off the list, so it goes after the everyday
actions, separated from them. The card menu and the garden page menu
match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Show a tick on the progress bar for each harvest

Each harvest is a small tick at its date on the bar's own scale, with the
date as a tooltip and a hidden sentence for screen readers. The card data
carries the positions, worked out with the same formula as the fill.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the pill choice styles general, not about harvests

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let garden cards save seeds as JSON

GET /plantings/:slug/seeds/new.json gives the form's starting values and
choices; POST /seeds.json returns a link to the new seed, or the
validation errors as 422, without queueing a flash message.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Save seeds in a dialog over the garden list

Three dots > save seeds opens a dialog in the same style as record
harvest: about how many (with quick picks), whether to offer them for
trade, and any notes. It saves as JSON and shows a notice with a link to
the seeds, so the page is never left.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add feature specs for the save seeds and record harvest dialogs

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let garden cards choose and add a Flickr photo as JSON

GET /photos/new.json gives a page of the member's Flickr photos (or says
to connect or reconnect Flickr), and POST /photos.json adds one to the
planting or garden and returns the garden's refreshed card, or the
validation errors as 422.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add a small page for a Flickr connect pop-up to end on

/authentications/connected says whether Flickr got connected and closes
itself. It has no site header or footer, as it appears in a small window.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add a photo in a dialog over the garden list, connecting Flickr there too

Three dots > add photo (on a planting or a garden) opens a dialog: choose
one of your Flickr photos by album or tag, confirm it, and it is added
without leaving the page, with the garden's card refreshed. If Flickr is
not connected, or the connection has expired, the first step connects it
in a pop-up and the dialog carries on by itself once it has worked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add feature specs for the add photo dialog, with Flickr stubbed

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Stop handled menu clicks reaching jquery_ujs, and close the menu

A menu item that carries a data-method (mark as finished) was still sent
as a request by jquery_ujs after a dialog had taken the click over, so the
page navigated and the change was made before the dialog could be used.
A click a dialog handles is now stopped in the menu, which also closes it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Mark a planting finished in a dialog, asking when it finished

Three dots > mark as finished opens a dialog over the list: when did it
finish, today unless you enter a date. Today is not offered for a planting
made today, as the server needs a finish after the planting. It saves as
JSON and the planting leaves the list, without leaving the page. The card
data carries the server's date for today.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add specs for the mark as finished dialog

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the crop chip the planting's menu, for annuals and perennials

Clicking a chip opens the planting's menu under it (view, edit, add
photo, record harvest, save seeds, mark as finished), in place of the
three dots on annual rows, so perennials get the same menu. A caret shows
the chip opens something. Someone who can't change the planting still gets
a plain link chip. The menu items are lowercase for every planting menu.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Update the garden index spec for chip menus

An owner's planting chip is a menu now, with a View link to the planting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Let garden cards edit a garden as JSON

GET /gardens/:slug/edit.json gives the form's values and choices, and
PATCH /gardens/:slug.json returns the garden's refreshed card, or the
validation errors as 422, without queueing a flash message.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Edit a garden in a dialog over the garden list

Three dots on a garden card > edit opens its form in a dialog, and saves
without leaving the page. A garden saved as inactive leaves the list, with
a note saying where it went.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add feature specs for the edit garden dialog

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Update the edit garden spec: Edit on a card opens the dialog

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Re-dump schema.rb under Rails 8.1

Rails 8.1's schema dumper sorts each table's columns alphabetically, and
schema.rb was last dumped under 8.0, so the next migration rewrites the
whole file. Doing that on its own here, with no schema changes, keeps the
garden layout commit's schema diff down to what it actually adds.

The lines are identical to before, only reordered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add a garden layout page for mapping where plants sit in a bed

A new page at /members/:member_slug/gardens/:slug/layout shows the bed as
a grid, and the garden cards link to it as "Garden layout".

Each planting in the sidebar is a crop chip. Dragging it onto the bed
places one plant there, and the chip stays so it can be dragged again;
dragging a plant back to the sidebar takes it off the bed. Plants can go
anywhere on the bed, not just in a cell, and are drawn as circles with
the crop's icon. The owner can change the bed's size above it, and it
redraws as they type. There is also a "Remove all" button, and a "Plant
something" button that opens the same dialog as the garden cards.

Plants are a new model, one row per individual plant in a planting, so a
planting of ten tomatoes is ten plants that are placed one at a time.
That also gives per-plant state, such as one plant failing, somewhere to
go later. A planting's quantity now follows its number of plants, and
existing plantings are backfilled with one plant each per plant they say
they have, up to 100.

The layout saves the whole arrangement in one request, in a transaction,
so a bad placement leaves the bed as it was. The owner and collaborators
can arrange plants; only the owner can resize the bed or plant into it.

The members-nested gardens routes now use :slug, like the top-level
ones. They used :id, which the controller's loader never read, so those
routes could not find a garden; nothing linked to them.

The specs are not up to date with the Plant model yet, and have not
been run: the layout request, serializer and feature specs still
describe earlier versions of the page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add a compost bin to the garden layout, and make the bed look like soil

Dragging a plant into the compost bin deletes it, so its planting has
one fewer; dropping it anywhere else in the sidebar still just lifts it
off the bed. The save request carries the composted plant ids, since a
plant missing from the arrangement otherwise means lifted, not gone. The
plant arcs into the bin as it's dropped, unless the viewer prefers
reduced motion.

The bin sits under "About this garden", drawn there through a portal so
it stays part of the layout island, and is sticky so it stays in reach
on a long bed. There is no compost icon in the Icons8 set, so it uses
the earth worm.

The bed is now dark soil in a timber frame, with the grid as twine. The
frame is the border, so drops are measured against the soil inside it.

The sidebar is just the crop chips now, without a status line under
each.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Let plants on the garden layout be resized, and make dragging easier

Each plant can be drawn bigger or smaller, since a tomato takes more
room than basil: drag the handle on its edge. plants.diameter holds the
size in grid cells once a plant is resized; until then it follows its
crop's new default_diameter, or the parent crop's, or one cell. There is
no form for crop defaults yet. The next plant taken off a planting's
chip is the size last given to one of its plants, so shrinking one
chive shrinks the next.

Dragging is easier to follow. The browser's own drag picture all but
vanished on the soil, so a ringed circle at the plant's size follows the
pointer instead, centred where it will land. Only a plant's circle picks
it up, not the square around it, which overlapped neighbouring plants
and could pick up the wrong one. Clicking a plant no longer opens its
planting.

A crop chip dropped in the compost bin composts one of that planting's
unplaced plants. Drag state is now cleared on any drop, since a plant
composted from the bed is gone before its own drag end would fire,
which left the bin highlighted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Point people at the garden layout, and tidy its crop chips

The garden page has a card inviting people to the layout, with a small
bed drawn in the same soil and timber: "Try out the new garden layout
tool" for those who can arrange it, "Open the garden layout" for
everyone else. It isn't shown for inactive gardens, which have nothing
growing to place.

On the gardens list the layout link is now a small "Layout" button
beside "Add planting", rather than a line of text under the owner.

The sidebar's crop chips are all the width of the sidebar, with the icon
inside the chip (the shared chip style pulled it half outside) and the
counts lined up. Plantings are listed by crop name, then date, then id;
by date alone, plantings made the same day came back in no fixed order
and reshuffled whenever a save touched them. A crop in the bed more than
once shows each planting's date, so they can be told apart.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Make a planting's plants when its garden's layout is used, not up front

Most plantings will never go on a layout, so giving every planting a
row per plant, when it was made and by backfilling the existing ones,
filled the plants table for nothing. Now a garden's growing plantings
get their plants the first time someone who can arrange the bed opens
its layout, in one insert; someone only looking makes none. The
backfill migration is gone, so there is nothing to run on deploy.

A planting's quantity only adds or removes plants once it is on a
layout. Zero now means no plants rather than one, so a planting
composted down to nothing isn't given a fresh plant next time the
layout is opened; a blank quantity still counts as one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Bring the garden layout specs up to date

The specs described the layout as it was several versions ago, with
positions and spans on plantings. They now cover plants: where they can
sit, their sizes and the fallback to the parent crop's, the 100-plant
cap, and being made when a layout is first used. The request specs cover
saving an arrangement, dragging off a chip, composting, resizing the
bed, and who may do each. The feature spec drives the page in a browser.

The garden page's layout card and the layout's save route have specs
too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Tell people about the garden layout at the top of the home page

A card at the top of the home page, with the same small drawn bed as the
garden page's, invites people to the layout. A signed-in member is sent
to the layout of their active garden with the most growing in it, so
there is something to arrange, alphabetically between ones with the
same. A member with no active garden is asked to add one, and anyone
signed out to sign up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Keep plants wholly on the garden layout's bed

A plant's position is its centre, so a big plant near the edge hung over
the timber frame, and ones along the bottom were cut off. Now a plant
always stays half its width from each edge: when it's dropped, resized,
or the arrangement is saved. Plants already hanging over are drawn
pulled in, and saved that way on the next change. A plant can't be made
wider than the bed, and shrinking the bed counts each plant's edge, not
just its centre.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Make it easier to tell plants apart on the garden layout

Every plant was a circle with its crop's icon, and many crops share an
icon or have none, so a bed could be a field of identical sprouts.

- A plant big enough on screen carries its crop's name beneath it.
- Pointing at a plant, or at a planting's chip in the sidebar, picks out
  all of that planting's plants and fades the rest.
- Plantings drawn with the same icon get a coloured ring, with a
  matching dot on their chip. There are five colours, which are the ones
  that stay distinguishable from each other against the soil for every
  pair, colour blind or not. They go to the plantings that share an icon
  in the order those were made, so a planting keeps its colour. Past
  five in one group, plantings go by their names.

The layout's data now says which icon each planting is drawn with, so
the page can group them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Put stepping stones, labels and rows on the garden layout

A "Garden features" group in the layout's sidebar has three things to
drag onto the bed besides plants:

- A stepping stone: a grey pebble, moved by dragging.
- A label, such as "path" or "N": asks what it should say, sits over
  the plants like a marker, and is renamed by double-clicking it.
- A row: a furrow two cells long, whose ends can be dragged to set where
  it runs, moved by the handle at its middle, and optionally named.

Any of them goes in the compost bin to be removed. They're kept as a
list on the garden, gardens.layout_features, and saved in the same
request as the plants, so a bad one rolls back the whole save. They're
checked and written directly rather than by saving the garden, which
would geocode it on every drag. A save that doesn't send them leaves
them alone, and the bed can't be shrunk out from under one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Put the garden layout's sidebar on the left, next to the bed

The bed sits at the start of its column, sized to fit the window, so a
tall, narrow bed left the sidebar stranded far off to its right. With the
plantings and garden features on the left, the bed is always right next
to them. On a phone they still stack, with the list under the bed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Call the garden layout's planting button "Add a planting"

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add sprinklers, taps, stakes, paths, drip lines, fences, trellises and netting

More garden features to put on the layout besides plants:

- Points: an irrigation sprinkler and a tap (their Icons8 icons on a
  white disc ringed in blue), and a stake (the round top of a post).
- Lines, drawn and reshaped like rows: a path (a wide gravel strip), a
  drip line (a thin blue pipe with emitters), a fence (a rail with posts)
  and a trellis (a strip of timber lattice).
- An area: netting, a see-through mesh over the plants it covers,
  between two corners that can be dragged to resize it.

Lines and netting share their handles: the middle to move and name it,
the ends or corners to reshape it. The types are now one table in the
layout, each with a name and a shape (point, label, line or area), and
the sidebar offers them from it. The server knows them by the same
split, checks both points of every line and area, and sends the icons as
one set, feature_icon_urls.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Call the garden layout's "Remove all" button "Clear bed"

It still lifts only the plants back to their chips; the confirmation now
says that stones, lines, netting and the rest stay where they are.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Put garden features in a toolbar above the bed, and keep the sidebar in view

With eleven garden features under the plantings, the sidebar no longer
fit on the screen. The features are now a row of small tiles above the
bed, in groups (ground, water, supports, markers), each named when
pointed at, and the sidebar is just the plantings.

The sidebar also stays in view as a tall bed is scrolled, scrolling
itself if the list of plantings is long. On a phone it still sits under
the bed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Implement bed resizing functionality with drag support

* Style the garden layout bed's edges, so they can be dragged

The bed's right edge, bottom edge and corner had their drag handling but
no styles, so they had no size or position and couldn't be grabbed. Now
they sit over the timber frame, with a pale grip showing while the bed
is pointed at, and a dashed outline shows the size the bed is being
dragged to. The bed's column no longer clips, so that outline can show
past it when the bed is dragged bigger.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Bring two garden layout feature specs up to date

A chip dropped in the middle of the bed lands within a fraction of a
pixel of the middle, not exactly on it. And shrinking the bed past
something on it now says "things", as stones and fences count too, not
"plants".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Wait for a garden to be reactivated before checking it

"Mark as active" sends the change in the background, and the spec looked
at the garden straight after clicking, so it failed whenever the request
hadn't finished yet. It now waits for the page to come back first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2026-09-27 11:43:40 +09:30
Brenda WallaceandClaude Opus 5 af77b798c5 Use the harvest and seed cards site-wide, and rate a planting in place
The new harvest cards and seed packets only appeared on plantings#show.
Everywhere else either used the old thumbnails or hand-rolled its own
markup, which is what made harvests and plantings look alike in the first
place.

- members#show and members/_harvests render harvests/card. The latter also
  wrapped each card in another .card, which nested a card in a card.
- The homepage harvest list was hand-rolled markup beside a seeds section
  that already used seeds/card; both now use the shared partials.
- Homepage seed packets go in an .index-cards grid. Outside one they have
  no width, and the packet's 3:4 ratio made each half the page wide.
- harvests/_harvest and seeds/_seed chose between card and thumbnail on a
  `full:` local that nothing passes. Both render the card.

The crop pages' harvest and seed panels are lists of links in a sidebar,
not card grids, so they are left alone.

Section "add" buttons now open the same dialogs as the actions menu, via a
data-planting-dialog attribute the island listens for. Their href stays as
the fallback without JavaScript.

The rating card is now clickable: for someone who may edit the planting it
renders StarRating, which saves the new rating and puts it back if the
save fails. The card's own heading is the label, so the fieldset legend is
hidden rather than saying "Rating" twice.

"More photos" is a plain link again, and only shows when there are more
photos than the page is displaying — the photos are now paginated to 12,
where before the whole set was loaded and the link always showed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 08:41:09 +12:00
Brenda WallaceandClaude Opus 5 baff16e92e Tidy plantings#show, and make cards and menus consistent
This page read as a page about the crop rather than about one member's
planting, and its sections each did things their own way. Changes follow
the conventions written up in the UI consistency guide.

Identity
- Title, meta description and OpenGraph all read "<crop> planting by
  <owner>"; the hero carries a muted "planting by X in Y" subtitle and
  the scientific name moves to the crop card.
- Breadcrumb's last item is plain text, not a link to the current page.

Actions
- One actions menu per page: a quiet three-dot button in the top right of
  the hero, rendered by the new PlantingActions island, opening the
  EditPlanting, RecordHarvest, SaveSeeds, MarkFinished and AddPhoto
  dialogs that already existed for the garden list.
- Menu items are lower case, so a menu reads as a list of things you can
  do rather than a row of headings.
- Transplanting moves out of the sidebar into a dialog off that menu: it
  is done once in a planting's life and should not hold real estate.
- The second seed-saving dropdown and the loose photo buttons are gone;
  each section keeps one quiet "add" on its heading bar as the non-JS
  path.
- The plant-part icons from the server-rendered harvest form now reach
  the dialog, via icon_url on HarvestFormSerializer.

Fact cards
- Every card fills the same four slots, and the core cards always render
  so one planting's page has the same shape as the next.
- Progress reads as a percentage with "day 43 of 90" beneath; quantity
  and "grown from" merge into one card rather than both saying
  "seedling"; rating is stars and renders even when unrated.
- Dates go through I18n.l and standard_time_distance instead of
  assembling abbr_month_names by hand.
- Adds Planting#planned?, replacing three copies of age_in_days < 0.
- Perennial no longer claims the plant "grows back each year".

Cards by type
- Harvest cards get square corners, a warm accent and the harvest icon,
  and say "<crop> harvest", so they are not mistaken for plantings.
- Seed cards are drawn as seed packets: portrait, papery, torn top edge,
  printed band, small print along the foot and the year saved stamped on
  them.

Layout
- The page wrapper is .planting-show, not .planting: that is the planting
  *card's* class, and its absolutely positioned badges and quick actions
  were leaking onto this page.
- Sections are bordered blocks with their heading bar as the lid, so a
  heading and its content read as one thing.
- One spacing scale, and the hero aligns to the same left edge as
  everything below it.

Copy
- Section headings and empty states go through en.yml, in one voice.
- "Add a photo to visually track growth of this planting, to Flickr,
  iNaturalist or Pl@ntNet" was nonsense: photos come from Flickr only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 08:15:45 +12:00
Brenda WallaceandClaude Sonnet 5 9dae899693 Quick planting addition form (#4808)
* Add rake tasks to pull crops and a member's data from production

crops:pull_from_production copies approved crops, and
members:pull_from_production copies one member's gardens, plantings and
planting photos, from growstuff.org into a local database. Both refuse to
run in a production environment.

They are built to be gentle on a server that has been struggling: one
request at a time with a pause between requests, exponential backoff
(honouring Retry-After) on timeouts, 429s and 5xx, and a hard stop rather
than endless retries. The client also stops if a server keeps sending the
same page, and will not follow a next link to another host.

Gardens and plantings come from the site's own JSON, which carries every
column; the JSON:API only exposes a garden's name, and its related
resource endpoints return the wrong records. Only the crops that a
member's plantings use are fetched. Flickr photos are stored as records
pointing at Flickr's image URLs, as on production, so nothing is
downloaded from Flickr.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add ACTIVE_ONLY option to the member import

ACTIVE_ONLY=true leaves out the site's all=1 flag, so production lists only
the member's active gardens and current (not finished, not failed)
plantings. The server does the filtering, so it also means fewer requests,
and no crops or photos are fetched for plantings that are skipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Bundle JavaScript with esbuild via jsbundling-rails

Adds React and an esbuild build (yarn build, yarn build:watch) that writes
app/assets/builds/react_islands.js, which Sprockets serves. jsbundling-rails
runs the build as part of assets:precompile, which CI and the Dockerfile
already run after yarn install.

react_islands.jsx is the entry point: it mounts a React component into every
element with data-react-component. No components are registered yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add react_component view helper

Renders an empty element carrying the component name and its props as JSON,
for react_islands.jsx to mount a React component into. Props go through
Rails' attribute escaping.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Show a React GardenSummary island on the gardens index

The first React island, to prove the pipeline end to end: server-rendered
props (owner and garden count) drive a small component with client-side
state. Loaded only on this page, deferred, via the scripts content block.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add GardenCardSerializer for the React garden cards

Turns a page of gardens into plain hashes: the garden, its owner, its
actions menu, and its active plantings split into perennials and annuals,
with progress, badges and quick actions. It mirrors what gardens/_card,
gardens/_actions and the planting partials render today, so the server
still decides labels, links and permissions.

Active plantings for the whole page are loaded in one query (with harvests
and the crop's parents), instead of several queries per garden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Render the garden cards on the index with React

The gardens index now hands GardenCardSerializer's output to a GardenCards
island instead of rendering gardens/_card per garden. The actions menu moves
to the top right of the card header. Everything else on the card is the same:
image, perennials, and each annual planting with badges, progress bar and its
own quick actions menu. The server still chooses labels, links and
permissions.

The dropdowns keep the existing Bootstrap and jquery_ujs markup
(data-bs-toggle, data-method, data-confirm), so mark inactive, delete and the
confirmations work unchanged. Menu button ids are now unique per card, so the
edit-from-index spec finds the menu by its Actions text instead of the old
repeated id.

gardens/_card stays for the activity page. This replaces the GardenSummary
island, which only proved the pipeline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Don't raise when validating a planting that has no garden

owner_must_match_garden_owner called garden.owner unconditionally, so a
planting with a missing garden raised NoMethodError (a 500) instead of
failing the garden presence validation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Create plantings as JSON for the React garden cards

POST /plantings.json returns the garden's updated card (201), or the
validation errors (422), so the cards can show a new planting without a page
reload. It is for our own pages only: session cookie plus CSRF token, and no
CORS headers, unlike the public /api/v1.

Creating now also checks the garden is yours. Before, can :create Planting
had no garden condition and create never authorized the garden, so a crafted
request could plant into someone else's garden. This applies to the HTML form
as well. A missing garden is still left to the presence validation.

CanCan::AccessDenied now answers JSON requests with a 403 and an error,
instead of redirecting them.

The request spec logs in through a real cookie session to exercise CSRF
protection: PlantingsController uses the null_session strategy, so a request
without the token is treated as signed out (401), and the sign_in test helper
would bypass that.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Don't ask which garden when planting from a garden

Arriving at the planting form with a garden_id of one of your own gardens
(from 'Plant something here') now shows 'Planting in <garden>' with a hidden
garden field and a link to choose a different one, instead of the garden
radio buttons. Any other arrival, including a garden_id that isn't yours,
still asks as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Open 'Plant something here' as a dialog over the garden cards

Clicking 'Plant something here' on a card opens a dialog to plant into that
garden, without leaving the list or asking which garden. Saving posts to
POST /plantings.json, swaps in the garden's updated card so the new planting
shows straight away (briefly highlighted, with a confirmation), and closes the
dialog. Errors show inside it and it stays open. A ctrl/cmd/shift-click still
opens the normal form.

The dialog is a React-controlled Bootstrap modal: focus moves in and is
trapped, Escape and the backdrop close it, and focus returns afterwards. The
crop picker searches /crops/search.json like the existing autosuggest, and the
planted-from and sun choices come from Planting's constants via props.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Use the Bootstrap 4 class names the app's CSS defines in the card components

The stylesheet is MDB 4 (Bootstrap 4), with Bootstrap 5's JavaScript on top,
so Bootstrap 5-only classes had no styling: the dialog's close button was
btn-close (a small grey box), and visually-hidden, form-select and text-start
did nothing. Use close with a times sign, sr-only, form-control and text-left,
as the app's existing modals do.

dropdown-menu-end stays, because Bootstrap 5's dropdown JavaScript reads it to
place the menu; dropdown-menu-right is added for the CSS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the plant-something form read as a sentence

'I planted [N] [crop](s) on [date] from [seed] in [sun].' Each blank is an
underlined inline field: quantity, the crop search, the planted date, and
planted-from and sun/shade selects. The (s) drops away when the quantity is 1.
The blanks are labelled for screen readers (Quantity, Crop, Planted date,
Planted from, Sun or shade). Notes and 'Mark as finished' stay below.

The browser spec now fills in quantity, planted from and sun as well, and
checks they are saved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Hint at typing a crop name, and offer to request one that isn't found

The crop blank says 'type a crop name'. When a search finds nothing it says
so and links to the new-crop form (in a new tab, so the dialog stays open),
as the old planting form did.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Say 'number' in the quantity blank

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Choose a crop with the cursor keys

The crop picker is now an accessible combobox. As you type, matches appear in
a listbox: Up and Down move through them, Enter chooses the highlighted one
(or the top match if none is highlighted), and Escape closes the list before a
second Escape closes the dialog. Focus moves to 'Change' once a crop is chosen.
Matches can still be clicked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Trim the plant-something form to just the sentence

Remove 'Mark as finished' and the 'Tell us more about it' notes from the
dialog, along with the never-shown rating field it carried in its state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the highlighted crop match obvious

The theme's list-group 'active' shade was barely darker than the other
matches. The one Enter would choose now has a solid blue background, white
bold text and a darker left edge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Tidy the plant-something sentence layout

Group the sentence into phrases (I planted..., on..., from..., in...) that stay
together when it wraps, so a word is never stranded away from its blank. Hide
the quantity spinner that clipped 'number', widen the date, and give the two
selects a minimum width, with a grey 'optional' when they are still empty.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Don't let a second Enter undo a chosen crop

After choosing a crop the input is replaced by the crop's name and a Change
button. Focus went to that button, so pressing Enter again pressed it and
cleared the choice. Focus now moves on to the date blank, so a second Enter
submits the form as it would from any field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Plant with one search and a confirmation, instead of the sentence form

The dialog asks one big question, 'What did you plant?', with the same
crop search as before (arrow keys, Enter, and a way to request a crop that
isn't found). Choosing a crop shows it back ('You're planting lettuce in
Orchard, today.') with Change and Plant it buttons, and focus lands on Plant
it so Enter confirms. The planting gets today's date and no other details;
those can be added later, which keeps adding one quick.

Drops the sentence blanks, their styles, and the planted-from/sun option lists
the page passed down.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix unreadable text on a just-planted crop

The highlight for a newly added planting set an inline pale green background
on the crop chip. Chips are brown with white text, so the name became white on
light green. The highlight is now a CSS class that leaves the chip's colours
alone: a soft green row with a left bar for annual plantings, and a green ring
around the chip for perennials. The browser spec checks the chip carries no
inline style.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Tidy the plant dialog and show what is happening at each stage

Standard patterns so the dialog always says where you are and what it is doing:
- a two-step indicator (Choose a crop, Confirm) with a tick on the finished step
- a spinner in the search box while searching, plus a 'Searching...' status, a
  count of matches, and an info icon on the 'no crops match' note
- the choice shown back as a Crop / Garden / When summary with a Change button
- Plant it as a filled green primary button that stays green while focused (the
  theme greys a focused button) and shows a spinner while planting, with Cancel
  and Change disabled meanwhile
- an error panel with a warning icon that says the choice is kept for retrying
- the matches listed in the dialog rather than floating over its buttons
- a tick on the 'Planted ...' notice on the cards
- the shovel (spade-marker.svg, the map marker) in the dialog title

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Build the React bundle in CI and for fresh checkouts

app/assets/builds/react_islands.js is built by esbuild and not committed, so on
a fresh checkout pages that load it (the gardens index) fail with 'The asset
react_islands.js is not present in the asset pipeline'. The rspec CI job never
built it: only the browser-feature jobs did, through assets:precompile. Add a
yarn build step there, and have the specs build the bundle once if it is
missing so a local checkout doesn't fail either.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add the missing 'View' translation

The planting quick-actions menu used t('view'), which has no translation. In a
view Rails hides that by showing a humanised 'View'; the card serializer uses
I18n.t, which showed 'Translation missing: en.view' in the menu. Add
buttons.view, use it in both places, and add a serializer spec that fails if
any card label is a missing translation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix two crop_jsonld_data specs that could not pass

The helper builds its hash with symbol keys, but the spec read 'data["@context"]'
with a string key. And 'caps posts and photos at 50' relied on
create(:post, crops: [crop]), which creates no crop_posts rows here, and on
crop.photo_associations.create!, which the Crop model's own association leaves
without a photographable. Link posts with CropPost and photos with
PhotoAssociation explicitly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Run the helper and serializer specs in CI

The rspec job ran lib, services, models, controllers, views, routing and
requests, but not spec/helpers or spec/serializers, so those specs (including
the react_component helper and the card serializer) never ran there, and two
broken crops_helper specs went unnoticed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Tidy the garden cards

The cards were cluttered and misaligned. Now:
- the header has a smaller title with the owner under it, and the menu top right
- a smaller picture, and 'Perennials' and 'Annuals' headings instead of a
  divider and a gap; 'Nothing planted here yet.' for an empty garden
- each annual planting is a row of three aligned columns: the crop with when it
  was planted (which tells duplicates apart), then its badges and progress bar,
  then a labelled three-dots menu in place of a bare chevron
- the note when there is nothing to predict from is one short muted line that
  no longer repeats the crop name
- on a phone the picture and rows stack

Also restores the just-planted highlight styles, which a stylesheet edit had
dropped, and adds a spec that the highlight has a background, since the class
existing was all that was checked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Make the planting menu button compact

The theme gives every .btn a 5.5rem minimum width, so the three-dots button's
hover background was a wide grey box. It is now a 2.25rem round button.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 16:04:15 +09:30