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 5ca7ff2961b3c8df002608d4b315797d4b66d04f Author: JE Bailey <[email protected]> AuthorDate: Mon Sep 10 16:36:03 2018 -0400 initial refactoring of content breadcrumbs and content table --- .../cms/core/models/components/Breadcrumbs.java | 94 ++++-- .../cms/core/models/components/ContentTable.java | 141 ++++++++ ui/pom.xml | 14 + ui/src/main/frontend/src/js/cms.js | 11 +- .../sling-cms/components/cms/columns/name/name.jsp | 2 +- .../components/cms/columns/publish/publish.jsp | 10 +- .../cms/contentbreadcrumb/contentbreadcrumb.jsp | 12 +- .../components/cms/contenttable/contenttable.jsp | 37 +-- .../libs/sling-cms/content/site/content.json | 364 +++++---------------- .../libs/sling-cms/content/site/sites.json | 163 +++------ .../libs/sling-cms/content/static/content.json | 176 +++++----- .../resources/jcr_root/libs/sling-cms/global.jsp | 2 +- ui/src/main/resources/jcr_root/web-fragment.xml | 5 - 13 files changed, 458 insertions(+), 573 deletions(-) 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 4c7da58..a856490 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 @@ -17,77 +17,123 @@ package org.apache.sling.cms.core.models.components; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; -import javax.inject.Named; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; +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; -@Model(adaptables = SlingHttpServletRequest.class,defaultInjectionStrategy=DefaultInjectionStrategy.OPTIONAL) +@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public class Breadcrumbs { @Inject + @Via("resource") int depth; @Inject - @Named("jcr:title") - String title; + Resource resource; @Inject + @Via("resource") String prefix; - + @Inject - Resource resource; - + @Via("resource") + @Default(values = "jcr:title") + String titleProp; + @Self SlingHttpServletRequest servletRequest; - + Resource suffixResource; - + List<PathData> pathData = new ArrayList<>(); @PostConstruct public void postConstruct() { suffixResource = servletRequest.getRequestPathInfo().getSuffixResource(); - pathData.add(new PathData(prefix+resource.getPath(),title)); + if (suffixResource == null) { + return; + } + boolean first = true; + while (suffixResource.getParent() != null) { + String suffix = suffixResource.getPath(); + pathData.add(0, new PathData(prefix + suffix, getTitle(suffixResource),first)); + if (first) { + first = false; + } + suffixResource = suffixResource.getParent(); + } + while (--depth > 0) { + pathData.remove(0); + } + } + + private String getTitle(Resource resource) { + ValueMap map = resource.getValueMap(); + String title = map.get("jcr:title", String.class); + if (title != null) { + return title; + } + title = map.get("jcr:content/jcr:title", String.class); + if (title != null) { + return title; + } + return resource.getName(); } - + public String getTitle() { return null; } - + public List<PathData> getPathData() { return pathData; } - - public String getString() { - return "flounder"; - } - - public static class PathData{ - + + public static class PathData { + private String href; private String title; - - public PathData(String href, String title) { + private boolean first; + + public PathData(String href, String title, boolean first) { this.href = href; this.title = title; + this.first= first; } + public String getHref() { - return href; //prefix + resource path + return href; // prefix + resource path } - //${parent.valueMap['jcr:title'] != null ? parent.valueMap['jcr:title'] : parent.valueMap['jcr:content/jcr:title']}" default="${parent.name}" + + // ${parent.valueMap['jcr:title'] != null ? parent.valueMap['jcr:title'] : + // parent.valueMap['jcr:content/jcr:title']}" default="${parent.name}" public String getTitle() { return title; } + public String getAria() { + if (first) { + return "aria-current='page'"; + } + return ""; + } + + public String getClassAttr() { + if (first) { + return "class='is-active'"; + } + return ""; + } + } } 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 new file mode 100644 index 0000000..21ed513 --- /dev/null +++ b/core/src/main/java/org/apache/sling/cms/core/models/components/ContentTable.java @@ -0,0 +1,141 @@ +/* + * 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 java.util.ArrayList; +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.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; + +@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) +public class ContentTable { + + @Inject + @Via("resource") + private List<Resource> columns; + + private String[] types; + + @Self + SlingHttpServletRequest slingRequest; + + @PostConstruct + public void init() { + Resource resource = slingRequest.getResource(); + 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()); + } + + public List<ChildResourceData> getChildren() { + Resource suffix = slingRequest.getRequestPathInfo().getSuffixResource(); + if (suffix == null) { + return Collections.emptyList(); + } + List<ChildResourceData> response = new ArrayList<>(); + suffix.listChildren().forEachRemaining(child -> { + for (String type:types) { + if (child.getResourceType().equals(type)) { + response.add(new ChildResourceData(child)); + } + } + }); + return response; + } + + public class ColumnData { + + private Resource resource; + + private String name; + + public ColumnData(Resource resource) { + this.resource = resource; + this.name = resource.getName(); + + } + + public String getClassString() { + String reply = ""; + switch (name) { + case "actions": + reply = "is-hidden"; + break; + case "publish": + reply = "has-text-centered"; + break; + } + return reply; + } + + public String getName() { + return name; + } + + public String getTitle() { + return resource.getValueMap().get("jcr:title", "foo"); + } + + public String getFieldResourceType() { + return resource.getValueMap().get("sling:resourceType", "foo"); + } + + public Resource getResource() { + return resource; + } + + public boolean isEligible() { + return true; + } + } + + public class ChildResourceData { + + private Resource resource; + + public ChildResourceData(Resource resource) { + this.resource = resource; + } + + public String getPath() { + return resource.getPath(); + } + + public String getDataType() { + return resource.getResourceType(); + } + + public boolean isEligible() { + return true; + } + } + +} diff --git a/ui/pom.xml b/ui/pom.xml index a5db13e..4a031e4 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -178,5 +178,19 @@ <version>0.9.1-SNAPSHOT</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId> + org.apache.sling.scripting.jsp.taglib + </artifactId> + <version>2.3.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.geronimo.bundles</groupId> + <artifactId>jstl</artifactId> + <scope>provided</scope> + </dependency> </dependencies> + </project> \ No newline at end of file diff --git a/ui/src/main/frontend/src/js/cms.js b/ui/src/main/frontend/src/js/cms.js index 97a9533..7f17092 100644 --- a/ui/src/main/frontend/src/js/cms.js +++ b/ui/src/main/frontend/src/js/cms.js @@ -39,7 +39,7 @@ Sling.CMS = { }, ui: { confirmMessage: function(title, message, complete){ - var $modal = $('<div class="modal"><div class="modal-background"></div><div class="modal-card is-draggable"><header class="modal-card-head"><p class="modal-card-title">'+title+'</p><button class="delete" aria-label="close"></button></header><section class="modal-card-body">'+message+'</section><footer class="modal-card-foot"><button type="button" class="close-modal button is-primary">OK</button></footer></div>'); + var $modal = $('<div class="modal"><div class="modal-background"></div><div class="modal-card is-draggable"><header class="modal-card-head"><p class="modal-card-title">'+title+'</p></header><section class="modal-card-body">'+message+'</section><footer class="modal-card-foot"><button type="button" class="close-modal button is-primary">OK</button></footer></div>'); $('body').append($modal); Sling.CMS.decorate($modal); $modal.addClass('is-active'); @@ -50,11 +50,16 @@ Sling.CMS = { return $modal; }, fetchModal: function(title, link, path, complete){ - var $modal = $('<div class="modal"><div class="modal-background"></div><div class="modal-card is-draggable"><header class="modal-card-head"><p class="modal-card-title">'+title+'</p><button class="delete" aria-label="close"></button></header><section class="modal-card-body"></section><footer class="modal-card-foot"></footer></div>'); + var $modal = $('<div class="modal"><div class="modal-background"></div><div class="modal-card is-draggable"><header class="modal-card-head"><p class="modal-card-title">'+title+'</p></header><section class="modal-card-body"></section><footer class="modal-card-foot"><a class="close-modal is-warning button" aria-label="close">Cancel</a></footer></div>'); $('body').append($modal); $modal.find('.modal-card-body').load(link + " " +path,function(){ + var submitButton = $modal.find('button:submit'); + $modal.find('.modal-card-foot').append(submitButton); + submitButton.on("click",function(){ + $modal.find('form').submit(); + }) $modal.addClass('is-active'); - $modal.find('.delete,.close-modal').click(function(){ + $modal.find('.close-modal').click(function(){ $modal.css('display','none').remove(); return false; }); diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/name/name.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/name/name.jsp index 67dfbd9..0245485 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/name/name.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/name/name.jsp @@ -21,7 +21,7 @@ <c:set var="colValue" value="${resource.name}" /> <c:choose> <c:when test="${colConfig.valueMap.link}"> - <a href="${colConfig.valueMap.prefix}${resource.path}"> + <a class="button is-outlined" href="${colConfig.valueMap.prefix}${resource.path}"> <sling:encode value="${colValue}" mode="HTML" /> </a> </c:when> diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/publish/publish.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/publish/publish.jsp index af15eb3..2005d42 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/publish/publish.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/columns/publish/publish.jsp @@ -17,16 +17,16 @@ * under the License. */ --%> <%@include file="/libs/sling-cms/global.jsp"%> -<td data-value="${sling:getRelativeResource(resource,'jcr:content').valueMap.published ? 0 : 1}"> +<td class="has-text-centered" data-value="${sling:getRelativeResource(resource,'jcr:content').valueMap.published ? 0 : 1}"> <c:choose> <c:when test="${sling:getRelativeResource(resource,'jcr:content').valueMap.published}"> - <a class="button is-success is-outlined Fetch-Modal" href="/cms/shared/unpublish.html${resource.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form"> - <i class="jam jam-check"></i> + <a class="button is-success is-centered Fetch-Modal" href="/cms/shared/unpublish.html${resource.path}" title="Click to Unpublish" data-title="Unpublish" data-path=".Main-Content form"> + <i class="jam jam-download"></i> </a> </c:when> <c:otherwise> - <a class="button is-warning is-outlined Fetch-Modal" href="/cms/shared/publish.html${resource.path}" title="Content Not Published" data-title="Publish" data-path=".Main-Content form"> - <i class="jam jam-close"></i> + <a class="button is-warning Fetch-Modal" href="/cms/shared/publish.html${resource.path}" title="Click to Publish" data-title="Publish" data-path=".Main-Content form"> + <i class="jam jam-upload"></i> </a> </c:otherwise> </c:choose> diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp index 9de9e1c..5eb7eaf 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp @@ -18,20 +18,16 @@ */ --%> <%@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="${resource}" adaptTo="org.apache.sling.cms.core.models.components.Breadcrumbs" var="model"/><nav class="breadcrumb" aria-label="breadcrumbs"> +<%@include file="/libs/sling-cms/global.jsp"%> +<sling:adaptTo adaptable="${slingRequest}" adaptTo="org.apache.sling.cms.core.models.components.Breadcrumbs" var="model"/> +<nav class="breadcrumb" aria-label="Breadcrumb"> <ul> <c:forEach var="item" items="${model.pathData}"> <li> - <a href="${item.href}"> + <a href="${item.href}" ${item.aria} ${item.classAttr} > <sling:encode value="${item.title}" mode="HTML" /> </a> </li> </c:forEach> - <li>$WHY? - <li>${model.string}</li> </ul> </nav> diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp index f5bad46..288d921 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp @@ -16,40 +16,29 @@ * specific language governing permissions and limitations * under the License. */ --%> + <%@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.ContentTable" var="model"/> + <div class="container is-fullwidth"> <table class="table is-fullwidth is-striped"> <thead> <tr> - <th> - # - </th> - <c:forEach var="column" items="${sling:listChildren(sling:getRelativeResource(resource,'columns'))}"> - <th class="${column.name == 'actions' ? 'is-hidden' : '' }" data-attribute="${column.name}"> - <sling:encode value="${column.valueMap.title}" mode="HTML" /> + <c:forEach var="column" items="${model.columnData}"> + <th class="${column.classString}" data-attribute="${column.name}"> + <sling:encode value="${column.title}" mode="HTML" /> </th> </c:forEach> </tr> </thead> <tbody> - <c:set var="parentPath" value="${slingRequest.requestPathInfo.suffix}${not empty properties.appendSuffix ? properties.appendSuffix : ''}" /> - <c:set var="count" value="1" /> - <c:forEach var="child" items="${sling:listChildren(sling:getResource(resourceResolver, parentPath))}"> - <sling:getResource var="typeConfig" base="${resource}" path="types/${child.valueMap['jcr:primaryType']}" /> - <c:if test="${typeConfig != null && !fn:contains(child.name,':')}"> - <tr class="sortable__row" data-resource="${child.path}" data-type="${typeConfig.path}"> - <td class="Cell-Static" title="# ${status.index + 1}}" data-sort-value="<fmt:formatNumber pattern="0000" value="${count}" />"> - ${count} - </td> - <c:forEach var="column" items="${sling:listChildren(sling:getRelativeResource(typeConfig,'columns'))}"> - <c:set var="configPath" value="columns/${column.name}"/> - <c:set var="colConfig" value="${sling:getRelativeResource(typeConfig,configPath)}" scope="request" /> - <c:if test="${colConfig != null}"> - <sling:include path="${child.path}" resourceType="${colConfig.valueMap['sling:resourceType']}" /> - </c:if> + <c:forEach var="child" items="${model.children}"> + <tr class="sortable__row" data-resource="${child.path}" data-type="${child.dataType}"> + <c:forEach var="column" items="${model.columnData}"> + <c:set var="colConfig" value="${column.resource}" scope="request" /> + <sling:include path="${child.path}" resourceType="${column.fieldResourceType}" /> </c:forEach> </tr> - <c:set var="count" value="${count + 1}" /> - </c:if> </c:forEach> </tbody> -</table> \ No newline at end of file +</table> +</div> \ No newline at end of file diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json index 7b1cc8e..9383b5d 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json @@ -39,297 +39,79 @@ "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contenttable", "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "title": "Name" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "title": "Title" - }, - "published": { - "jcr:primaryType": "nt:unstructured", - "title": "Published" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "title": "Type" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "title": "Last Modified" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "title": "Actions" - } - }, - "types": { - "jcr:primaryType": "nt:unstructured", - "sling:Page": { - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": true, - "prefix": "/cms/site/content.html" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "property": "jcr:content/jcr:title", - "type": "String" - }, - "publish": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/publish" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/static", - "value": "Page" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": false, - "title": "Edit Page", - "icon": "pencil-f", - "prefix": "/cms/page/edit.html" - }, - "properties": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit Page Properties", - "icon": "cog", - "prefix": "/cms/page/siteeditproperties.html" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy Page", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "version": { - "jcr:primaryType": "nt:unstructured", - "ajaxPath": ".versionmanager", - "modal": true, - "title": "Manage Versions", - "icon": "history", - "prefix": "/cms/shared/versions.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete the specified page", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } - } - }, - "sling:File": { - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": false - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "link": false, - "type": "Name" - }, - "publish": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/publish" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/static", - "value": "File" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit File", - "icon": "pencil-f", - "prefix": "/cms/file/edit.html" - }, - "optimize": { - "jcr:primaryType": "nt:unstructured", - "modal": false, - "title": "Optimize File", - "icon": "archive", - "prefix": "/cms/file/optimize.html" - }, - "download": { - "jcr:primaryType": "nt:unstructured", - "modal": false, - "title": "Download file", - "icon": "download" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy File", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "version": { - "jcr:primaryType": "nt:unstructured", - "ajaxPath": ".versionmanager", - "modal": true, - "title": "Manage Versions", - "icon": "history", - "prefix": "/cms/shared/versions.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete File", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } - } - }, - "sling:OrderedFolder": { - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": true, - "prefix": "/cms/site/content.html" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "property": "jcr:content/jcr:title", - "type": "String" - }, - "publish": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/publish" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/static", - "value": "Folder" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit Folder", - "icon": "pencil-f", - "prefix": "/cms/folder/edit.html" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy Folder", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete Folder", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } - } - }, - "sling:Folder": { - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": true, - "prefix": "/cms/site/content.html" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "property": "jcr:content/jcr:title", - "type": "String" - }, - "publish": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/publish" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/static", - "value": "Folder" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit Folder", - "icon": "pencil-f", - "prefix": "/cms/folder/edit.html" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy Folder", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete Folder", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } - } - } + "resourceTypes" : ["sling:Page","sling:File","sling:OrderedFolder","sling:Folder"], + "name": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/name", + "link": true, + "jcr:title":"Name", + "prefix": "/cms/site/content.html" + }, + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/text", + "property": "jcr:content/jcr:title", + "jcr:title":"Title", + "type": "String" + }, + "publish": { + "jcr:primaryType": "nt:unstructured", + "jcr:title":"Publish", + "sling:resourceType": "sling-cms/components/cms/columns/publish" + }, + "type": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/static", + "jcr:title":"Type", + "value": "Page" + }, + "lastModified": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", + "jcr:title":"Last Modified", + "subPath": "jcr:content/" + }, + "actions": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/actions", + "jcr:title":"Actions", + "edit": { + "jcr:primaryType": "nt:unstructured", + "modal": false, + "title": "Edit Page", + "icon": "pencil-f", + "prefix": "/cms/page/edit.html" + }, + "properties": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Edit Page Properties", + "icon": "cog", + "prefix": "/cms/page/siteeditproperties.html" + }, + "movecopy": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Move / Copy Page", + "icon": "move-alt", + "prefix": "/cms/shared/movecopy.html" + }, + "version": { + "jcr:primaryType": "nt:unstructured", + "ajaxPath": ".versionmanager", + "modal": true, + "title": "Manage Versions", + "icon": "history", + "prefix": "/cms/shared/versions.html" + }, + "delete": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Delete the specified page", + "icon": "trash", + "prefix": "/cms/shared/delete.html" + } + } } } } diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/sites.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/sites.json index 79f34a3..275fcc9 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/sites.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/sites.json @@ -36,121 +36,54 @@ "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contenttable", "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "title": "Name" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "title": "Title" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "title": "Last Modified" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "title": "Actions" - } - }, - "types": { - "jcr:primaryType": "nt:unstructured", - "sling:Site":{ - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": true, - "prefix": "/cms/site/content.html" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "property": "jcr:title", - "type": "String" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit Site", - "icon": "pencil-f", - "prefix": "/cms/site/edit.html" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy Site", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete the specified site", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } - } - }, - "sling:OrderedFolder":{ - "jcr:primaryType": "nt:unstructured", - "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": true, - "prefix": "/cms/site/sites.html" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "property": "jcr:content/jcr:title", - "type": "String" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit Site Group", - "icon": "pencil-f", - "prefix": "/cms/site/editgroup.html" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy Site Group", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "title": "Delete Site Group", - "icon": "trash", - "prefix": "/cms/shared/delete.html", - "modal": true - } - } - } - } + "jcr:primaryType": "nt:unstructured", + "resourceTypes":["sling:Site","sling:OrderedFolder"], + "name": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/name", + "link": true, + "jcr:title":"Name", + "prefix": "/cms/site/content.html" + }, + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/text", + "property": "jcr:content/jcr:title", + "jcr:title":"Title", + "type": "String" + }, + "lastModified": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", + "jcr:title":"Last Modified", + "subPath": "jcr:content/" + }, + "actions": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/actions", + "jcr:title":"Actions", + "edit": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Edit Site Group", + "icon": "pencil-f", + "prefix": "/cms/site/editgroup.html" + }, + "movecopy": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Move / Copy Site Group", + "icon": "move-alt", + "prefix": "/cms/shared/movecopy.html" + }, + "delete": { + "jcr:primaryType": "nt:unstructured", + "title": "Delete Site Group", + "icon": "trash", + "prefix": "/cms/shared/delete.html", + "modal": true + } + } } } } diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/static/content.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/static/content.json index d7ede68..71a2c04 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/static/content.json +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/static/content.json @@ -34,109 +34,93 @@ "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/cms/contenttable", "columns": { + "resourceTypes":["sling:File","sling:OrderedFolder","sling:Folder","nt:file"], "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "title": "Name" - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "title": "Title" - }, - "published": { - "jcr:primaryType": "nt:unstructured", - "title": "Published" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "title": "Type" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "title": "Last Modified" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "title": "Actions" - } + "name": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/name", + "jcr:title":"Name", + "prefix": "/cms/static/content.html", + "link": true + }, + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/text", + "link": false, + "jcr:title":"Title", + "type": "Name" + }, + "publish": { + "jcr:primaryType": "nt:unstructured", + "jcr:title":"Publish", + "sling:resourceType": "sling-cms/components/cms/columns/publish" + }, + "type": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/static", + "jcr:title":"Type", + "value": "Folder" + }, + "lastModified": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", + "jcr:title":"Last Modified", + "subPath": "jcr:content/" + }, + "actions": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "sling-cms/components/cms/columns/actions", + "jcr:title":"Actions", + "edit": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Edit File", + "icon": "pencil-f", + "prefix": "/cms/file/edit.html" + }, + "optimize": { + "jcr:primaryType": "nt:unstructured", + "modal": false, + "title": "Optimize File", + "icon": "archive", + "prefix": "/cms/file/optimize.html" + }, + "download": { + "jcr:primaryType": "nt:unstructured", + "modal": false, + "title": "Download file", + "icon": "download" + }, + "movecopy": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Move / Copy File", + "icon": "move-alt", + "prefix": "/cms/shared/movecopy.html" + }, + "version": { + "jcr:primaryType": "nt:unstructured", + "ajaxPath": ".versionmanager", + "modal": true, + "title": "Manage Versions", + "icon": "history", + "prefix": "/cms/shared/versions.html" + }, + "delete": { + "jcr:primaryType": "nt:unstructured", + "modal": true, + "title": "Delete File", + "icon": "trash", + "prefix": "/cms/shared/delete.html" + } + } }, "types": { "jcr:primaryType": "nt:unstructured", "sling:File":{ "jcr:primaryType": "nt:unstructured", "columns": { - "jcr:primaryType": "nt:unstructured", - "name": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/name", - "link": false - }, - "title": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/text", - "link": false, - "type": "Name" - }, - "publish": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/publish" - }, - "type": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/static", - "value": "File" - }, - "lastModified": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/lastmodified", - "subPath": "jcr:content/" - }, - "actions": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/cms/columns/actions", - "edit": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Edit File", - "icon": "pencil-f", - "prefix": "/cms/file/edit.html" - }, - "optimize": { - "jcr:primaryType": "nt:unstructured", - "modal": false, - "title": "Optimize File", - "icon": "archive", - "prefix": "/cms/file/optimize.html" - }, - "download": { - "jcr:primaryType": "nt:unstructured", - "modal": false, - "title": "Download file", - "icon": "download" - }, - "movecopy": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Move / Copy File", - "icon": "move-alt", - "prefix": "/cms/shared/movecopy.html" - }, - "version": { - "jcr:primaryType": "nt:unstructured", - "ajaxPath": ".versionmanager", - "modal": true, - "title": "Manage Versions", - "icon": "history", - "prefix": "/cms/shared/versions.html" - }, - "delete": { - "jcr:primaryType": "nt:unstructured", - "modal": true, - "title": "Delete File", - "icon": "trash", - "prefix": "/cms/shared/delete.html" - } - } + } }, "sling:OrderedFolder":{ diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp index 8b34fcc..5dc580e 100644 --- a/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp +++ b/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp @@ -20,4 +20,4 @@ %><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><% %><%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><% %><%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><% -%><sling:defineObjects /><sling:adaptTo var="properties" adaptable="${resource}" adaptTo="org.apache.sling.api.resource.ValueMap" /> \ No newline at end of file +%><sling:defineObjects /><sling:adaptTo var="properties" adaptable="${resource}" adaptTo="org.apache.sling.api.resource.ValueMap" /> diff --git a/ui/src/main/resources/jcr_root/web-fragment.xml b/ui/src/main/resources/jcr_root/web-fragment.xml deleted file mode 100644 index 78ede58..0000000 --- a/ui/src/main/resources/jcr_root/web-fragment.xml +++ /dev/null @@ -1,5 +0,0 @@ -<web-fragment id="WebFragment_ID" version="3.0" - xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"> - <name>ui</name> -</web-fragment> \ No newline at end of file
