Uploaded image for project: 'Magnolia Javascript Models'
  1. Magnolia Javascript Models
  2. JSMODELS-4

Provide samples of how to use JS models

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Neutral
    • None
    • None
    • None
    • 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

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                jsimak Jaroslav Simak
                czimmermann Christopher Zimmermann
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoR