Adminable v0.1.0 Adminable behaviour View Source
Behaviour to capture how to build admin interfaces and which fields to allow to edit
Configuration
- Add
use Adminable
to your Ecto Schema. Optionally
defmodule MyApp.User do
use Ecto.Schema
import Ecto.{Query, Changeset}, warn: false
use Adminable
...
end
optionally implement
fields/0
,create_changeset/2
andedit_changeset/2
Forward to
Adminable.Router
scope "/admin" do
pipe_through [:browser, :my, :other, :pipelines]
forward("/", Adminable.Plug, [
otp_app: :my_app,
repo: MyApp.Repo,
schemas: [MyApp.User]
layout: {MyAppWeb.LayoutView, "app.html"}
])
end
Link to this section Summary
Callbacks
Returns a changeset used for creating new schemas
Returns a changeset used for editing existing schemas
A list of fields for to show and edit in Adminable. The primary key will be excluded from create and edit forms
Link to this section Callbacks
Link to this callback
create_changeset(any, any)
View Source
create_changeset(any, any)
View Source
create_changeset(any(), any()) :: Ecto.Changeset.t()
create_changeset(any(), any()) :: Ecto.Changeset.t()
Returns a changeset used for creating new schemas
Link to this callback
edit_changeset(any, any)
View Source
edit_changeset(any, any)
View Source
edit_changeset(any(), any()) :: Ecto.Changeset.t()
edit_changeset(any(), any()) :: Ecto.Changeset.t()
Returns a changeset used for editing existing schemas
Link to this callback
fields()
View Source
fields()
View Source
fields() :: [atom()]
fields() :: [atom()]
A list of fields for to show and edit in Adminable. The primary key will be excluded from create and edit forms