PhoenixKit.Modules.Publishing.Web.Components.VersionSwitcher (phoenix_kit v1.7.71)

Copy Markdown View Source

Version switcher component for publishing posts.

Displays available versions as a compact inline list with status indicators. Used in the publishing editor to navigate between different versions of a post.

Display Format

Admin mode: v1 (●) | v2 (●) | v3 (○)

  • Green dot (●): Published (this IS the live version)
  • Yellow dot (●): Draft
  • Gray dot (●): Archived
  • Current version is highlighted

Examples

# Editor: switch between versions
<.publishing_version_switcher
  versions={@available_versions}
  version_statuses={@version_statuses}
  current_version={@current_version}
  on_click="switch_version"
/>

Summary

Functions

Renders a compact inline version switcher.

Functions

publishing_version_switcher(assigns)

Renders a compact inline version switcher.

Attributes

  • versions - List of version numbers (integers)
  • version_statuses - Map of version number => status string ("published", "draft", "archived")
  • version_dates - Map of version number => ISO 8601 date string (shown in tooltip)
  • current_version - Currently active version number
  • on_click - Event name for click handler
  • phx_target - Target for the event
  • class - Additional CSS classes
  • size - Size variant: :xs, :sm, :md (default: :sm)

Note: Only ONE version can have status "published" at a time. This is the live version.

Attributes

  • versions (:list) (required)
  • version_statuses (:map) - Defaults to %{}.
  • version_dates (:map) - Defaults to %{}.
  • current_version (:integer) - Defaults to nil.
  • on_click (:string) - Defaults to nil.
  • phx_target (:any) - Defaults to nil.
  • class (:string) - Defaults to "".
  • size (:atom) - Defaults to :sm. Must be one of :xs, :sm, or :md.