View Source AdminElf.Resource behaviour (admin_elf v1.1.0)

Summary

Callbacks

@callback actions(conn :: Plug.Conn.t()) :: [AdminElf.ActionHelpers.action()]
@callback allow_creation(conn :: Plug.Conn.t()) :: boolean()
Link to this callback

create_resource(conn, attrs)

View Source (optional)
@callback create_resource(
  conn :: Plug.Conn.t(),
  attrs :: any()
) :: {:ok, created_item :: any()} | {:error, reason :: term()}
Link to this callback

delete_resource(conn, item)

View Source (optional)
@callback delete_resource(
  conn :: Plug.Conn.t(),
  item :: term()
) :: {:ok, deleted_item :: any()} | {:error, reason :: term()}
@callback details_layout(conn :: Plug.Conn.t()) :: [AdminElf.LayoutHelpers.component()]
Link to this callback

filters(conn)

View Source (optional)
@callback filters(conn :: Plug.Conn.t()) :: [AdminElf.InputHelpers.input()]
Link to this callback

form_layout(conn)

View Source (optional)
@callback form_layout(conn :: Plug.Conn.t()) ::
  [AdminElf.LayoutHelpers.component()] | {module(), binary(), keyword()}
Link to this callback

get_resource(conn, item_id)

View Source
@callback get_resource(
  conn :: Plug.Conn.t(),
  item_id :: String.t()
) :: {:ok, resource :: term()} | {:error, reason :: term()}
Link to this callback

index_table(conn)

View Source (optional)
@callback index_table(conn :: Plug.Conn.t()) :: [AdminElf.TableHelpers.column()]
@callback item_display_name(term()) :: String.t()
@callback item_id(term()) :: String.t()
Link to this callback

list_resource(conn, page, per_page, order, filter)

View Source (optional)
@callback list_resource(
  conn :: Plug.Conn.t(),
  page :: pos_integer(),
  per_page :: pos_integer(),
  order :: keyword(atom()),
  filter :: map()
) :: {items :: list(), count :: pos_integer()}
@callback name() :: String.t()
@callback plural_name() :: String.t()
@callback quick_actions(conn :: Plug.Conn.t()) :: [atom()] | keyword()
Link to this callback

update_resource(conn, item, attrs)

View Source (optional)
@callback update_resource(
  conn :: Plug.Conn.t(),
  item :: any(),
  attrs :: any()
) :: {:ok, updated_item :: any()} | {:error, reason :: term()}

Functions

Link to this function

create_resource(conn, admin, id, params)

View Source
Link to this function

delete_resource(conn, admin, id, item)

View Source
Link to this function

get_actions(conn, admin, id)

View Source
Link to this function

get_allow_creation(conn, admin, id)

View Source
Link to this function

get_details_layout(conn, admin, id)

View Source
Link to this function

get_filters(conn, admin, id)

View Source
Link to this function

get_form_layout(conn, admin, id)

View Source
Link to this function

get_index_table(conn, admin, id)

View Source
Link to this function

get_item_display_name(conn, admin, id, item)

View Source
Link to this function

get_item_id(conn, admin, id, item)

View Source
Link to this function

get_name(conn, admin, id)

View Source
Link to this function

get_plural_name(conn, admin, id)

View Source
Link to this function

get_quick_actions(conn, admin, id)

View Source
Link to this function

get_resource(conn, admin, id, item_id)

View Source
Link to this function

list_resource(conn, admin, id, page, per_page, order, filter)

View Source
Link to this function

update_resource(conn, admin, id, item, attrs)

View Source