CRM 0.2.0: An Organizations tab for organization accounts
CRM 0.2.0 replaces the empty Companies placeholder with a working Organizations tab. It lists the site’s user accounts of the organization type, with the same column picker as the role pages. The release renames the tab’s address and setting, so links and custom code may need an update.
The Organizations tab
The tab at /admin/crm/organizations lists every user account whose type is organization. Each administrator picks the columns to show, can switch between a table and cards, and clicks a row to open the account in PhoenixKit’s user view. Rows on the role pages open the user view in the same way.
The tab follows PhoenixKit’s own organization accounts setting (enable_organization_accounts) instead of a CRM switch. The Enable Companies option is gone from the CRM settings page. When organization accounts are off, the tab is hidden and opening it says “Organization accounts are not enabled.”
Smaller changes
- The page texts, messages, table headers and column names go through translation, using the host app’s translations. Column names that were in Russian now use English as their base text.
- The role pages and the Organizations tab load their data once per visit instead of twice.
- Status badges use the shared PhoenixKit badge component.
- A crash in the sidebar when role tabs were added at runtime is fixed.
Upgrading
No migration. Update the dependency, then check these renames:
- The address
/admin/crm/companiesis now/admin/crm/organizations. Update bookmarks and links. - The
crm_companies_enabledsetting is no longer used. Turn on organization accounts in PhoenixKit to show the tab. - For custom code:
PhoenixKitCRM.Web.CompaniesViewis nowOrganizationsView, the tab id is:admin_crm_organizationsandPaths.companies/0isPaths.organizations/0. Saved column choices for the old Companies tab are still read, with a warning in the log.
Full release notes: CRM 0.2.0
0.2.0 · 4 May 2026
Companies → Organizations pivot, i18n foundation, LiveView lifecycle
correctness, and a runtime-crash hotfix. The Companies placeholder is
replaced with a real Organizations subtab that lists users whose
account_type = "organization". All user-facing strings are routed
through gettext. Six public-API renames (scope atom, setting key,
module, path, tab id, Paths helper) make this a breaking release.
Breaking
- Scope rename —
:companies→:organizationseverywhere (PhoenixKitCRM.UserRoleView.scope/0,ColumnConfigkeys,UserRoleViewConfigrows).scope_from_string/1keeps a fallback that decodes the legacy"companies"string to:organizationswith aLogger.warningso existing DB rows don’t crash on read — host apps should plan a one-shot data migration to rewrite stored scope strings. - Setting key rename —
crm_companies_enabled→enable_organization_accounts. The Companies-feature toggle on the CRM settings page is removed; visibility of the Organizations subtab is gated on the PhoenixKit-wideenable_organization_accountssetting instead. - Module rename —
PhoenixKitCRM.Web.CompaniesView→PhoenixKitCRM.Web.OrganizationsView. Host apps with customlive_view:overrides need to update. - Route rename —
/admin/crm/companies→/admin/crm/organizations. Bookmarks and external links break. - Tab id rename —
:admin_crm_companies→:admin_crm_organizationsinPhoenixKitCRM.admin_tabs/0. - Path helper rename —
PhoenixKitCRM.Paths.companies/0→PhoenixKitCRM.Paths.organizations/0.
Added
Organizationssubtab — real LiveView (replaces the legal-entity placeholder) listing users typed as organizations viaPhoenixKit.Users.Auth.list_organizations/0. Per-user column config, card/table view toggle, navigation to the PhoenixKit core user view on row click.PhoenixKitCRM.Paths.user_view/1— centralized helper for navigating to PhoenixKit core’s user-view page from CRM tables. Empty-string guard raisesArgumentError.- i18n foundation —
use Gettext, backend: PhoenixKitWeb.Gettextwired into module-level code. All flashes, page titles, admin tab labels, modal UI strings, table headers, empty states, and column labels go throughgettext/1.ngettextfor the user-count plural. Russian column labels in the legacy Companies schema converted to English msgids;ColumnConfig.translate_labels/1appliesgettextonce at the access point so all consumers see translated labels. Nopriv/gettext/shipped — translations remain the host app’s responsibility (matches sibling-module convention). - Whole-row click navigation — table rows in
RoleViewandOrganizationsVieware clickable and navigate to the user-view page viaphx-click="navigate_to_user". - Integration tests (+25) —
role_settings_integration_test.exsanduser_role_view_integration_test.exsexercise real DB round-trips for upsert, scope isolation, and cross-scope rejection. Tagged:integrationfor opt-in. - GitHub Actions CI workflow — first CI workflow in the
phoenix_kit_*family. Cachesdeps/,_build/,priv/plts/onmix.lock. Runscompile --warnings-as-errors,quality.ci(format check + credo –strict + dialyzer), andmix test.
Changed
- LiveView lifecycle (
mount/3+handle_params/3split) —RoleViewandOrganizationsViewkeep gates inmount/3and move data loading intohandle_params/3underif connected?(socket). At most one DB query per connected mount (eliminates the duplicate query from the static-render pass). RoleSettings.list_eligible_roles/0— filter switched from fragile name-match (role.name in ["Owner", "Admin"]) to the booleanrole.is_system_role.ColumnConfig.available_columns/1— labels are now translated viagettextat the access point, so modal/header/card consumers all see the translated string.- Admin tab paths standardized to absolute form — every CRM
module tab path is now absolute (
/admin/crm/...). Hotfixes a runtime crash whereTabregistrations viaRegistry.register/2(used for role subtabs) bypassedTab.resolve_path/2and surfacedRuntimeError: Url path must start with "/"fromRoutes.path/2. - HEEx
:ifmigration —<%= if %>blocks inColumnModalreplaced with:if={...}attributes (better diffing, statically analyzable). - Status badges — raw HTML
<span class="badge ...">replaced with thePhoenixKitWeb.Components.Core.StatusBadgecomponent (consistent styling, theme-aware). Paths.role/1— empty-string input now raisesArgumentErrorinstead of producing a malformed URL.
Fixed
mount/3no longer issues database queries (was called twice per initial load: HTTP + WebSocket).- Sidebar render no longer crashes when role subtabs are registered
via
Registry.register/2with relative paths. Paths.user_view/1line wrapped to satisfymix format --check-formatted(post-merge cleanup).
Notes
- The CHANGELOG 0.1.0 entry forecast that “the Companies legal-entity schema lands in 0.2.x.” The actual 0.2.0 release pivots away from legal-entity modeling and toward listing already-typed organization user accounts. The legal-entity schema remains future work, un-scheduled.
- Per-role uuid-aware columns are still scaffolded (the
available_columns/1clause pattern-matches the role uuid away); picking up uuid-keyed customization is out of scope here. - Five non-blocking review observations are recorded in
dev_docs/pull_requests/2026/2-cleanup-i18n-hotfix/POST_MERGE_FEEDBACK.mdfor follow-up PRs.
CRM 0.2.0. Install or update: {:phoenix_kit_crm, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.