[JSMODELS-4] Provide samples of how to use JS models Created: 16/May/17 Updated: 18/Jul/17 Resolved: 14/Jul/17 |
|
| Status: | Closed |
| Project: | Magnolia Javascript Models |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Neutral |
| Reporter: | Christopher Zimmermann | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoR: |
Empty
|
||||||||
| Documentation update required: |
Yes
|
||||||||
| Date of First Response: | |||||||||
| Epic Link: | LD: Fundamental features | ||||||||
| Sprint: | Kromeriz 101, Kromeriz 103, Kromeriz 104, Kromeriz 105 | ||||||||
| Story Points: | 8 | ||||||||
| Description |
|
We should provide samples of how to work with Magnolia FTL data-structures in JS models. Samples can also help to illustrate possible use cases for the feature. Use cases to demonstrate:
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: 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. |
| Comments |
| Comment by Jaroslav Simak [ 17/May/17 ] |
|
There's still some ugly bug that if you pass return javascript object (array, json) to the model, it's type gets changed and it does not behave as it should if you pass it again to another model function. As i can see it's described in the Some learnings section of the https://wiki.magnolia-cms.com/display/PMTEAM/LD+Testing+-+JS+Models page. It's something related to freemarker template object wrapping, so fixing it might be a little bit tricky. |
| Comment by Christopher Zimmermann [ 09/Jun/17 ] |
|
Yes I agree with: "Keep templates simpler by moving logic into model - this could be taken from samples you wrote earlier, wdyt?" can you add them? I would like to get them reviewed by you and some other members of the team with JS & FTL experience - such as fgrilli |
| Comment by Christopher Zimmermann [ 09/Jun/17 ] |
|
It feels a bit cluttered to have "libs" and "formProcessors" at the root, but I see that they do not make sense in "webresources" for example. (formProcessors is not a registry right?) |
| Comment by Christopher Zimmermann [ 09/Jun/17 ] |
|
Overall- what you have so far in the above repo looks great. |
| Comment by Jaroslav Simak [ 11/Jul/17 ] |
|
https://git.magnolia-cms.com/users/jsimak/repos/javascript-model-samples/browse |
| Comment by Evzen Fochr [ 13/Jul/17 ] |
|
piQA done on clone from jsimak repo. |