This is an automated email from the ASF dual-hosted git repository. dklco pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit 6d625174e03a4a90ac297d5e43942dea44c2aee8 Author: Dan Klco <[email protected]> AuthorDate: Thu May 3 13:39:33 2018 -0400 Vastly improved the reorder experience by allowing users to select from the position within the list of siblings --- cms/builder/src/main/provisioning/sling.txt | 2 +- .../sling/cms/core/filters/EditIncludeFilter.java | 11 ++-- .../etc/clientlibs/sling-cms-editor/editor.js | 7 +-- .../editor/fields/orderafter/orderafter.jsp | 27 ---------- .../editor/fields/orderbefore/orderbefore.jsp | 27 ---------- .../editor/fields/siblingselect/siblingselect.jsp | 63 ++++++++++++++++++++++ .../libs/sling-cms/content/editor/moveup.json | 30 ----------- .../content/editor/{movedown.json => reorder.json} | 11 ++-- 8 files changed, 75 insertions(+), 103 deletions(-) diff --git a/cms/builder/src/main/provisioning/sling.txt b/cms/builder/src/main/provisioning/sling.txt index 5c40032..a47b402 100644 --- a/cms/builder/src/main/provisioning/sling.txt +++ b/cms/builder/src/main/provisioning/sling.txt @@ -61,7 +61,7 @@ org.apache.sling/org.apache.sling.serviceusermapper/1.4.0 org.apache.sling/org.apache.sling.serviceuser.webconsole/1.0.0 org.apache.sling/org.apache.sling.servlets.get/2.1.30 - org.apache.sling/org.apache.sling.servlets.post/2.3.24 + org.apache.sling/org.apache.sling.servlets.post/2.3.25-SNAPSHOT org.apache.sling/org.apache.sling.servlets.resolver/2.4.22 org.apache.sling/org.apache.sling.xss/2.0.4 javax.mail/mail/1.5.0-b01 diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java b/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java index b56e6b3..5ce6c81 100644 --- a/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java +++ b/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java @@ -92,15 +92,10 @@ public class EditIncludeFilter implements Filter { "<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"edit\" data-sling-cms-path=\"" + resource.getPath() + "\" data-sling-cms-edit=\"" + editPath + "\" title=\"Edit\">✏</button>"); - if (!first) { + if (!first || !last) { writer.write( - "<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"moveup\" data-sling-cms-path=\"" - + resource.getPath() + "\" title=\"Move Up\">▲</button>"); - } - if (!last) { - writer.write( - "<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"movedown\" data-sling-cms-path=\"" - + resource.getPath() + "\" title=\"Move Down\">▼</button>"); + "<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"reorder\" data-sling-cms-path=\"" + + resource.getPath() + "\" title=\"Reorder\">↕</button>"); } if (!resource.getName().equals(JcrConstants.JCR_CONTENT) && exists) { writer.write( diff --git a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.js b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.js index d38fe21..5fd2b23 100644 --- a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.js +++ b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.js @@ -33,11 +33,8 @@ if(!window.CMSEditor){ '/cms/editor/edit.html'+$(this).attr('data-sling-cms-path')+'?editor='+$(this).attr('data-sling-cms-edit'), $(this).closest('.Sling-CMS__component').attr('data-sling-cms-title')); }); - $(".Sling-CMS__edit-button[data-sling-cms-action=moveup]").click(function(){ - CMSEditor.ui.showModal('/cms/editor/moveup.html'+$(this).attr('data-sling-cms-path')); - }); - $(".Sling-CMS__edit-button[data-sling-cms-action=movedown]").click(function(){ - CMSEditor.ui.showModal('/cms/editor/movedown.html'+$(this).attr('data-sling-cms-path')); + $(".Sling-CMS__edit-button[data-sling-cms-action=reorder]").click(function(){ + CMSEditor.ui.showModal('/cms/editor/reorder.html'+$(this).attr('data-sling-cms-path')); }); // closing the modal diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderafter/orderafter.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderafter/orderafter.jsp deleted file mode 100644 index 72a1861..0000000 --- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderafter/orderafter.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%-- /* - * 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. - */ --%> - <%@include file="/libs/sling-cms/global.jsp"%> -<c:set var="rsrc" value="${sling:getResource(resourceResolver,slingRequest.requestPathInfo.suffix)}" /> -<c:forEach var="sibling" items="${sling:listChildren(rsrc.parent)}"> - <c:if test="${rsrc.path == prev.path}"> - <c:set var="after" value="${sibling}" /> - </c:if> - <c:set var="prev" value="${sibling}" /> -</c:forEach> -<input type="hidden" name=":order" value="after ${after.name}" /> \ No newline at end of file diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderbefore/orderbefore.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderbefore/orderbefore.jsp deleted file mode 100644 index cc48373..0000000 --- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/orderbefore/orderbefore.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%-- /* - * 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. - */ --%> - <%@include file="/libs/sling-cms/global.jsp"%> -<c:set var="rsrc" value="${sling:getResource(resourceResolver,slingRequest.requestPathInfo.suffix)}" /> -<c:forEach var="sibling" items="${sling:listChildren(rsrc.parent)}"> - <c:if test="${rsrc.path == sibling.path}"> - <c:set var="before" value="${prev}" /> - </c:if> - <c:set var="prev" value="${sibling}" /> -</c:forEach> -<input type="hidden" name=":order" value="before ${before.name}" /> \ No newline at end of file diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/siblingselect/siblingselect.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/siblingselect/siblingselect.jsp new file mode 100644 index 0000000..c7cec32 --- /dev/null +++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/siblingselect/siblingselect.jsp @@ -0,0 +1,63 @@ +<%-- /* + * 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. + */ --%> + <%@include file="/libs/sling-cms/global.jsp"%> +<c:set var="rsrc" value="${sling:getResource(resourceResolver,slingRequest.requestPathInfo.suffix)}" /> +<div class="Field-Group"> + <label for="limit"> + Order + </label> + <div class="Field-Input"> + <select name=":order"> + <c:forEach var="sibling" items="${sling:listChildren(rsrc.parent)}" varStatus="status"> + <c:choose> + <c:when test="${status.first}"> + <c:choose> + <c:when test="${rsrc.path == sibling.path}"> + <option value="${status.index}" selected="selected">Current Position</option> + </c:when> + <c:otherwise> + <option value="${status.index}">First</option> + </c:otherwise> + </c:choose> + </c:when> + <c:when test="${status.last}"> + <c:choose> + <c:when test="${rsrc.path == sibling.path}"> + <option value="${status.index}" selected="selected">Current Position</option> + </c:when> + <c:otherwise> + <option value="${status.index}">Last</option> + </c:otherwise> + </c:choose> + </c:when> + <c:otherwise> + <c:choose> + <c:when test="${rsrc.path == sibling.path}"> + <option value="${status.index}" selected="selected">Current Position</option> + </c:when> + <c:otherwise> + <option value="${status.index}">Before ${sibling.name}</option> + </c:otherwise> + </c:choose> + </c:otherwise> + </c:choose> + </c:forEach> + </select> + </div> +</div> \ No newline at end of file diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/moveup.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/moveup.json deleted file mode 100644 index 85524ab..0000000 --- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/moveup.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "jcr:primaryType": "sling:Page", - "jcr:content": { - "jcr:primaryType": "nt:unstructured", - "jcr:title": "Move Up", - "sling:resourceType": "sling-cms/components/pages/editor", - "container": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/general/container", - "add": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/editor/slingform", - "button": "Move Up", - "fields": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/general/container", - "path": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/editor/fields/suffixlabel", - "label": "Do you want to move up:" - }, - "primaryType": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/editor/fields/orderbefore" - } - } - } - } - } -} \ No newline at end of file diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/movedown.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/reorder.json similarity index 82% rename from cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/movedown.json rename to cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/reorder.json index 9afc926..fe056ef 100644 --- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/movedown.json +++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/reorder.json @@ -2,7 +2,7 @@ "jcr:primaryType": "sling:Page", "jcr:content": { "jcr:primaryType": "nt:unstructured", - "jcr:title": "Move Down", + "jcr:title": "Reorder", "sling:resourceType": "sling-cms/components/pages/editor", "container": { "jcr:primaryType": "nt:unstructured", @@ -10,18 +10,19 @@ "add": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/editor/slingform", - "button": "Move Down", + "button": "Reorder", "fields": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/general/container", "path": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "sling-cms/components/editor/fields/suffixlabel", - "label": "Do you want to move down:" + "label": "Do you want to reorder:" }, - "primaryType": { + "siblingselect": { "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "sling-cms/components/editor/fields/orderafter" + "sling:resourceType": "sling-cms/components/editor/fields/siblingselect", + "label": "Select Position:" } } } -- To stop receiving notification emails like this one, please contact [email protected].
