_createButton
Becomes a Create button for the received Model --
Function
Thing Type -> Thing Type._createButton
(label, classes) -> Value has not been set
- Receives -- Thing Type
- The Model to instantiate
: Defining Context (optional) : A Property -- if given, that Property on the new Instance will point back to here
- label
- The text to show on the button
- classes (optional)
- Display classes to apply to the button. If not specified, btn-default will be used.
- Produces
- The actual button on the page
This displays a button, with the given label, if the user is allowed to create Instances of that Model.
For example, say we have Models named Bookcase and Book. Book has a My Bookcase property, that points to the case it
is on. I want a button to show on Bookcase that creates a new Book on that case, and I want it to show using the "primary"
style (green). I would add a button to Bookcase, that looks like this:
[[Book -> My Bookcase._createButton(""Add a Book to this case"", classes=""btn-primary"")]]
Because I give My Bookcase as the Defining Context, Querki uses that property to point from the new Book back
to the Bookcase that created it.