diff --git a/apps/admin/core/src/main/java/com/adobe/dx/admin/responsive/internal/ResponsiveInclude.java b/apps/admin/core/src/main/java/com/adobe/dx/admin/responsive/internal/ResponsiveInclude.java index 4742ac07..7bff896b 100644 --- a/apps/admin/core/src/main/java/com/adobe/dx/admin/responsive/internal/ResponsiveInclude.java +++ b/apps/admin/core/src/main/java/com/adobe/dx/admin/responsive/internal/ResponsiveInclude.java @@ -83,14 +83,17 @@ public class ResponsiveInclude extends SlingSafeMethodsServlet implements Resour public static final String RESOURCE_TYPE = "dx/admin/responsive/include"; private static final String PN_TYPE = "resourceType"; private static final String PN_LOOP = "dxResponsiveItem"; + private static final String PN_FOLLOW = "dxResponsiveFollow"; private static final String PN_NAME = "name"; private static final String PN_TITLE = "jcr:title"; + private static final String PN_PATH = "path"; private static final String PN_DESCRIPTION = "jcr:description"; private static final String PN_INVALID = "invalid"; private static final String SLING_FOLDER = "sling:Folder"; private static final String PN_RESOURCE_TYPE = "sling:" + PN_TYPE; private static final String MNT_PREFIX = "/mnt/override"; private static final String CONTENT_ROOT = "/content"; + private static final String APPS_PREFIX = "/apps/"; private static final String SLASH = "/"; Configuration configuration; @@ -289,6 +292,11 @@ void copyTree(Breakpoint[] breakpoints, Node referrer, Resource target, Breakpoi String name = childConf.getName(); if (breakpoint == null && childConf.hasProperty(PN_LOOP)) { loopTree(breakpoints, childConf, target); + } else if (breakpoint != null && childConf.hasProperty(PN_FOLLOW) && childConf.hasProperty(PN_PATH)) { + String path = childConf.getProperty(PN_PATH).getString(); + path = path.startsWith(SLASH) ? path : APPS_PREFIX + path; + Node followedChildConf = childConf.getSession().getNode(path); + copyTree(breakpoints, followedChildConf, target, breakpoint); } else { Node childTarget = targetNode.hasNode(name) ? targetNode.getNode(name) : targetNode.addNode(name, childConf.getPrimaryNodeType().getName()); logger.debug("writing tree {}", childTarget.getPath()); diff --git a/apps/admin/core/src/test/java/com/adobe/dx/admin/responsive/internal/ResponsiveIncludeTest.java b/apps/admin/core/src/test/java/com/adobe/dx/admin/responsive/internal/ResponsiveIncludeTest.java index e43fe617..e420e661 100644 --- a/apps/admin/core/src/test/java/com/adobe/dx/admin/responsive/internal/ResponsiveIncludeTest.java +++ b/apps/admin/core/src/test/java/com/adobe/dx/admin/responsive/internal/ResponsiveIncludeTest.java @@ -63,6 +63,8 @@ public void setup() { context.registerInjectActivateService(include, "appChange", true, "dialogRoots", new String[] {"/apps/dx"}, "cacheRoot", CACHE_ROOT_TEST); + String randomPath = "/some/path/with/an/item/container/anotherText"; + context.build().resource(randomPath, "sling:resourceType", "text", "name", "./anotherText"); context.build().resource(INCLUDE_ROOT, "sling:resourceType", ResponsiveInclude.RESOURCE_TYPE, "resourceType","dialog/panel") .siblingsMode() .resource("items/general", "sling:resourceType", "text", "name","./generalText") @@ -71,6 +73,7 @@ public void setup() { .resource("text", "sling:resourceType", "text", "name", "./respText") .resource("check", "sling:resourceType", "check", "name", "./check") .resource("checkType", "sling:resourceType", "checkType", "name", "./check@TypeHint") + .resource("include", "sling:resourceType","someInclude", "path", "/some/path/with/an/item/container", "dxResponsiveFollow", true) .commit(); context.currentResource(context.resourceResolver().getResource(INCLUDE_ROOT)); context.requestPathInfo().setSuffix(CONTENT_ROOT); @@ -82,25 +85,24 @@ public void testPath() { include.getIncludePath(context.currentResource())); } + void assertField(String path, String field, String value) { + ValueMap vm = getVM(path); + assertNotNull(vm); + assertEquals(value, vm.get(field)); + } + @Test public void testIncludeResourceBuilding() throws LoginException, RepositoryException { Resource resource = include.getIncludeResource(include.getBreakpoints(context.request()), context.currentResource()); assertNotNull(resource); assertEquals(CACHE_ROOT, resource.getPath()); assertEquals("dialog/panel", resource.getValueMap().get("sling:resourceType")); - ValueMap generalItem = getVM(CACHE_ROOT + "/items/general"); - assertNotNull(generalItem); - assertEquals("./generalText", generalItem.get("name")); - String tabletItem = CACHE_ROOT + "/items/respTablet"; - ValueMap vmTablet = getVM(tabletItem); - assertNotNull(vmTablet); - assertEquals("Tablet", vmTablet.get("jcr:title")); - ValueMap check = getVM(tabletItem + "/items/check"); - assertNotNull(check); - assertEquals("./checkTablet", check.get("name")); - ValueMap checkType = getVM(tabletItem + "/items/checkType"); - assertNotNull(checkType); - assertEquals("./checkTablet@TypeHint", checkType.get("name")); + String path = CACHE_ROOT + "/items/"; + assertField(path + "general","name", "./generalText"); + assertField(path + "respTablet","jcr:title", "Tablet"); + assertField(path + "respTablet/items/check","name", "./checkTablet"); + assertField(path + "respTablet/items/checkType", "name", "./checkTablet@TypeHint"); + assertField(path + "respDesktop/items/anotherText", "name", "./anotherTextDesktop"); } @Test diff --git a/apps/content/app/jcr_root/apps/dx/content/components/video/.content.xml b/apps/content/app/jcr_root/apps/dx/content/components/video/.content.xml new file mode 100644 index 00000000..19ed3747 --- /dev/null +++ b/apps/content/app/jcr_root/apps/dx/content/components/video/.content.xml @@ -0,0 +1,5 @@ + + diff --git a/apps/content/app/jcr_root/apps/dx/content/components/video/_cq_dialog/.content.xml b/apps/content/app/jcr_root/apps/dx/content/components/video/_cq_dialog/.content.xml new file mode 100644 index 00000000..0f992109 --- /dev/null +++ b/apps/content/app/jcr_root/apps/dx/content/components/video/_cq_dialog/.content.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/content/app/jcr_root/apps/dx/content/components/video/video.html b/apps/content/app/jcr_root/apps/dx/content/components/video/video.html new file mode 100644 index 00000000..f5ac8d10 --- /dev/null +++ b/apps/content/app/jcr_root/apps/dx/content/components/video/video.html @@ -0,0 +1,8 @@ +
+ +
\ No newline at end of file diff --git a/apps/docs/app/pom.xml b/apps/docs/app/pom.xml index f013c790..8bb23c7e 100644 --- a/apps/docs/app/pom.xml +++ b/apps/docs/app/pom.xml @@ -152,7 +152,7 @@ com.adobe.dx core - 0.1.0 + 0.1.1-SNAPSHOT com.adobe.dx diff --git a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/_cq_dialog/.content.xml b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/_cq_dialog/.content.xml index 6abdd18d..890a9122 100644 --- a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/_cq_dialog/.content.xml +++ b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/_cq_dialog/.content.xml @@ -362,119 +362,11 @@ jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete/list"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + path="dx/content/components/video/cq:dialog/content/items/column/items" + dxResponsiveFollow="{Boolean}true" + sling:resourceType="granite/ui/components/coral/foundation/include"/> diff --git a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html index 9de6e17d..3af41a25 100644 --- a/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html +++ b/apps/structure/app/jcr_root/apps/dx/structure/components/flex/flex.html @@ -16,6 +16,7 @@
+