This is an automated email from the ASF dual-hosted git repository. dklco pushed a commit to branch SLING-7900 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 2213872beaf214a21ba111761a8d8613ead07e03 Author: JE Bailey <[email protected]> AuthorDate: Fri Sep 21 14:02:20 2018 -0400 ongoing breadcrumb changes --- .../sling/cms/core/models/components/Action.java | 6 -- .../cms/core/models/components/Breadcrumbs.java | 33 +++++++---- .../cms/core/models/components/ContentAction.java | 67 +++++++++------------- .../cms/core/models/components/ContentTable.java | 26 +++------ ui/src/main/frontend/src/scss/_overrides.scss | 1 + ui/src/main/resources/jcr_root/conf/cms.json | 2 + .../jcr_root/etc/taxonomy/jcr%3Acontent.json | 1 + .../libs/sling-cms/actions/sling%3APage.json | 6 +- .../cms/breadcrumbmenu/breadcrumbmenu.jsp | 1 - .../libs/sling-cms/components/pages/base/body.jsp | 25 ++++---- .../libs/sling-cms/components/pages/base/nav.jsp | 2 +- .../{taxonomy/list.json => browse/browse.json} | 43 +++++++------- .../jcr_root/libs/sling-cms/content/page/edit.json | 6 +- .../sling-cms/content/page/siteeditproperties.json | 2 +- .../libs/sling-cms/content/taxonomy/list.json | 1 + 15 files changed, 102 insertions(+), 120 deletions(-) diff --git a/core/src/main/java/org/apache/sling/cms/core/models/components/Action.java b/core/src/main/java/org/apache/sling/cms/core/models/components/Action.java index bde08fe..a7a98cd 100644 --- a/core/src/main/java/org/apache/sling/cms/core/models/components/Action.java +++ b/core/src/main/java/org/apache/sling/cms/core/models/components/Action.java @@ -16,7 +16,6 @@ */ package org.apache.sling.cms.core.models.components; -import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.sling.api.resource.Resource; @@ -33,11 +32,6 @@ public class Action extends BaseModel { @Inject boolean target; - @PostConstruct - public void init() { - System.out.println("here"); - } - public String getClasses() { String response = "button"; if (modal) { diff --git a/core/src/main/java/org/apache/sling/cms/core/models/components/Breadcrumbs.java b/core/src/main/java/org/apache/sling/cms/core/models/components/Breadcrumbs.java index 71b7075..aab750c 100644 --- a/core/src/main/java/org/apache/sling/cms/core/models/components/Breadcrumbs.java +++ b/core/src/main/java/org/apache/sling/cms/core/models/components/Breadcrumbs.java @@ -21,15 +21,17 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; +import javax.servlet.http.HttpServletRequest; import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.request.RequestPathInfo; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.cms.core.models.BaseModel; import org.apache.sling.models.annotations.Default; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.Via; -import org.apache.sling.models.annotations.injectorspecific.Self; /** * Logic for the Suffix BreadCrumb Component @@ -38,22 +40,13 @@ import org.apache.sling.models.annotations.injectorspecific.Self; * */ @Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) -public class Breadcrumbs { - - @Inject - @Via("resource") - @Default(intValues = 2) - int depth; +public class Breadcrumbs extends BaseModel { @Inject @Via("resource") @Default(values = "jcr:title") String titleProp; - - @Inject - @Self - public SlingHttpServletRequest slingRequest; Resource suffixResource; @@ -63,10 +56,25 @@ public class Breadcrumbs { public void postConstruct() { suffixResource = slingRequest.getRequestPathInfo().getSuffixResource(); String prefix = slingRequest.getRequestURI(); - prefix = prefix.split(suffixResource.getPath())[0]; if (suffixResource == null) { return; } + System.out.println("getContextPath "+slingRequest.getContextPath()); + System.out.println("getServletPath "+slingRequest.getServletPath()); + System.out.println("getPathInfo "+slingRequest.getPathInfo()); + System.out.println("getPathTranslated "+slingRequest.getPathTranslated()); + System.out.println("getContextPath "+((HttpServletRequest)slingRequest).getContextPath()); + System.out.println("getServletPath "+((HttpServletRequest)slingRequest).getServletPath()); + System.out.println("getResolutionPath "+ resource.getResourceMetadata().getResolutionPath()); + System.out.println("getResolutionPathInfo "+ resource.getResourceMetadata().getResolutionPathInfo()); + System.out.println("Request Path Info "); + RequestPathInfo info = slingRequest.getRequestPathInfo(); + System.out.println("RequestPath Info - resourcePath " + info.getResourcePath()); + System.out.println("RequestPath Info - resource Suffix " + info.getSuffix()); + System.out.println("RequestPath Info - resource Suffix " + info.getSelectorString()); + System.out.println("Request MetaData Info "); + + prefix = prefix.split(suffixResource.getPath())[0]; boolean first = true; while (suffixResource.getParent() != null) { String suffix = suffixResource.getPath(); @@ -76,6 +84,7 @@ public class Breadcrumbs { } suffixResource = suffixResource.getParent(); } + int depth = get("depth",2); while (--depth > 0) { pathData.remove(0); } diff --git a/ui/src/main/frontend/src/scss/_overrides.scss b/core/src/main/java/org/apache/sling/cms/core/models/components/ContentAction.java similarity index 64% copy from ui/src/main/frontend/src/scss/_overrides.scss copy to core/src/main/java/org/apache/sling/cms/core/models/components/ContentAction.java index 3d718fa..f1a9aba 100644 --- a/ui/src/main/frontend/src/scss/_overrides.scss +++ b/core/src/main/java/org/apache/sling/cms/core/models/components/ContentAction.java @@ -1,41 +1,26 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -@charset "utf-8"; - -// Brand Colors -$indigo: #282661; -$violet: #662F8F; -$magenta: #9E2165; -$crimson: #CB2138; -$orange: #EA7826; -$goldenrod: #F79A25; -$gray: #6D6E71; -$gray-light: lighten($gray, 50%); -$red: #D22128; - -// Bulma default style overrides -$family-sans-serif: "Open Sans",sans-serif; -$link: $indigo; -$primary: $magenta; -$warning: $orange; -$danger: $crimson; -$navbar-height: 5rem; -$navbar-item-img-max-height: 4rem; -$modal-z: 2000; \ No newline at end of file +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sling.cms.core.models.components; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.cms.core.models.BaseModel; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; +import org.apache.sling.models.annotations.Model; + +public class ContentAction extends BaseModel { + +} diff --git a/core/src/main/java/org/apache/sling/cms/core/models/components/ContentTable.java b/core/src/main/java/org/apache/sling/cms/core/models/components/ContentTable.java index fb72f28..95aaecb 100644 --- a/core/src/main/java/org/apache/sling/cms/core/models/components/ContentTable.java +++ b/core/src/main/java/org/apache/sling/cms/core/models/components/ContentTable.java @@ -21,12 +21,10 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; -import org.apache.sling.api.resource.ValueMap; import org.apache.sling.cms.core.models.BaseModel; import org.apache.sling.models.annotations.Default; import org.apache.sling.models.annotations.DefaultInjectionStrategy; @@ -39,23 +37,15 @@ public class ContentTable extends BaseModel { @Inject @Via("resource") private List<Resource> columns; - + @Inject @Via("resource") - @Default(values="/") + @Default(values = "/") private String defaultPath; - private String[] types; - - @PostConstruct - public void init() { - ValueMap data = resource.getChild("columns").getValueMap(); - types = data.get("resourceTypes", new String[]{}); - } - public List<ColumnData> getColumnData() { - return columns.stream().map(ColumnData::new).filter(ColumnData::isEligible).collect(Collectors.toList()); + return columns.stream().map(ColumnData::new).collect(Collectors.toList()); } public List<ChildResourceData> getChildren() { @@ -68,10 +58,8 @@ public class ContentTable extends BaseModel { } List<ChildResourceData> response = new ArrayList<>(); suffix.listChildren().forEachRemaining(child -> { - for (String type:types) { - if (child.getResourceType().equals(type)) { - response.add(new ChildResourceData(child)); - } + if (!child.getName().contains(":")) { + response.add(new ChildResourceData(child)); } }); return response; @@ -86,7 +74,7 @@ public class ContentTable extends BaseModel { public ColumnData(Resource resource) { this.resource = resource; this.name = resource.getName(); - + } public String getClassString() { @@ -113,7 +101,7 @@ public class ContentTable extends BaseModel { public String getFieldResourceType() { return resource.getValueMap().get("sling:resourceType", "foo"); } - + public Resource getResource() { return resource; } diff --git a/ui/src/main/frontend/src/scss/_overrides.scss b/ui/src/main/frontend/src/scss/_overrides.scss index 3d718fa..2bdf527 100644 --- a/ui/src/main/frontend/src/scss/_overrides.scss +++ b/ui/src/main/frontend/src/scss/_overrides.scss @@ -38,4 +38,5 @@ $warning: $orange; $danger: $crimson; $navbar-height: 5rem; $navbar-item-img-max-height: 4rem; +$section-padding : 1rem 1.5rem; $modal-z: 2000; \ No newline at end of file diff --git a/ui/src/main/resources/jcr_root/conf/cms.json b/ui/src/main/resources/jcr_root/conf/cms.json new file mode 100644 index 0000000..e02aef2 --- /dev/null +++ b/ui/src/main/resources/jcr_root/conf/cms.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/ui/src/main/resources/jcr_root/etc/taxonomy/jcr%3Acontent.json b/ui/src/main/resources/jcr_root/etc/taxonomy/jcr%3Acontent.json index 26d6e7e..b74a78b 100644 --- a/ui/src/main/resources/jcr_root/etc/taxonomy/jcr%3Acontent.json +++ b/ui/src/main/resources/jcr_root/etc/taxonomy/jcr%3Acontent.json @@ -1,4 +1,5 @@ { "jcr:primaryType": "nt:unstructured", + "tabledepth": 2, "jcr:title": "Taxonomy" } \ No newline at end of file diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/actions/sling%3APage.json b/ui/src/main/resources/jcr_root/libs/sling-cms/actions/sling%3APage.json index 369b7e5..140ed09 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/actions/sling%3APage.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/actions/sling%3APage.json @@ -19,7 +19,7 @@ "modal": true, "title": "Move / Copy Page", "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" + "prefix": "/cms/actions/shared/movecopy.html" }, "version": { "jcr:primaryType": "nt:unstructured", @@ -27,13 +27,13 @@ "modal": true, "title": "Manage Versions", "icon": "history", - "prefix": "/cms/shared/versions.html" + "prefix": "/cms/actions/shared/versions.html" }, "delete": { "jcr:primaryType": "nt:unstructured", "modal": true, "title": "Delete Page", "icon": "trash", - "prefix": "/cms/shared/delete.html" + "prefix": "/cms/actions/shared/delete.html" } } diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/breadcrumbmenu/breadcrumbmenu.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/breadcrumbmenu/breadcrumbmenu.jsp index 309308c..5fa4515 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/breadcrumbmenu/breadcrumbmenu.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/breadcrumbmenu/breadcrumbmenu.jsp @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ --%> -<%@page import="org.apache.sling.models.factory.ModelFactory"%> <%@page import="org.apache.sling.cms.core.models.components.Breadcrumbs"%> <%@include file="/libs/sling-cms/global.jsp"%> <sling:adaptTo adaptable="${slingRequest}" adaptTo="org.apache.sling.cms.core.models.components.Breadcrumbs" var="model"/> diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp index c7b0279..70ad807 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/body.jsp @@ -16,23 +16,22 @@ * specific language governing permissions and limitations * under the License. */ --%> - <%@include file="/libs/sling-cms/global.jsp"%> +<%@include file="/libs/sling-cms/global.jsp"%> <body class="cms"> - <div class="gradient"></div> - <section class="container is-fluid"> + <div class="gradient"></div> + <div class="container is-fluid"> <sling:call script="nav.jsp" /> - </section> - <section class="container is-fluid"> <div class="columns"> - <div class="column is-one-fifth"> - <sling:include path="/mnt/overlay/sling-cms/content/start/jcr:content/nav" resourceType="sling-cms/components/general/container" /> + <div class="column is-2"> + <sling:include + path="/mnt/overlay/sling-cms/content/start/jcr:content/nav" + resourceType="sling-cms/components/general/container" /> + </div> + <div class="column"> + <main class="Main-Content"> <sling:call + script="content.jsp" /> </main> + </div> </div> - <div class="column"> - <main class="Main-Content"> - <sling:call script="content.jsp" /> - </main> </div> - </div> - </section> <sling:call script="scripts.jsp" /> </body> \ No newline at end of file diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp index 2a6c5c5..2e6fd9e 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp @@ -17,7 +17,7 @@ * under the License. */ --%> <%@include file="/libs/sling-cms/global.jsp"%> -<nav class="navbar" role="navigation" aria-label="main mavigation"> +<nav class="navbar is-transparent" role="navigation" aria-label="main mavigation"> <div class="navbar-brand"> <a class="navbar-item" href="http://sling.apache.org" > <img src="/static/clientlibs/sling-cms/img/sling-logo.svg" width="100" alt="Apache Sling"/> diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/browse/browse.json similarity index 67% copy from ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json copy to ui/src/main/resources/jcr_root/libs/sling-cms/content/browse/browse.json index 147c40b..0129958 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/browse/browse.json @@ -2,7 +2,7 @@ "jcr:primaryType": "sling:Page", "jcr:content": { "sling:resourceType": "sling-cms/components/pages/base", - "jcr:title": "Taxonomy", + "jcr:title": "Site Content", "jcr:primaryType": "nt:unstructured", "container": { "jcr:primaryType": "nt:unstructured", @@ -11,54 +11,57 @@ "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contentactions", "actions": { - "taxonomy": { + "page": { "jcr:primaryType": "nt:unstructured", - "label": "Taxonomy Item", - "prefix": "/cms/actions/create/taxonomy.html" + "label": "Site", + "icon": "jam jam-document", + "prefix": "/cms/actions/create/site.html" + }, + "folder": { + "jcr:primaryType": "nt:unstructured", + "label": "Site Group", + "icon": "jam jam-document-f", + "prefix": "/cms/actions/create/sitegroup.html" } } }, - "contentbreadcrumb": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/contentbreadcrumb", - "depth": 2, - "prefix": "/cms/taxonomy/list.html" - }, "contenttable": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contenttable", + "defaultPath": "/content", "columns": { "jcr:primaryType": "nt:unstructured", "resourceTypes": [ - "sling:Page", - "sling:Taxonomy", - "sling:File", + "sling:Site", "sling:OrderedFolder", - "sling:Folder" + "sling:Folder", + "sling:Page", + "nt:file" ], "name": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/columns/name", "link": true, "jcr:title": "Name", - "prefix": "/cms/taxonomy/list.html" + "prefix": "/cms/site/sites.html" }, - "jcr:title": { + "title": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/columns/text", + "property": "jcr:content/jcr:title", "jcr:title": "Title", - "property": "jcr:title" + "type": "String" }, "lastModified": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", "jcr:title": "Last Modified", - "subPath": "" + "subPath": "jcr:content/" }, "actions": { "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions" - + "sling:resourceType": "sling-cms/components/cms/columns/actions", + "jcr:title": "Actions" } } } diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json index 63b8a90..b320cc6 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json @@ -27,21 +27,21 @@ "modal": true, "title": "Manage Versions", "icon": "history", - "prefix": "/cms/shared/versions.html" + "prefix": "/cms/actions/shared/versions.html" }, "movecopy": { "jcr:primaryType": "nt:unstructured", "modal": true, "title": "Move / Copy Page", "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" + "prefix": "/cms/actions/shared/movecopy.html" }, "delete": { "jcr:primaryType": "nt:unstructured", "modal": true, "title": "Delete Page", "icon": "trash", - "prefix": "/cms/shared/delete.html" + "prefix": "/cms/actions/shared/delete.html" } } }, diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json index 8b23187..285fb48 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json @@ -1,7 +1,7 @@ { "jcr:primaryType": "sling:Page", "jcr:content": { - "sling:resourceType": "sling-cms/components/pages/base", + "sling:resourceType": "sling-cms/components/pages/form", "jcr:title": "Edit Page", "jcr:primaryType": "nt:unstructured", "container": { diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json index 147c40b..7651be1 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json @@ -27,6 +27,7 @@ "contenttable": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contenttable", + "depth":1, "columns": { "jcr:primaryType": "nt:unstructured", "resourceTypes": [
