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 2018/01/29 22:26:47 UTC

[sling-whiteboard] branch master updated: Updating to add a page editor config

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 80f80ff  Updating to add a page editor config
80f80ff is described below

commit 80f80ff494d848703185dc865e61c4242d265703
Author: Dan Klco <da...@gmail.com>
AuthorDate: Mon Jan 29 17:26:40 2018 -0500

    Updating to add a page editor config
---
 .../apps/reference/components/pages/base/edit.json | 59 ++++++++++++++++++++++
 .../components/cms/pageeditbar/pageeditbar.jsp     |  7 +--
 .../components/editor/fields/base/base.jsp         | 24 ++++++---
 3 files changed, 80 insertions(+), 10 deletions(-)

diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/edit.json b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/edit.json
new file mode 100644
index 0000000..a3da6fb
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/edit.json
@@ -0,0 +1,59 @@
+ {
+	"jcr:primaryType": "nt:unstructured",
+	"sling:resourceType": "sling-cms/components/editor/slingform",
+	"button": "Save Page",
+	"fields": {
+		"jcr:primaryType": "nt:unstructured",
+		"sling:resourceType": "sling-cms/components/general/container",
+		"title": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/text",
+			"label": "Title",
+			"name": "jcr:title",
+			"required": true
+		},
+		"description": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/textarea",
+			"label": "Description",
+			"name": "jcr:description"
+		},
+		"keywords": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/repeating",
+			"label": "Keywords",
+			"name": "keywords"
+		},
+		"published": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/select",
+			"label": "Published",
+			"name": "published",
+			"options": {
+				"yes": {
+					"jcr:primaryType": "nt:unstructured",
+					"label": "Yes",
+					"value": "true"
+				},
+				"no": {
+					"jcr:primaryType": "nt:unstructured",
+					"label": "No",
+					"value": "false"
+				}
+			}
+		},
+		"publishedTypeHint": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/hidden",
+			"name": "published@TypeHint",
+			"value": "Boolean"
+		},
+		"template": {
+			"jcr:primaryType": "nt:unstructured",
+			"sling:resourceType": "sling-cms/components/editor/fields/text",
+			"label": "Template",
+			"name": "sling:template",
+			"disabled": true
+		}
+	}
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
index 49e1ce0..26dfb0f 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
@@ -18,7 +18,8 @@
  */ --%>
 <%@include file="/libs/sling-cms/global.jsp"%>
 <link rel="stylesheet" href="/etc/clientlibs/sling-cms/css/editor.css" />
+<sling:call script="/libs/sling-cms/components/editor/scripts/init.jsp" />
 <div class="Sling-CMS__edit-bar">
-	<a href="/cms" target="_blank" class="Sling-CMS__component-title">Sling CMS</a> &gt;
-	<a href="/cms/site/content.html${slingRequest.requestPathInfo.suffix}" target="_blank" class="Sling-CMS__component-title">Open Page</a> 
-</div>
\ No newline at end of file
+	<a href="/cms" target="_blank" class="Sling-CMS__component-title">Sling CMS</a> 
+</div>
+<sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/base/base.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/base/base.jsp
index 9af8156..bdc0c01 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/base/base.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/base/base.jsp
@@ -21,17 +21,27 @@
 	<sling:getResource path="${slingRequest.requestPathInfo.suffix}" var="editedResource" />
 	<c:set var="editProperties" value="${sling:adaptTo(editedResource,'org.apache.sling.api.resource.ValueMap')}" scope="request"/>
 </c:if>
-<c:if test="${properties.required}">
-	<c:set var="required" value="required='required'" scope="request" />
-</c:if>
-<c:if test="${properties.disabled}">
-	<c:set var="disabled" value="disabled='disabled'" scope="request" />
-</c:if>
+<c:choose>
+	<c:when test="${properties.required}">
+		<c:set var="required" value="required='required'" scope="request" />
+	</c:when>
+	<c:otherwise>
+		<c:set var="required" value="" scope="request" />
+	</c:otherwise>
+</c:choose>
+<c:choose>
+	<c:when test="${properties.disabled}">
+		<c:set var="disabled" value="disabled='disabled'" scope="request" />
+	</c:when>
+	<c:otherwise>
+		<c:set var="disabled" value="" scope="request" />
+	</c:otherwise>
+</c:choose>
 <div class="Field-Group">
 	<c:if test="${not empty properties.label}">
 		<label for="${properties.name}">
 			<sling:encode value="${properties.label}" mode="HTML" />
-			<c:if test="${required}"><span class="error">*</span></c:if>
+			<c:if test="${properties.required}"><span class="error">*</span></c:if>
 		</label>
 	</c:if>
 	<div class="Field-Input">

-- 
To stop receiving notification emails like this one, please contact
dklco@apache.org.