View Source ExTeal.Resource.Fields behaviour (ExTeal v0.27.0)

Provides the fields/0 callback used by the following ExTeal actions:

  • ExTeal.Resource.Index

Summary

Callbacks

Used to get the fields available to the current action.

Callbacks

@callback fields() :: [ExTeal.Field.t()]

Used to get the fields available to the current action.

All resources will override this:

def fields(), do: [
  Id.make() |> sortable(),
  Text.make('Name') |> sortable(),
  DateTime.make(:updated_at, 'Last Updated At') |> hide_from_index()
]

Functions

Link to this function

add_panel_key(field, arg2)

View Source
Link to this function

apply_can_see(field, conn)

View Source
@spec apply_can_see(ExTeal.Field.t(), Plug.Conn.t()) :: ExTeal.Field.t() | nil

Apply the can_see function attached to a field to filter out the field from serialized responses.

Link to this function

apply_values(fields, model, resource, conn, type, panel \\ nil)

View Source
Link to this function

field_for(resource, name)

View Source
Link to this function

fields_for(atom, resource)

View Source
Link to this function

fields_for_has_many(resource, conn)

View Source
Link to this function

fields_for_many_to_many(resource_queried, conn)

View Source

Instead of returning the fields for an index table of a resource, this function is called to render a simple belongs to field via a ManyToManyBelongsTo field.

Given a many to many relationship between posts and tags, an index query for the tags associated with a post should return a single many to many belongs to field that represents a tag associated with the post. The field will then have options built up to make it behave like a belongs_to on the client side.

Link to this function

fields_from_model(model)

View Source
Link to this function

index_fields(resource, conn)

View Source
Link to this function

index_fields_for_many(relationship_field, queried_resource)

View Source
Link to this function

meta_for(atom, data, all, total, resource, conn)

View Source
Link to this function

pivot_fields_for(related, rel, queried)

View Source
Link to this function

relationship_field(related_resource, rel)

View Source

Find the field on the resource that includes context for the relationship that is being queried.

Link to this function

serialize_response(method, resource, data, conn)

View Source