Properties tab: add sort toggle (alphabetical / proximity) #225

Open
opened 2026-06-15 12:20:20 +00:00 by ldraney · 0 comments
Owner

Type

Feature

Lineage

Standalone — follow-up to PR #207 (proximity-based default sort).

Repo

ldraney/landscaping-assistant

User Story

As a crew lead browsing the Properties tab
I want to toggle between alphabetical and proximity sort
So that I can quickly find a client by name OR plan a route by location

Context

PR #207 replaced alphabetical sort with nearest-neighbor proximity sort as the only option on the Properties tab. While proximity sort is useful for route planning, it makes it hard to find a specific client by scrolling — the order isn't predictable without knowing the geography. Alphabetical should be the default, with proximity available as an opt-in toggle.

File Targets

Files the agent should modify or create:

  • app/controllers/properties_controller.rb — read sort param, choose by_proximity or alphabetical
  • app/views/properties/manage.html.erb — add sort toggle button/link
  • app/assets/stylesheets/application.css — minimal styling for toggle if needed
  • spec/requests/properties_spec.rb — test both sort modes via query param

Files the agent should NOT touch:

  • app/models/property.rbby_proximity already works, no model changes needed
  • app/controllers/weeks_controller.rb — Week view sort is a separate concern

Feature Flag

none

Acceptance Criteria

  • Properties tab defaults to alphabetical sort (by client_name, case-insensitive)
  • A visible toggle lets the user switch to proximity sort
  • Toggle state is reflected in the URL via query param (e.g. ?sort=proximity)
  • Proximity sort uses existing Property.by_proximity — no new geo logic
  • Current search and service filter chips continue to work with both sort modes

Test Expectations

  • Request spec: GET /properties/manage returns alphabetical order by default
  • Request spec: GET /properties/manage?sort=proximity returns proximity order
  • Run command: bundle exec rspec spec/requests/properties_spec.rb

Constraints

  • No Tailwind — use existing CSS patterns from application.css
  • Keep it simple — no cookies, no session storage, just a query param
  • Preserve the existing filter Stimulus controller; toggle can be plain HTML or a small addition to it

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • landscaping-assistant — project this affects
### Type Feature ### Lineage Standalone — follow-up to PR #207 (proximity-based default sort). ### Repo `ldraney/landscaping-assistant` ### User Story As a crew lead browsing the Properties tab I want to toggle between alphabetical and proximity sort So that I can quickly find a client by name OR plan a route by location ### Context PR #207 replaced alphabetical sort with nearest-neighbor proximity sort as the only option on the Properties tab. While proximity sort is useful for route planning, it makes it hard to find a specific client by scrolling — the order isn't predictable without knowing the geography. Alphabetical should be the default, with proximity available as an opt-in toggle. ### File Targets Files the agent should modify or create: - `app/controllers/properties_controller.rb` — read `sort` param, choose `by_proximity` or alphabetical - `app/views/properties/manage.html.erb` — add sort toggle button/link - `app/assets/stylesheets/application.css` — minimal styling for toggle if needed - `spec/requests/properties_spec.rb` — test both sort modes via query param Files the agent should NOT touch: - `app/models/property.rb` — `by_proximity` already works, no model changes needed - `app/controllers/weeks_controller.rb` — Week view sort is a separate concern ### Feature Flag none ### Acceptance Criteria - [ ] Properties tab defaults to alphabetical sort (by client_name, case-insensitive) - [ ] A visible toggle lets the user switch to proximity sort - [ ] Toggle state is reflected in the URL via query param (e.g. `?sort=proximity`) - [ ] Proximity sort uses existing `Property.by_proximity` — no new geo logic - [ ] Current search and service filter chips continue to work with both sort modes ### Test Expectations - [ ] Request spec: `GET /properties/manage` returns alphabetical order by default - [ ] Request spec: `GET /properties/manage?sort=proximity` returns proximity order - [ ] Run command: `bundle exec rspec spec/requests/properties_spec.rb` ### Constraints - No Tailwind — use existing CSS patterns from application.css - Keep it simple — no cookies, no session storage, just a query param - Preserve the existing filter Stimulus controller; toggle can be plain HTML or a small addition to it ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `landscaping-assistant` — project this affects
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/landscaping-assistant#225
No description provided.