Document Creator 0.5.0: PhoenixKit 2.0, project documents and reliable composing
Document Creator 0.5.0 moves the module to PhoenixKit 2.0, adds a Documents tab to projects, and fixes several ways composed documents silently came out wrong: lost tables, broken formatting and variables that were never filled in.
Documents in projects
With the Projects module installed, a project can now show a Documents tab: a project holds any number of documents, and a document belongs to at most one project. The tab lists the linked documents, offers Attach an existing document with an Attach button, and lets you detach one after a confirmation. The tab starts turned off, as a Projects extension. To store the link, the module now has its own migrations, starting with V1, which adds a project column to documents.
Composing that no longer fails silently
- One blank variable made Google reject the whole update, while the module still reported success: none of the variables in the document were filled. Blank values now just remove the placeholder, and a rejected update is reported as an error.
- Appending a template dropped its tables, along with any variable that only lived inside a table cell.
- With more than one appended section holding tables, text from a later section could be written into an earlier section’s table.
- Column widths, bold and other character styles, alignment, line spacing, indents and bullets now survive an append.
- An appended section’s first paragraph no longer merges with the last paragraph before it.
Smaller fixes
A document whose Google Drive file was deleted outside the module can now be deleted from the list. Template names in Cyrillic or Greek produce a transliterated slug instead of an empty one. New categories and types go to the end of the list instead of the top. A document pointing at a trashed category or type shows a deleted category or deleted type badge instead of looking unset. The All Types filter now prefixes each type with its category, so same-named types can be told apart.
Upgrading
The module now needs PhoenixKit 2.0. Core 2.0 replaces its migration history with a single V135 starting point and refuses to migrate a database below it. Before upgrading, run mix phoenix_kit.status. If the database is below V135, first install phoenix_kit 1.7.236, migrate until the version is at least V135, then move to 2.0 and this release. After that, run mix phoenix_kit.update to apply the module’s migration V1.
Full release notes: Document Creator 0.5.0
0.5.0 · 10 August 2026
Changed
-
⚠️ Requires
phoenix_kit ~> 2.0. The core pin moved to~> 2.0, so this release no longer resolves against core 1.7.Core 2.0.0 squashes the migration chain into a single
V135baseline and makes V135 the chain’s floor:mix ecto.migratenow refuses on a database below it rather than migrating. Checkmix phoenix_kit.statusbefore upgrading. A host below V135 must installphoenix_kit 1.7.236— the migration bridge, the last release carrying the full pre-squash chain — migrate until the reported version is at least V135, and only then move to 2.0.This package does not call migration internals, so the change is the pin itself.
Fixed
- Silent
batchUpdatefailures (PR #33).batch_update/2was the only client function that never checked HTTP status — a 400 from Google returned{:ok, resp}and every caller reported success on an unmodified document.batchUpdateis atomic and rejectsinsertTextwith empty text, so a single blank variable voided every substitution in a composed document, with no error and no log. Blank values now emit only thedeleteContentRange. - Dropped tables on append (PR #33).
append_template/2flattened viaget_document_text/1, which walks only paragraph blocks, so tables — and any{{var}}living solely inside a table cell — were silently discarded. - Cross-section table corruption (PR #33). Pre-existing table positions were
read from
el["table"]["startIndex"], a field that does not exist in the real API (startIndexbelongs to the surroundingStructuralElement). Every pre-existing table reportednil, and Erlang term ordering sortsnilafter every integer — so once more than one table-bearing section was appended, a later section’s cell text was written into an earlier section’s table. Fixed at all four call sites; the existing test mocks had encoded the bug rather than the real API shape and were corrected. - Formatting loss on append (PR #33). Column widths, character styles,
alignment, line spacing, named styles, indents and list bullets now survive an
append, each stated explicitly (including
bold: false) so a fresh insert cannot inherit a neighbour’s formatting. - Section boundaries merged paragraphs (PR #33).
insertPageBreakinserts an inline element, not a paragraph break, so an appended section’s first paragraph structurally merged with the target’s last one and reformatted the preceding section’s tail. A literal newline now precedes the page break. - Delete succeeds for orphaned rows (PR #33). A row whose Drive file was
hard-deleted out-of-band could never be removed —
move_to_deleted_foldertreated the 404 as fatal. A missing file now proceeds with the DB soft-delete; a 404 on the move PATCH stays distinct as:move_failed. - Template slugs were still ASCII-only (PR #32). The delegation to core’s
Slug.slugify/1added in #31 was a silent no-op:transliteratedefaults tofalse, so the[^a-z0-9]+pass still deleted every Cyrillic character and a Cyrillic or Greek template name produced an empty slug — exactly the bug #31 set out to fix. Now passestransliterate: true.
Changed
- Taxonomy UX (PR #33): new categories/types default to one past the highest active sibling instead of position 0; stale references to trashed categories/types render a visible placeholder instead of looking cleared; the flattened “All Types” filter prefixes each type with its owning category.
Document Creator 0.5.0. Install or update: {:phoenix_kit_document_creator, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.