Pax.Admin.Site behaviour (Pax v0.0.1-dev)

View Source

This module is used to define the admin site for your application.

use Pax.Admin.Site

When you use Pax.Admin.Site this module will be imported to provide many convenience macros for defining the layout of your Admin Site. It will declare @behaviour Pax.Admin.Site and @before_compile Pax.Admin.Site. It will also define many attributes required by Pax.Admin for interoperability with your site. Finally it will define several functions that can be used to generate paths and URLs to parts of your Admin Site.

Summary

Callbacks

config params, session, socket

(optional)
@callback config(
  params :: Phoenix.LiveView.unsigned_params() | :not_mounted_at_router,
  session :: map(),
  socket :: Phoenix.LiveView.Socket.t()
) :: nil | map()

resources(params, session, socket)

(optional)
@callback resources(
  params :: Phoenix.LiveView.unsigned_params() | :not_mounted_at_router,
  session :: map(),
  socket :: Phoenix.LiveView.Socket.t()
) :: nil | list()

Functions

__using__(opts)

(macro)

This macro is used to define the admin site for your application. The :router option is required and should be the module name of your main site Router. This is required so that your Admin Site module can generate proper paths and urls for your Site Admin, which is used in the interface.

Example

use Pax.Admin.Site, router: MyAppWeb.Router

config(opts)

(macro)

config_for(site_mod, params, session, socket)

dashboard_path(site_mod)

match_resource(resources, section_name, resource_name)

resource(name, resource_mod, opts \\ [])

(macro)

resource_edit_path(site_mod, section \\ nil, resource, object_ids)

Get the path to the show page for a resource object.

resource_edit_url(site_mod, conn_or_socket_or_endpoint_or_uri, section \\ nil, resource, object_ids)

resource_index_path(site_mod, section \\ nil, resource)

resource_index_url(site_mod, conn_or_socket_or_endpoint_or_uri, section, resource)

resource_new_path(site_mod, section \\ nil, resource)

resource_new_url(site_mod, conn_or_socket_or_endpoint_or_uri, section, resource)

resource_show_path(site_mod, section \\ nil, resource, object_ids)

Get the path to the show page for a resource object.

resource_show_url(site_mod, conn_or_socket_or_endpoint_or_uri, section \\ nil, resource, object_ids)

resources_for(site_mod, params, session, socket)

section(name, opts \\ [], list)

(macro)