Locations 0.2.0: Floors, rooms and files for every location
Locations 0.2.0 lets you break a location down into floors and rooms in the PhoenixKit locations module, and attach a featured image and files to each location, floor and room.
Floors and rooms
The location form gets a Spaces section. Add floor creates a floor; each floor is a tab, and the rooms of the active floor sit under it, with Add room. A floor or room has a name, a description and its own language selector, so it can be translated separately from the location. As the section says, changes save together with the location: floors and rooms are drafts on the page until you press the location’s save button.
Before saving, every draft is checked. A floor or room without a name stops the save with a message that names it, such as “Floor 2 needs a name”. Deleting a floor also deletes its rooms; the form asks first and applies the deletion when you save. If the location saves but some spaces fail, the page says how many failed and keeps them on screen so nothing is lost.
Images and files
Each location, and each floor and room, gets a Featured Image picker and an Attached Files card. Drag and drop or click to upload, and files go to the place being edited. Removing a file from a location moves it to the trash if nothing else uses it, and admins can restore it.
A cleaner admin
The Locations and Types switcher on the page is gone: the PhoenixKit admin sidebar already offers both as subtabs. The pages use the standard admin header and the full width of the screen, and clicking a name in either list opens it for editing.
Upgrading
Locations 0.2 needs PhoenixKit 1.7.125 or later, the first core release with the table for floors and rooms. Run PhoenixKit’s migrations as usual after updating; Locations itself adds none.
Full release notes: Locations 0.2.0
0.2.0 · 29 May 2026
Added
- Spaces — nested floors and rooms under a Location (
PhoenixKitLocations.Spaces+Schemas.Space, backed by core migration V122phoenix_kit_location_spaces). Edited as staged in-memory drafts that commit on the global Location save; floors are top-level tabs, rooms nest under the active floor. Block-on-invalid validation gate with a kind-aware flash that names the offending draft (“Floor 2 needs a name” / “Room 1 in Floor 2 needs a name”). Floor delete cascades to its rooms; partial-save failures keep the failed drafts on the page. Context guards the same-Location parent invariant and indirect-cycle prevention (depth-bounded walk-up). - Attachments — scope-aware Files cards + featured-image picker per Location and per Space draft (
PhoenixKitLocations.Attachments), routing drag-and-drop uploads to the right scope. - Per-draft independent language selector on floor and room editors.
PhoenixKitLocations.Errorsatoms for Spaces::space_not_found,:parent_in_other_location,:parent_not_found,:cycle,:parent_floor_unsaved.
Changed
- Dependency floor raised:
{:phoenix_kit, "~> 1.7.105"}→"~> 1.7.125". 1.7.125 is the first core release shipping migration V122; the Spaces feature would have no table on older cores. - Locations/Types in-page tab nav removed in favor of the PhoenixKit admin dashboard’s sibling subtabs; replaced with
<.admin_page_header>. Name cells in both tables now navigate to the edit page on click. - Full-width admin layout across all three LiveViews (forms capped at an inner
max-w); dropped the deprecatedback=attr from headers.
Fixed
- Saving a Location with no staged spaces no longer crashes the form —
persist_space_drafts/3had a dead[] -> nilclause shadowing the{nil, MapSet.new()}clause, so the empty-drafts path raised aMatchErroron the (common) spaceless save. Spaces.reorder_siblings/4no longer silently no-ops for root-level floors — a pinnedparent_uuid == ^nilcompiled to SQL= NULL(zero rows); thenil-parent case now usesis_nil/1.Spaces.update_space/3’s cycle check now readsparent_uuidunder both string and atom keys (via a sharedfetch_attr/2), matching the parent-location check — an atom-keyedattrsmap no longer bypasses the guard.check_parent_under_location/2returns the accurate:parent_not_foundwhen a parent UUID doesn’t exist, instead of conflating it with:parent_in_other_location.
Quality
mix precommitclean:compile --force --warnings-as-errors,deps.unlock --check-unused,format --check-formatted,credo --strict,dialyzerall pass. Restoredhandle_event/3andpersist_room/5clause grouping that the Spaces work had split (which--warnings-as-errorsrejected).- Pure-helper test suites for
Spaceschema,Attachmentshelpers, and the newErrorsatoms.
Locations 0.2.0. Install or update: {:phoenix_kit_locations, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.