ExTeal.Resource behaviour (ExTeal v0.21.0) View Source

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
  alias ExTeal.Fields.{ID, F}
  def resource, do: Blog

  def title, do: "blog"

  def fields, do: [

  ]
end

Link to this section 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.

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.

Link to this section Types

Specs

attributes() :: map()

Specs

id() :: String.t() | integer()

Specs

orderable_key() ::
  :asc
  | :asc_nulls_first
  | :asc_nulls_last
  | :desc
  | :desc_nulls_first
  | :desc_nulls_last

Specs

orderable_option() :: {orderable_key(), atom()}

Specs

params() :: map()

Specs

record() :: struct()

Specs

records() :: [record()]

Specs

t() :: module()

Specs

validation_errors() :: Ecto.Changeset.t() | keyword()

Link to this section Callbacks

Specs

cards(Plug.Conn.t()) :: [module()]

Provide a list of action cards to render them above the resource index

Specs

default_order() :: [orderable_option()]

Override the default ordering of the index.

Specs

hide_from_nav() :: boolean()

Hide the Resource from the sidenav in the user interface, defaults to false.

Specs

nav_group(Plug.Conn.t()) :: String.t() | nil

If you would like to separate resources into different sidebar groups, you can override the nav_group/1 function on the resource.

Specs

skip_sanitize() :: boolean() | nil

Allows skipping sanitize for all fields on a resource

Specs

sortable_by() :: String.t() | nil

Specifies the field to use as the basis for a drag and drop interface for the collection.

Link to this section Functions

Link to this function

map_to_json(resources, conn)

View Source