PhoenixKitWeb.Live.Users.MediaDetail (phoenix_kit v2.62.2)

Copy Markdown View Source

The old address of a media file, /admin/media/:file_uuid.

A file's page is now the media view: /admin/media?file=<uuid> (or the browsing page of the library the file is in), where the picture, its details and its comments are. How it is stored is at /admin/media/:file_uuid/storage (PhoenixKitWeb.Live.Users.MediaStorage). Links already in the world — a comment's file link, a notification, a bookmark — keep working: this LiveView sends them to the media view and renders nothing of its own.

The helpers are the shared reading of "where does this file live": view_path/2 is the page that browses it, trail/2 the header trail above it.

Summary

Functions

The (canonical, unprefixed) path of the page that browses the library file is in: Media for the default library, /admin/media/library/<slug> for another site library, and for a user's library the page scope browses it in (Libraries.browse_path/2).

Callback implementation for Phoenix.LiveView.render/1.

The start of the header trail over a page about file, as {section, section_path, crumbs}: Media in the default library, Media / <library> in another site library, and a user's library under the page that browses it (Media or Libraries). section_path is canonical, unprefixed.

The prefixed path that opens file in the media view.

Functions

browse_path(file, scope)

@spec browse_path(PhoenixKit.Modules.Storage.File.t(), term()) :: String.t()

The (canonical, unprefixed) path of the page that browses the library file is in: Media for the default library, /admin/media/library/<slug> for another site library, and for a user's library the page scope browses it in (Libraries.browse_path/2).

mount(params, session, socket)

Callback implementation for Phoenix.LiveView.mount/3.

render(assigns)

Callback implementation for Phoenix.LiveView.render/1.

trail(file, scope)

@spec trail(PhoenixKit.Modules.Storage.File.t(), term()) ::
  {String.t(), String.t(), [map()]}

The start of the header trail over a page about file, as {section, section_path, crumbs}: Media in the default library, Media / <library> in another site library, and a user's library under the page that browses it (Media or Libraries). section_path is canonical, unprefixed.

view_path(file, scope)

@spec view_path(PhoenixKit.Modules.Storage.File.t(), term()) :: String.t()

The prefixed path that opens file in the media view.