m_hierarchy (zotonic_core v1.0.0-rc.14)

Model for named hierarchies

Link to this section Summary

Functions

Go through the flattened tree and assign the range nrs
Return a list of all the ids below the id, excluding the id itself
Return the list of ids contained within (and including) the id.
Ensure that all resources are present in a hierarchy.
Ensure that all resources of a certain category are present in a hierarchy.
Fetch the value for the key from a model source
Transform a hierarchy to a menu structure
Return a list of all this id's ancestor nodes
Save a new hierarchy, replacing a previous one.
Fetch a 1 level deep tree
Fetch a named tree
Make a flattened list with indentations showing the level of the tree entries. Useful for select lists.

Link to this section Functions

Link to this function

append(Name0, Missing, Context)

Link to this function

assign_nrs(Diff, OldFlatNr)

Go through the flattened tree and assign the range nrs
Link to this function

children(Name, Id, Context)

Return a list of all the ids below the id, excluding the id itself
Link to this function

contains(Name, Id, Context)

Return the list of ids contained within (and including) the id.
Link to this function

ensure(Category, Context)

-spec ensure(atom() | binary() | string() | integer(), #context{}) -> {ok, integer()} | {error, term()}.
Ensure that all resources are present in a hierarchy.
Link to this function

ensure(Name, CatId, Context)

-spec ensure(atom() | binary() | string(), atom() | integer() | string(), #context{}) -> {ok, integer()}.
Ensure that all resources of a certain category are present in a hierarchy.
Link to this function

flush(Name, Context)

Link to this function

m_get(Rest, Msg, Context)

-spec m_get(list(), zotonic_model:opt_msg(), z:context()) -> zotonic_model:return().
Fetch the value for the key from a model source
Link to this function

parents(Name, Id, Context)

Return a list of all this id's ancestor nodes
Link to this function

save(Name, Tree, Context)

Save a new hierarchy, replacing a previous one.
Link to this function

save_nocheck(Name, NewTree, Context)

Link to this function

tree1(Tree, Context)

Fetch a 1 level deep tree
Link to this function

tree(Id, Context)

Fetch a named tree
Link to this function

tree_flat(Name, Context)

Make a flattened list with indentations showing the level of the tree entries. Useful for select lists.
Link to this function

tree_flat(Name, Id, Context)