View Source Bonfire.UI.Common (bonfire v0.3.5-classic-beta.10)

A library of common utils and helpers used across Bonfire extensions

Link to this section Summary

Functions

Warning: this will set assigns for any/all users who subscribe to them. You want to cast_self/2 instead if dealing with user-specific actions or private data.

copies the go param into a query string, if any

Generate a query string adding a go redirection path to the URI (for redirecting somewhere after auth flows). It is recommended to use set_go_after/2 where possible instead.

Special LiveView helper function which allows loading LiveComponents in regular Phoenix views: live_render_component(@conn, MyLiveComponent)

Broadcast some data for realtime updates, for example to a feed or thread

Subscribe to something for realtime updates, like a feed or thread

Subscribe to assigns targeted at the current account/user

Save a go redirection path in the session (for redirecting somewhere after auth flows)

Run a function and expects tuple. If anything else is returned, like an error, a flash message is shown to the user.

Link to this section Functions

Link to this function

assign_error(socket, msg)

View Source
Link to this function

assign_flash(socket_or_conn, type, message, assigns \\ %{})

View Source
Link to this function

assign_generic(socket, assigns)

View Source
Link to this function

assign_generic(socket, key, value)

View Source
Link to this function

assign_global(socket, assigns)

View Source
Link to this function

assign_global(socket, key, value)

View Source
Link to this function

assigns_merge(assigns, new)

View Source
Link to this function

assigns_merge(socket, assigns, new)

View Source
Link to this function

assigns_minimal(assigns)

View Source
Link to this function

assigns_subscribe(socket, assign_names)

View Source
Link to this function

boundaries_or_default(to_boundaries, opts)

View Source
Link to this function

cast_public(socket, assigns_to_broadcast)

View Source

Warning: this will set assigns for any/all users who subscribe to them. You want to cast_self/2 instead if dealing with user-specific actions or private data.

Link to this function

cast_self(socket, assigns_to_broadcast)

View Source

copies the go param into a query string, if any

Link to this function

current_url(socket_or_assigns, default \\ nil)

View Source
Link to this function

current_user_or_remote_interaction(socket, verb, object)

View Source
Link to this function

default_boundaries(opts \\ [])

View Source

Generate a query string adding a go redirection path to the URI (for redirecting somewhere after auth flows). It is recommended to use set_go_after/2 where possible instead.

Link to this function

live_render_component(conn, load_live_component)

View Source

Special LiveView helper function which allows loading LiveComponents in regular Phoenix views: live_render_component(@conn, MyLiveComponent)

Link to this function

live_render_with_conn(conn, live_view)

View Source
Link to this function

maybe_assign(socket, key, value)

View Source
Link to this function

maybe_consume_uploaded_entries(socket, key, fun)

View Source
Link to this function

maybe_consume_uploaded_entry(socket, key, fun)

View Source
Link to this function

maybe_last_sentry_event_id()

View Source
Link to this function

maybe_push_event(socket, name, data)

View Source
Link to this function

maybe_send_update(pid \\ self(), component, id, assigns)

View Source
Link to this function

patch_to(socket_or_conn, to \\ nil, opts \\ [])

View Source
Link to this function

path_fallback(socket_or_conn, opts)

View Source
Link to this function

pubsub_broadcast(topics, payload)

View Source

Broadcast some data for realtime updates, for example to a feed or thread

Link to this function

pubsub_subscribe(topics, socket)

View Source

Subscribe to something for realtime updates, like a feed or thread

Link to this function

redirect_to(socket_or_conn, to \\ nil, opts \\ [])

View Source
Link to this function

redirect_to_previous_go(conn, params, default, current_path)

View Source
Link to this function

self_subscribe(socket, assign_names)

View Source

Subscribe to assigns targeted at the current account/user

Link to this function

send_self(socket, assigns_to_broadcast)

View Source
Link to this function

set_go_after(conn, path \\ nil)

View Source

Save a go redirection path in the session (for redirecting somewhere after auth flows)

Link to this function

templated(content, data \\ nil)

View Source
Link to this function

templated_or_remote_markdown(content, data \\ nil)

View Source
Link to this function

undead(socket, fun, return_key \\ :noreply)

View Source
Link to this function

undead_error(error, socket, return_key \\ :noreply)

View Source
Link to this function

undead_mount(socket, fun)

View Source

Run a function and expects tuple. If anything else is returned, like an error, a flash message is shown to the user.

Link to this function

undead_params(socket, fun)

View Source