View Source ExTeal.Resource behaviour (ExTeal v0.27.0)
When used, includes all aspects of the functionality required to manage the resource.
Example usage in a ExTeal Resource:
defmodule ExampleWeb.ExTeal.BlogResource do
use ExTeal.Resource
alias Example.Content.Blog
def resource, do: Blog
def title, do: "blog"
end
Summary
Callbacks
Provide a list of action cards to render them above the resource index
Override the default ordering of the index.
Hide the Resource from the sidenav in the user interface, defaults to false.
If you would like to separate resources into different sidebar groups, you can
override the nav_group/1
function on the resource.
Override the detail or edit link for a resource on the resource index.
Allows skipping sanitize for all fields on a resource
Specifies the field to use as the basis for a drag and drop interface for the collection.
Types
@type attributes() :: map()
@type indexed_resource() :: struct() | pivot_resource()
@type orderable_key() ::
:asc
| :asc_nulls_first
| :asc_nulls_last
| :desc
| :desc_nulls_first
| :desc_nulls_last
@type orderable_option() :: {orderable_key(), atom()}
@type params() :: map()
@type record() :: struct()
@type records() :: [record()]
@type t() :: module()
@type validation_errors() :: Ecto.Changeset.t() | keyword()
Callbacks
@callback cards(Plug.Conn.t()) :: [module()]
Provide a list of action cards to render them above the resource index
@callback default_order() :: [orderable_option()]
Override the default ordering of the index.
@callback skip_sanitize() :: boolean() | nil
Allows skipping sanitize for all fields on a resource
@callback sortable_by() :: String.t() | nil
Specifies the field to use as the basis for a drag and drop interface for the collection.