Pax.Interface.Context (Pax v0.0.1-dev)
View SourceThe Pax Interface Context contains information on how to build the page; Accessed with @pax
in templates.
This module defines a struct and some helper functions for assigned values into it easily.
Context fields
module
- The module that is using the Pax Interfaceadapter
- The adapter module to use for the interfaceplugins
- A list of plugins to use for the interfaceaction
- The current action being performed, one of:index
,:show
,:edit
,:new
or:delete
objects
- A list of objects to display, for the:index
actionobject
- The current object being displayed in:show
,:edit
or:delete
actionsobject_count
- The number of objects in the:objects
listurl
- The URL of the current pageform
- The form to use for the current object in:new
or:edit
actionssingular_name
- The singular name of the objectplural_name
- The plural name of the objectobject_name
- The name of the object being displayedindex_path
- The path to the index pagenew_path
- The path to the new pageshow_path
- The path to the show pageedit_path
- The path to the edit pagefields
- A list of fields to display in the index pagescope
- A map of scope values to use for the adapter, see the Scope sectionprivate
- A map of private values for pax internals and plugins to use.
Scope
The :scope
map is used to pass information to the adapter for it to do some of its basic operations, such as
fetching objects for the index pages, or fetching individual objects for the show, edit and delete pages. The main
purpose of the scope is to decouple the interface, plugins and implementing module from the adapter, so that the
adapter is not concerned with any of those things, it simply operates on a set of expected keys in the scope. In this
way the adapter is only loosely coupled with the rest of the system.
Any keys can be set in the scope, since it's a map, but adapter(s) will only be expecting certain keys to be set, and the interface and plugins will only set certain keys. All of these interactions should be documented in the respective modules.
Summary
Functions
Assigns a value to the :pax
context in the socket or assigns map.
Assigns a value a map in the :private
map in the :pax
context in the socket or assigns map.
Assigns a value to the :scope
map in the :pax
context in the socket or assigns map.
Functions
Assigns a value to the :pax
context in the socket or assigns map.
Assigns a value a map in the :private
map in the :pax
context in the socket or assigns map.
Assigns a value to the :scope
map in the :pax
context in the socket or assigns map.