You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2019/05/07 18:16:17 UTC

[sling-org-apache-sling-app-cms] branch master updated: Fixing issues around the pathfield and content search functions

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-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c2d83e  Fixing issues around the pathfield and content search functions
5c2d83e is described below

commit 5c2d83ed5d0dd21ff614117fc91fa249536bf95e
Author: Dan Klco <dk...@apache.org>
AuthorDate: Tue May 7 14:16:10 2019 -0400

    Fixing issues around the pathfield and content search functions
---
 ui/src/main/frontend/src/js/cms.modal.js                       |  2 +-
 ui/src/main/frontend/src/js/cms.pathfield.js                   |  5 +----
 ui/src/main/frontend/src/scss/cms.scss                         |  4 ++++
 .../sling-cms/components/cms/searchresults/searchresults.jsp   |  7 +++----
 .../libs/sling-cms/components/editor/fields/select/field.jsp   |  2 +-
 .../jcr_root/libs/sling-cms/content/shared/search.json         | 10 +++++-----
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/ui/src/main/frontend/src/js/cms.modal.js b/ui/src/main/frontend/src/js/cms.modal.js
index d1998d1..701e618 100644
--- a/ui/src/main/frontend/src/js/cms.modal.js
+++ b/ui/src/main/frontend/src/js/cms.modal.js
@@ -30,7 +30,7 @@
         },
         methods: {
             getModal: function (title, link, button) {
-                if (window.parent && window.parent.parent) {
+                if (window.self !== window.top && window.parent.parent) {
                     window.parent.parent.postMessage({
                         "action": "slingcms.openmodal",
                         "url": link,
diff --git a/ui/src/main/frontend/src/js/cms.pathfield.js b/ui/src/main/frontend/src/js/cms.pathfield.js
index e98dc4c..ae5c288 100644
--- a/ui/src/main/frontend/src/js/cms.pathfield.js
+++ b/ui/src/main/frontend/src/js/cms.pathfield.js
@@ -31,13 +31,10 @@
                     minChars: 1,
                     selector: this,
                     source: function (term, response) {
-                        var searchParams = new URLSearchParams();
                         if (term === '/') {
                             term = base;
                         }
-                        searchParams.set('path', term);
-                        searchParams.set('type', type);
-                        fetch('/bin/cms/paths', searchParams).then(function (response) {
+                        fetch('/bin/cms/paths?path=' + encodeURIComponent(term) + '&type=' + encodeURIComponent(type)).then(function (response) {
                             return response.json();
                         }).then(function (data) {
                             response(data);
diff --git a/ui/src/main/frontend/src/scss/cms.scss b/ui/src/main/frontend/src/scss/cms.scss
index da2c802..b89a2fa 100644
--- a/ui/src/main/frontend/src/scss/cms.scss
+++ b/ui/src/main/frontend/src/scss/cms.scss
@@ -150,6 +150,10 @@ h5 {
     margin-bottom: .5em;
 }
 
+#search-results .box {
+    overflow: hidden;
+}
+
 #search-results .tile {
     flex-wrap: wrap;
     padding: .5em;
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/searchresults/searchresults.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/searchresults/searchresults.jsp
index 32aed0f..f7fd6db 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/searchresults/searchresults.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/searchresults/searchresults.jsp
@@ -49,12 +49,11 @@
                             <c:set var="icon" value="sitemap" />
                         </c:otherwise>
                     </c:choose>
-                    <h5>
-                        <span class="jam jam-${icon}"></span>
-                        ${sling:encode(title,'HTML')}
+                    <h5 title="${sling:encode(title,'HTML_ATTR')}">
+                        <span class="jam jam-${icon}"></span>&nbsp;${sling:encode(title,'HTML')}
                     </h5>
                     <small class="is-size-7">
-                        <em>${result.path}</em>
+                        <em title="${sling:encode(result.path,'HTML_ATTR')}">${sling:encode(result.path,'HTML')}</em>
                     </small><br/>
                     <a href="#" class="button search-select-button is-pulled-right" data-path="${result.path}">Select</a>
                     <br class="clearfix" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/select/field.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/select/field.jsp
index b51aad8..9a5cbfd 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/select/field.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/select/field.jsp
@@ -26,7 +26,7 @@
             <c:when test="${not empty properties.options}">
                 <c:forEach var="option" items="${properties.options}">
                     <c:set var="label" value="${fn:split(option,'=')[0]}" />
-                    <c:set var="val" value="${fn:split(option,'=')[1]}" />
+                    <c:set var="value" value="${fn:split(option,'=')[1]}" />
                     <c:choose>
                         <c:when test="${val eq value}">
                             <c:set var="selected" value="selected=\"selected\"" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/shared/search.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/shared/search.json
index b9eeea0..c199491 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/shared/search.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/shared/search.json
@@ -11,7 +11,7 @@
                 "jcr:primaryType": "nt:unstructured",
                 "sling:resourceType": "sling-cms/components/cms/getform",
                 "button": "Search",
-                "load": "#search-results .is-ancestor",
+                "load": "#search-results",
                 "target": "#search-results",
                 "fields": {
                     "jcr:primaryType": "nt:unstructured",
@@ -29,10 +29,10 @@
                         "name": "type",
                         "label": "Content Type",
                         "options": [
-                            "Page=sling:Page",
-                            "File=sling:File",
-                            "Folder=sling:Folder",
-                            "Everything=nt:base"
+                            "All=nt:base",
+                            "Files=sling:File",
+                            "Folders=sling:Folder",
+                            "Pages=sling:Page"
                         ]
                     },
                     "path": {