[PAGES-488] More versatile url property in template definition Created: 24/Aug/21 Updated: 02/Nov/21 Resolved: 05/Oct/21 |
|
| Status: | Closed |
| Project: | Magnolia pages module |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2.12 |
| Type: | Task | Priority: | Neutral |
| Reporter: | Robert Šiška | Assignee: | Canh Nguyen |
| Resolution: | Done | Votes: | 0 |
| Labels: | VN-Implementation | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 3d 7h | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||
| Task DoR: |
Empty
|
||||||||||||||||||||||||||||||||
| Documentation update required: |
Yes
|
||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||
| Epic Link: | External SPA | ||||||||||||||||||||||||||||||||
| Sprint: | HL & LD 37, HL & LD 38 | ||||||||||||||||||||||||||||||||
| Story Points: | 3 | ||||||||||||||||||||||||||||||||
| Description |
|
The external page editor sets the external SPA URL to the iframe. When the iframe is loaded, the SPA will get href from the iframe window to get necessary params to fetch data from the REST endpoint. There's a problem that multiple pages can have a same page definition but each page needs different path/params to initialize. To support multiple pages with a same page definition and each page has different URL, we should support the url property in template definition as url template like:
The params to be added to the URL could be the node's properties and some extra params when the page editor is in edit mode/preview mode. |
| Comments |
| Comment by Mikaël Geljić [ 30/Aug/21 ] |
|
| Comment by Christopher Zimmermann [ 21/Sep/21 ] |
|
canh.nguyen which parameters are supported now - is it as suggested in description or how? |
| Comment by Canh Nguyen [ 21/Sep/21 ] |
|
czimmermann currently, it supports all page node attributes, included custom attributes that we add to the node. Nested attributes are not supported yet. |
| Comment by Christopher Zimmermann [ 05/Oct/21 ] |
|
canh.nguyen Can you update description with how it actually works now? |
| Comment by Canh Nguyen [ 05/Oct/21 ] |
|
The definition has three new properties:
The value will be encoded, but the param inside `{{ }}` will not be encoded. All node's attributes are supported. In case developers want to support more params, they need to implement SpaRouter. Pages editor will resolve routeTemplate and join baseUrl and resolved routeTemplate into complete URL Update: Each implementation of SpaRouter is expected to have a constructor that has SpaRenderableDefinition param |
| Comment by Christopher Zimmermann [ 11/Oct/21 ] |
|
canh.nguyen How exactly do I use spaRouterClass, can you provide an example? |
| Comment by Canh Nguyen [ 11/Oct/21 ] |
|
czimmermann it's like: spaRouterClass: info.magnolia.pages.spa.routing.DefaultSpaRouter We need to register an implementation of SpaRouter class in case we have a custom one. |
| Comment by Christopher Zimmermann [ 12/Oct/21 ] |
|
FYI I got errors with
routeTemplate: {{path}}
But this worked:
routeTemplate: '{{@path}}'
cc: mdrapela |