View Source Phoenix.UI.Helpers (Phoenix UI v0.1.9)

Provides helper functionality.

Link to this section Summary

Functions

Builds and normalizes list of classes.

Builds and normalizes list of classes.

Builds and normalizes list of classes.

Builds and normalizes list of classes.

Returns true if assigns field form data has error.

Returns true if attr data is a slot.

Translates an error message using gettext.

Translates the errors for a field from a keyword list of errors.

Link to this section Functions

Link to this function

assign_class(assigns, class_list)

View Source

Builds and normalizes list of classes.

examples

Examples

iex> assign_class(assigns, [" class1", "class2 ", ...])
%{class: "class1 class2 ...", ..}
Link to this function

assign_extend_class(assigns, extend_class_list)

View Source

Builds and normalizes list of classes.

examples

Examples

iex> assign_extend_class(assigns, [" class1", "class2 ", ...])
%{class: "class1 class2 ...", ..}
Link to this function

assign_rest(assigns, exclude \\ [])

View Source

Builds and normalizes list of classes.

examples

Examples

iex> assign_rest(assigns, exclude)
%{...}
@spec build_class([String.t()]) :: String.t()

Builds and normalizes list of classes.

examples

Examples

iex> build_class([" class1", "class2 ", ...])
"class1 class2 ..."
@spec has_error?(Phoenix.LiveView.Socket.assigns()) :: boolean()

Returns true if assigns field form data has error.

examples

Examples

iex> has_error(assigns)
true
@spec is_slot?(any()) :: boolean()

Returns true if attr data is a slot.

examples

Examples

iex> is_slot?(attrs)
true

Translates an error message using gettext.

Link to this function

translate_errors(errors, field)

View Source

Translates the errors for a field from a keyword list of errors.