Adminable v0.3.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],
view_module: MyAppWeb.Adminable.AdminView
layout: {MyAppWeb.LayoutView, "app.html"}
])
end
Arguments
otp_app
- Your apprepo
- Your app's Reposchemas
- The schemas to make Admin sections forview_module
- (Optional) The view_module to use to display pages. Uses Adminable's view module by default. You can export the view to modify usingmix adminable.gen.view MyWebModule
layout
- (Optional) The layout to use
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 Sourcecreate_changeset(any(), any()) :: Ecto.Changeset.t()
Returns a changeset used for creating new schemas
Link to this callback
edit_changeset(any, any)
View Sourceedit_changeset(any(), any()) :: Ecto.Changeset.t()
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