Skip to content

Locations 0.3.0: A Structure page for spaces of any depth

Locations 0.3.0 gives each location in the PhoenixKit locations module a Structure page, where spaces nest as deep as you need: floors, rooms, zones, sections, aisles and shelves. Other modules get a picker to choose a location and a space in one step.

The Structure page

Spaces were edited on the location form, as floors with rooms inside them, and saved together with the location. They now have a page of their own. Open it with Structure in a location’s row menu on the list; the page has Details and Structure tabs at the top.

The page shows the location’s spaces as a tree of any depth. Each change is saved at once: add a space at the top (Add root space) or under another space, rename it, move it up or down among its siblings, or delete it. A new space goes to the end of its group. Deleting asks first and gives the number of spaces underneath, since deleting a space removes everything under it and cannot be undone. Every change is written to the activity log.

Selecting a space opens its own form: Kind, Name, Status, Description and Internal notes (admin-only), with its own featured image and files card, and a name and description per language.

More kinds of space

Besides Floor and Room, a space can now be a Zone, Section, Aisle or Shelf, each with its own icon. The kind names are translated into Estonian and Russian.

A place picker for other modules

Modules that need a place, such as manufacturing, can embed a picker that combines a location search (Search locations…) with the location’s space tree. The user picks a location and, if needed, a space, or Use this location (no specific space). The module can also show a space’s full path, such as “Location / Floor / Zone / Shelf”, in the reader’s language.

Upgrading

Locations 0.3 needs PhoenixKit 1.7.189 or later. There is no migration: the new space kinds were already allowed by core’s table. Existing floors and rooms stay as they are and appear in the new tree.

Full release notes: Locations 0.3.0

0.3.0 · 13 July 2026

Added

  • Space kinds extended from floor/room to floor/room/zone/section/aisle/shelf (app-layer list; the core V122 CHECK constraint already allowed them), with localized labels/icons via the module’s own gettext backend (en/et/ru).
  • Structure tab (LocationStructureLive) — an N-deep Space tree UI (SpaceTree, modeled on core’s FolderExplorer) replacing the old two-level staged floor/room draft flow. Immediate-commit CRUD (create/rename/reorder/delete) with activity logging; delete opens a confirmation modal reporting the true descendant count (Spaces.count_descendants/1, a recursive CTE) since a hard delete CASCADEs the whole subtree. Each Space gets its own Files + Featured Image card via the existing multi-resource Attachments pattern, and its own multilang name/description.
  • Spaces.full_path/2 — locale-aware breadcrumb (“Location / Floor / Zone / Shelf”) via a cycle-safe recursive CTE.
  • PlacePicker — a LiveComponent combining a Location search-combobox with the Space tree in read-only picker mode, for consumers (e.g. phoenix_kit_manufacturing) that need to pick a Location and optionally a Space in one widget. Sends {:place_picker_select, id, %{location_uuid, space_uuid}}.
  • Auto-positioning of new spaces (Spaces.create_space/2 appends to the end of its sibling group when no position is given).

Fixed

  • PlacePicker‘s select_location handler unconditionally reset the local selected_space_uuid to nil, which clobbered a consumer-seeded selection the moment the matching Location was picked — defeating the component’s own “seed-once” contract (and its test) for the one case it exists to cover. Now the seed is kept when it’s present in the newly-loaded tree.
  • lib/phoenix_kit_locations.ex’s version/0 had drifted to "0.1.1" (stale since before 0.2.0) while mix.exs and the version-compliance test only checked consistency with each other, not against it. All three now agree.

Locations 0.3.0. Install or update: {:phoenix_kit_locations, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.