Details
-
Task
-
Resolution: Fixed
-
Neutral
-
None
-
None
-
None
-
-
Empty show more show less
-
Empty show more show less
-
Yes
-
Kromeriz 101, Kromeriz 103, Kromeriz 104, Kromeriz 105
-
8
Description
We should provide samples of how to work with Magnolia FTL data-structures in JS models.
They can be tricky to work with because one needs to know the data structure that is passed in to a JS function from the FTL. Samples will help with this and give developers a good starting point.
Samples can also help to illustrate possible use cases for the feature.
(Initiative validation: https://wiki.magnolia-cms.com/display/PMTEAM/Template+model+LDV)
Use cases to demonstrate:
- Keep templates simpler by moving logic into model.
- Processing the post of a frontend form.
- Communicating with Magnolia internals.
- Making a REST GET or POST
Probably the samples can best be delivered as one light module.
I created a few samples while testing the feature that may be useful as a starting point:
https://git.magnolia-cms.com/users/czimmermann/repos/js-model-samples/browse/light-modules/js-model-samples
There are some notes here: https://wiki.magnolia-cms.com/display/PMTEAM/LD+Testing+-+JS+Models
The samples should be documented with a README in the project, and should also be mentioned in Magnolia docs.
Checklists
Attachments
Issue Links
- relates to
-
JSMODELS-6 Bad type when passing a returned js object to another js function
-
- Closed
-