View Source ExTeal.Cards.Greeting behaviour (ExTeal v0.27.0)

Not the thing you get the mail, but a card that appears on the dashboard.

Summary

Types

Each link should be a map with the following keys

Callbacks

64px x 64px image url to display next to the greeting

Greeting for a user viewing the card. Defaults to 'Welcome back,'

Potentially HTML Rich text to display below the users title. Beware any unescaped / unsanitary HTML.

A list of links to display on a greeting card.

The name to greet the user by, use the conn to pull the currently authorized user.

The users title, useful in applications with RBAC or permissions

Types

@type link() :: %{
  optional(:button_classes) => String.t() | nil,
  label: String.t(),
  url: String.t()
}

Each link should be a map with the following keys:

  • label (required) the text to display on the link
  • url (required) the url to link to
  • button_classes (optional) a string of classes to apply to the link

Buttons default to a btn btn-default btn-secondary class definition if an override is not provided

Callbacks

@callback avatar_url(Plug.Conn.t()) :: String.t() | nil

64px x 64px image url to display next to the greeting

@callback greeting() :: String.t()

Greeting for a user viewing the card. Defaults to 'Welcome back,'

@callback helper_text(Plug.Conn.t()) :: String.t() | nil

Potentially HTML Rich text to display below the users title. Beware any unescaped / unsanitary HTML.

@callback links(Plug.Conn.t()) :: [link()]

A list of links to display on a greeting card.

@callback user_name(Plug.Conn.t()) :: String.t() | nil

The name to greet the user by, use the conn to pull the currently authorized user.

@callback user_title(Plug.Conn.t()) :: String.t() | nil

The users title, useful in applications with RBAC or permissions