[PAGES-175] Create area nodes when editing a SPA Created: 01/Apr/19  Updated: 07/Feb/24  Resolved: 13/Aug/19

Status: Closed
Project: Magnolia pages module
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Major
Reporter: Christopher Zimmermann Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PAGES-1057 Paste action fails due to area node n... Open
supersession
is superseded by PAGES-192 Create/save parent area node upon sav... Open
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:
Epic Link: SPA Editor
Sprint: SPA Editor 1
Story Points: 2

 Description   

First goal: checkout minimal project, verify behavior, try to come up with proper autoGeneration.

User story:

As a content author I need the page editor to create new area nodes when I create a new page or when I place a component which has areas, so that I can properly use the Page Editor

Notes:

Area nodes are not created for templates which do not include the 'area' directive in the template script. It is not enough to define the areas in template definition.

Acceptance criteria:

  • Area nodes are created when a new page is created, even when the page definition does not have a template script.
  • Area nodes are created when a new component is added to a page which contains areas, even when the component does not have a template script.

For additional rationale and information: https://documentation.magnolia-cms.com/display/DOCS61/SPA+genesis#SPAgenesis-WhyandwhenshouldAreaNodesbecreated

 



 Comments   
Comment by Christopher Zimmermann [ 09/Apr/19 ]

There is a mechanism for autogeneration of components. But as far as I can tell - there is no facility to autocreate area nodes, without autocreating component nodes, which is not what we want here. (https://documentation.magnolia-cms.com/display/DOCS57/Area+definition)

Comment by Christopher Zimmermann [ 09/Apr/19 ]

I tried to get autogeneration going on a page template definition going, but there was no noticible difference in behaviour. AKA it did not work.

 

templateScript: /atlaskit/templates/pages/standard.ftl
renderType: freemarker
visible: true
title: Atlaskit Standard Page
class: info.magnolia.module.jsmodels.rendering.JavascriptTemplateDefinition
modelPath: /atlaskit/templates/common/definition-extractor-model.js

autoGeneration:
  content:
    tester:
      nodeType: mgnl:area
      templateId: atlaskit:components/list-with-div
  generatorClass: info.magnolia.rendering.generator.CopyGenerator

areas:
  main:
    renderType: freemarker
    type: list
    templateScript: /atlaskit/templates/list-with-div.ftl
    availableComponents:
      title:
        id: atlaskit:components/page-title


Comment by Mikaël Geljić [ 09/Apr/19 ]

where does the tester name come from?
I believe you want to generate the main area node (and no components), so it should be named main too.
Re: templateId, again if we're not interested in a component, that won't help much, since areas don't have any id/template def, so omitting it should do.

Comment by Christopher Zimmermann [ 10/Apr/19 ]

I tried using the name of the area (In a new testcaset) "left", and removing a templateId. But still no success.

You can see the definition here: https://github.com/magnolia-community/react-area51-alpha/blob/autogenerate/mag-aliens-demo/light-modules/react-aliens/templates/pages/standard.yaml

Comment by Robert Šiška [ 15/Jul/19 ]

autoGeneration definition is indeed only meant for components. Whether the area node is auto-generated or not is decided by createAreaNode (true by default) and the actual creation is done when the freemarker renderer encounters the  [@cms.area] directive, which it never will in case of react's Virtual DOM...

One solution to this would be a custom render that would create the area nodes pro-actively, or somehow create them dynamically from the page editor.

Comment by Mikaël Geljić [ 13/Aug/19 ]

Closing as Won't do for now: as opposed to auto-generation, we may no longer create JCR content on the fly, upon mere delivery requests. Instead, we expect the SPA and/or Magnolia helpers to deal with absence of area nodes gracefully.
If an area is non-optional, then the client-side should act as if the area's node virtually existed; creation of a child component through its dialog may in turn create parent hierarchy (that one might spawn a more precise follow-up).

Generated at Mon Feb 12 06:16:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.