thesis v0.3.4 Thesis.Store behaviour
Thesis.Store is an Elixir "behaviour" that defines the public function interface necessary for Thesis to use a particular store module.
There are currently four required functions, as described below.
Link to this section Summary
Callbacks
Retrieves all backups for a given slug. Returns the backup
Deletes the given page (identified by its slug).
Returns {:ok, page}
or {:error, changeset}
Returns a Thesis.Page struct with the given slug (aka request_path)
Returns a list of related Thesis.PageContent structs both for the given Thesis.Page struct and global content areas. This is generally used to populate the page content using the Thesis.View.content/4 function
Retrieves a given backup (identified by its id). Returns the backup
Updates the given page (identified by its slug) with the given map of
string keys and Thesis.PageContent structs.
Returns {:ok, page}
or {:error, changeset}
Link to this section Callbacks
backups(arg0)
backups(String.t()) :: [Thesis.Backup.t()]
backups(String.t()) :: [Thesis.Backup.t()]
Retrieves all backups for a given slug. Returns the backup.
backups(slug)
delete(%{})
Deletes the given page (identified by its slug).
Returns {:ok, page}
or {:error, changeset}
.
delete(%{"slug" => "/asdf"})
page(arg0)
page(String.t()) :: Thesis.Page.t()
page(String.t()) :: Thesis.Page.t()
Returns a Thesis.Page struct with the given slug (aka request_path).
page_contents(arg0)
page_contents(Thesis.Page.t()) :: [Thesis.PageContent.t()]
page_contents(Thesis.Page.t()) :: [Thesis.PageContent.t()]
Returns a list of related Thesis.PageContent structs both for the given Thesis.Page struct and global content areas. This is generally used to populate the page content using the Thesis.View.content/4 function.
restore(arg0)
restore(Integer.t()) :: Thesis.Backup.t()
restore(Integer.t()) :: Thesis.Backup.t()
Retrieves a given backup (identified by its id). Returns the backup.
restore(backup_id)
update(%{}, map)
Updates the given page (identified by its slug) with the given map of
string keys and Thesis.PageContent structs.
Returns {:ok, page}
or {:error, changeset}
.
update(%{"slug" => "/"}, %{"Heading" => "My Heading Content"})