Catalogue 0.1.11: Nested categories, files and item metadata
Catalogue 0.1.11 lets categories nest inside each other, gives items and catalogues a featured image and attached files, and adds metadata fields to items.
What’s new
- The category form has a Parent category field, and Move to Another Parent moves a category with its subcategories. A catalogue’s page shows the tree indented. Deleting or restoring a category covers its subtree, and restoring also brings back deleted parents. A category cannot be placed under one of its own children.
- The item form gets Details, Metadata and Files tabs. Files holds a Featured Image and Attached Files, up to 20 files of 100 MB each; the catalogue form gets the same. A removed file goes to trash when nothing else uses it.
- Metadata offers Color, Weight, Width, Height, Depth, Material and Finish. A field dropped from that list but still holding a value shows as Legacy.
- Item and catalogue forms no longer crash on stray background messages.
Upgrading
Nested categories need PhoenixKit 1.7.103 or later for the V103 migration: run mix phoenix_kit.update first. Existing categories stay at the top level.
Full release notes: Catalogue 0.1.11
0.1.11 · 22 April 2026
Added
- Nested categories (requires phoenix_kit 1.7.103+ for the V103
parent_uuidself-FK migration). NewPhoenixKitCatalogue.Catalogue.Treemodule with recursive-CTE helpers (subtree_uuids/1,descendant_uuids/1,ancestor_uuids/1,ancestors_in_order/1) plus pure in-memory walkers (build_children_index/1,walk_subtree/3) for preloaded trees. CTEs useUNION(notUNION ALL) for defense-in-depth cycle safety. Catalogue.move_category_under/3— same-catalogue reparent with:would_create_cycle/:cross_catalogue/:parent_not_foundrejection;nilpromotes to root.Catalogue.list_category_tree/2returns[{category, depth}]with orphan promotion (deleted-ancestor children surface as roots) and an:exclude_subtree_ofoption for parent pickers.Catalogue.list_category_ancestors/1(delegates toTree.ancestors_in_order/1) for breadcrumbs.search_items/2gains:include_descendants(defaulttrue) so a category-scoped search also matches items in descendant categories. Passfalsefor the literal-set semantics.- Attachments — new
PhoenixKitCatalogue.Attachmentsmodule shared by item + catalogue forms. Folder-per-resource, featured-image pointer, inline files dropzone (20 files / 100 MB /auto_upload: true), pending-folder rename on first save. Smart detach splits home-folder vsFolderLinkfiles;list_files_in_folder/1capped at 200 rows. Save button disabled while uploads are in flight. - Item metadata — new
PhoenixKitCatalogue.ItemMetadatamodule with a global opt-in list of fields stored onitem.data["meta"]. Labels are gettext-wrapped; legacy keys (dropped from code but still held by an item) surface as “Legacy” rows with a remove-only action so deleting a definition never wipes stored data. - Item picker — new
PhoenixKitCatalogue.Web.Components.ItemPickercombobox LiveComponent with server-side search,:category_uuids/:catalogue_uuidsscoping,:include_descendantstoggle,:excluded_uuidsdim-and-disable, colocated keyboard hook (ArrowUp/Down, Home/End, Enter, Escape),has_more“type to refine” sentinel, and render-shape tests.
Changed
- Category position scoping moved from
catalogue_uuidto(catalogue_uuid, parent_uuid)—next_category_position/2now takes aparent_uuidarg (defaultnilfor root). swap_category_positions/3refuses{:error, :not_siblings}when the two categories live under different parents or in different catalogues.trash_category/restore_category/permanently_delete_categorywalk the whole subtree in one transaction.restore_categoryalso restores deleted ancestors + the parent catalogue so the restored node is reachable. Activity metadata carriessubtree_size+items_cascaded.move_category_to_cataloguecarries the subtree along in a transaction; takesSELECT … FOR UPDATEon the moved row and computes the target position after the subtree has moved — closes the stale-position race flagged in prior reviews.list_all_categories/0renders full breadcrumbs ("Catalogue / Parent / Child") and loads in two queries instead of N+1 per catalogue.Category.changesetrejects self-parent;create_category/2andupdate_category/3additionally guard against cross-catalogue and descendant-as-parent (cycle) cases at the context level, so raw API / form callers can’t bypassmove_category_under/3.
Fixed
- Catch-all
handle_info/2onCatalogueFormLiveandItemFormLive— stray monitor signals used to crash these forms. phx-disable-withon every Move button (category-under-parent, category-to-catalogue, item-to-category, item-to-smart-catalogue).Attachments.soft_trash_file/1is inlined to avoid depending on the unreleasedPhoenixKit.Modules.Storage.trash_file/1.- Credo / dialyzer clean after refactors: nested-too-deep in meta handlers, cyclomatic-10
file_type_from_mime, opaque MapSet inlist_category_tree, unreachableread_string/2fallback.
Catalogue 0.1.11. Install or update: {:phoenix_kit_catalogue, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.