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
The following commit(s) were added to refs/heads/master by this push: new 39012c6 Fixing some issues with the search component and adding date as an option to the input new cecde40 Merge branch 'master' of g...@github.com:apache/sling-whiteboard.git 39012c6 is described below commit 39012c640e7d850fab59feb04fc3bab744f37129 Author: Dan Klco <daniel.k...@gmail.com> AuthorDate: Thu Feb 22 23:20:58 2018 -0500 Fixing some issues with the search component and adding date as an option to the input --- .../java/org/apache/sling/cms/reference/models/Search.java | 13 ++++++------- .../apps/reference/components/general/search/result.jsp | 4 +++- .../apps/reference/components/general/search/search.jsp | 2 +- cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json | 4 ++-- .../libs/sling-cms/components/editor/fields/text/edit.json | 5 +++++ 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java b/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java index 494fb31..4d0d4e1 100644 --- a/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java +++ b/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java @@ -101,12 +101,11 @@ public class Search { Set<String> distinct = new HashSet<String>(); String term = Text.escapeIllegalXpathSearchChars(request.getParameter(TERM_PARAMETER)).replaceAll("'", "''"); - log.debug("Searching for pages with {} under {}", term, basePath); - Iterator<Resource> res = request.getResourceResolver().findResources( - "SELECT parent.* FROM [sling:Page] AS parent INNER JOIN [nt:base] AS child ON ISDESCENDANTNODE(child,parent) WHERE ISDESCENDANTNODE(parent, '" - + basePath + "') AND CONTAINS(child.*, '" + term + "')", - Query.JCR_SQL2); + String query = "SELECT parent.* FROM [sling:Page] AS parent INNER JOIN [nt:base] AS child ON ISDESCENDANTNODE(child,parent) WHERE ISDESCENDANTNODE(parent, '" + + basePath + "') AND CONTAINS(child.*, '" + term + "')"; + log.debug("Searching for pages with {} under {} with query: {}", term, basePath, query); + Iterator<Resource> res = request.getResourceResolver().findResources(query, Query.JCR_SQL2); while (res.hasNext()) { Resource result = res.next(); if (!distinct.contains(result.getPath())) { @@ -154,8 +153,8 @@ public class Search { } public boolean isLast() { - if(pages.length > 0) { - return page + 1 == pages[pages.length - 1]; + if (pages.length > 0) { + return page + 1 == pages[pages.length - 1]; } return true; } diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp index d2352da..1ee8ea3 100644 --- a/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp +++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp @@ -19,7 +19,9 @@ <%@include file="/libs/sling-cms/global.jsp"%> <div class="searchresult ${searchConfig.valueMap.resultClass}"> <div class="searchresult__header ${searchConfig.valueMap.resultHeaderClass}"> - <sling:encode value="${result.valueMap['jcr:content/jcr:title']}" mode="HTML" /> + <a href="${result.path}.html" class="searchresult__link"> + <sling:encode value="${result.valueMap['jcr:content/jcr:title']}" mode="HTML" /> + </a> </div> <p class="searchresult__body"> <sling:encode value="${result.valueMap['jcr:content/jcr:description']}" mode="HTML" /> diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp index 8cba767..4e08f17 100644 --- a/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp +++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp @@ -25,7 +25,7 @@ <div class="search__header"> <fmt:message key="slingcms.search.header"> <fmt:param value="${sling:encode(search.term,'HTML')}" /> - <fmt:param value="${search.start}" /> + <fmt:param value="${search.start + 1}" /> <fmt:param value="${search.end}" /> <fmt:param value="${search.count}" /> </fmt:message> diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json b/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json index 8e5b6d8..a9621e3 100644 --- a/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json +++ b/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json @@ -12,7 +12,7 @@ "sling:resourceType": "sling-cms/components/cms/blank", "entry": { "jcr:primaryType": "sling:MessageEntry", - "sling:message": "Found {1} results for \"{0}\". Showing results {2} - {3}.", + "sling:message": "Found {3} results for \"{0}\". Showing results {1} - {2}.", "sling:key": "slingcms.search.header" } }, @@ -25,7 +25,7 @@ "sling:resourceType": "sling-cms/components/cms/blank", "entry_493865649": { "jcr:primaryType": "sling:MessageEntry", - "sling:message": "Gefunden {1} Ergebnisse für \"{0}\". Zeige Ergebnisse {2} - {3}.", + "sling:message": "Gefunden {3} Ergebnisse für \"{0}\". Zeige Ergebnisse {1} - {2}.", "sling:key": "slingcms.search.header" } } diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json index 7420e9d..6f98584 100644 --- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json +++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json @@ -35,6 +35,11 @@ "label": "Color", "value": "color" }, + "date": { + "jcr:primaryType": "nt:unstructured", + "label": "Date/Time", + "value": "date" + }, "datetime": { "jcr:primaryType": "nt:unstructured", "label": "Date/Time", -- To stop receiving notification emails like this one, please contact dk...@apache.org.