View Source Adminable behaviour (Adminable v0.5.0)
Behaviour to capture how to build admin interfaces and which fields to allow to edit
Configuration
- Add
use Adminableto your Ecto Schema. Optionally
defmodule MyApp.User do
use Ecto.Schema
import Ecto.{Query, Changeset}, warn: false
use Adminable
...
endoptionally implement
fields/0,create_changeset/2andedit_changeset/2Forward 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"}
])
endArguments
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 MyWebModulelayout- (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
Specs
create_changeset(any(), any()) :: Ecto.Changeset.t()
Returns a changeset used for creating new schemas
Specs
edit_changeset(any(), any()) :: Ecto.Changeset.t()
Returns a changeset used for editing existing schemas
Specs
fields() :: [atom()]
A list of fields for to show and edit in Adminable. The primary key will be excluded from create and edit forms