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 2020/11/23 21:53:09 UTC

[sling-org-apache-sling-app-cms] 01/03: Minor - cleaning up the UI for the templates and policies

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

commit 2ad7b8d929ee83ec90d87a8a9473556a8263cb1d
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Nov 23 16:03:06 2020 -0500

    Minor - cleaning up the UI for the templates and policies
---
 .../components/general/reference/types.jsp         | 44 +++++++++++++++
 ui/src/main/frontend/scss/cms.scss                 |  1 +
 ui/src/main/frontend/scss/editor.scss              |  1 -
 .../components/caconfig/policy/config/config.jsp   | 34 +++++++-----
 .../components/caconfig/template/config/config.jsp | 64 ++++++++++++----------
 .../components/caconfig/template/config/edit.json  | 13 -----
 .../components/editor/slingform/slingform.jsp      | 16 +++---
 7 files changed, 107 insertions(+), 66 deletions(-)

diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/reference/types.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/reference/types.jsp
new file mode 100644
index 0000000..3feb6c0
--- /dev/null
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/reference/types.jsp
@@ -0,0 +1,44 @@
+<%-- /*
+ * 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"%>
+<option value="">
+    -- Default --
+</option>
+<option disabled></option>
+<option value="sling-cms/components/general/container" ${slingRequest.requestPathInfo.suffixResource.valueMap.overrideType == 'sling-cms/components/general/container' ? 'selected' : ''}>
+    Container
+</option>
+<option disabled></option>
+<sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentPolicyManager" var="componentPolicyMgr" />
+<c:set var="configRsrc" value="${componentPolicyMgr.componentPolicy.componentConfigs['reference/components/general/reference']}" />
+<c:set var="join" value="' OR [componentType]='" />
+<c:set var="query" value="SELECT * FROM [sling:Component] WHERE [componentType] IS NOT NULL AND ([componentType]='${fn:join(configRsrc.valueMap.availableComponentTypes,join)}') ORDER BY [jcr:title]" />
+<c:forEach var="component" items="${sling:findResources(resourceResolver,query,'JCR-SQL2')}">
+    <c:choose>
+        <c:when test="${fn:startsWith(component.path,'/libs/')}">
+            <c:set var="type" value="${fn:substringAfter(component.path, '/libs/')}" />
+        </c:when>
+        <c:otherwise>
+            <c:set var="type" value="${fn:substringAfter(component.path, '/apps/')}" />
+        </c:otherwise>
+    </c:choose>
+    <option ${slingRequest.requestPathInfo.suffixResource.valueMap.overrideType == type ? 'selected' : ''} value="${type}">
+        ${sling:encode(component.valueMap['jcr:title'],'HTML')}
+    </option>
+</c:forEach>
\ No newline at end of file
diff --git a/ui/src/main/frontend/scss/cms.scss b/ui/src/main/frontend/scss/cms.scss
index a4c7184..e086eca 100644
--- a/ui/src/main/frontend/scss/cms.scss
+++ b/ui/src/main/frontend/scss/cms.scss
@@ -143,6 +143,7 @@ small.card-footer-item {
 
 .form-wrapper {
   border: none;
+  min-height: 100px;
 }
 
 .form-wrapper[disabled] .button,
diff --git a/ui/src/main/frontend/scss/editor.scss b/ui/src/main/frontend/scss/editor.scss
index a000b9e..3a01735 100644
--- a/ui/src/main/frontend/scss/editor.scss
+++ b/ui/src/main/frontend/scss/editor.scss
@@ -64,7 +64,6 @@
   }
 
   .modal-body {
-    padding: 0.5em;
     height: 540px;
   }
 
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
index 8fe64eb..6440be4 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
@@ -20,25 +20,29 @@
 <br/>
 <h3><sling:encode value="${properties['jcr:title']}" mode="HTML" /> (${resource.path})</h3>
 <hr/>
-<div>
-    <h4>
+<div class="panel">
+    <h4 class="panel-heading">
         Available Component Types
     </h4>
-    <ul>
-        <c:forEach var="availableComponentType" items="${properties.availableComponentTypes}">
-            <li>
-                <sling:encode value="${availableComponentType}" mode="HTML" />
-            </li>
-        </c:forEach>
-    </ul>
+    <div class="panel-body p-2">
+        <ul>
+            <c:forEach var="availableComponentType" items="${properties.availableComponentTypes}">
+                <li>
+                    <sling:encode value="${availableComponentType}" mode="HTML" />
+                </li>
+            </c:forEach>
+        </ul>
+    </div>
 </div>
 <hr/>
-<div>
-    <h4>
+<div class="panel">
+    <h4 class="panel-heading">
         Component Configurations
     </h4>
-    <c:set var="oldAvailableTypes" value="${availableTypes}" />
-    <c:set var="availableTypes" value="SlingCMS-ComponentConfig" scope="request" />
-    <sling:include path="componentConfigurations" resourceType="sling-cms/components/general/reloadcontainer" />
-    <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    <div class="panel-body p-2">
+        <c:set var="oldAvailableTypes" value="${availableTypes}" />
+        <c:set var="availableTypes" value="SlingCMS-ComponentConfig" scope="request" />
+        <sling:include path="componentConfigurations" resourceType="sling-cms/components/general/reloadcontainer" />
+        <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    </div>
 </div>
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
index 0291f24..466e970 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
@@ -19,44 +19,48 @@
 <%@include file="/libs/sling-cms/global.jsp"%>
 <br/>
 <h3><sling:encode value="${properties['jcr:title']}" mode="HTML" /> (${resource.path})</h3>
-<c:if test="${sling:getRelativeResource(resource, 'thumbnail') != null}">
-    <img src="${resource.path}/thumbnail.transform/sling-cms-thumbnail128.png" alt="Thumbnail" class="image is-128x128" />
-</c:if>
-<br/>
-<div>
-    <h4>Allowed Paths</h4>
-    <ul>
-        <c:forEach var="allowedPath" items="${properties.allowedPaths}">
-            <li>
-                <pre><sling:encode value="${allowedPath}" mode="HTML" /></pre>
-            </li>
-        </c:forEach>
-    </ul>
+<div class="panel">
+    <h4 class="panel-heading">Allowed Paths</h4>
+    <div class="panel-body p-2">
+        <ul>
+            <c:forEach var="allowedPath" items="${properties.allowedPaths}">
+                <li>
+                    <pre><sling:encode value="${allowedPath}" mode="HTML" /></pre>
+                </li>
+            </c:forEach>
+        </ul>
+    </div>
 </div>
 <hr/>
-<div>
-    <h4>
-        Component Policies
+<div class="panel">
+    <h4 class="panel-heading">
+        Template Content
     </h4>
-    <c:set var="oldAvailableTypes" value="${availableTypes}" />
-    <c:set var="availableTypes" value="SlingCMS-PolicyMappingConfig" scope="request" />
-    <sling:include path="policies" resourceType="sling-cms/components/general/reloadcontainer" />
-    <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    <div class="panel-body p-2">
+        <pre><sling:encode value="${properties.template}" mode="HTML" /></pre>
+    </div>
 </div>
 <hr/>
-<div>
-    <h4>
-        Template Content
+<div class="panel">
+    <h4 class="panel-heading">
+        Component Policies
     </h4>
-    <pre><sling:encode value="${properties.template}" mode="HTML" /></pre>
+    <div class="panel-body p-2">
+        <c:set var="oldAvailableTypes" value="${availableTypes}" />
+        <c:set var="availableTypes" value="SlingCMS-PolicyMappingConfig" scope="request" />
+        <sling:include path="policies" resourceType="sling-cms/components/general/reloadcontainer" />
+        <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    </div>
 </div>
 <hr/>
-<div>
-    <h4>
+<div class="panel">
+    <h4 class="panel-heading">
         Configuration Fields
     </h4>
-    <c:set var="oldAvailableTypes" value="${availableTypes}" />
-    <c:set var="availableTypes" value="SlingCMS-FieldConfig" scope="request" />
-    <sling:include path="fields" resourceType="sling-cms/components/general/reloadcontainer" />
-    <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    <div class="panel-body p-2">
+        <c:set var="oldAvailableTypes" value="${availableTypes}" />
+        <c:set var="availableTypes" value="SlingCMS-FieldConfig" scope="request" />
+        <sling:include path="fields" resourceType="sling-cms/components/general/reloadcontainer" />
+        <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
+    </div>
 </div>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
index e01bec3..cba3207 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
@@ -12,19 +12,6 @@
             "name": "jcr:title",
             "required": true
         },
-        "thumbnail": {
-            "jcr:primaryType": "nt:unstructured",
-            "sling:resourceType": "sling-cms/components/editor/fields/text",
-            "label": "Thumbnail",
-            "name": "thumbnail",
-            "type": "file"
-        },
-        "thumbnailTypeHint": {
-            "jcr:primaryType": "nt:unstructured",
-            "sling:resourceType": "sling-cms/components/editor/fields/hidden",
-            "name": "thumbnail@TypeHint",
-            "value": "sling:File"
-        },
         "allowedPaths": {
             "jcr:primaryType": "nt:unstructured",
             "sling:resourceType": "sling-cms/components/editor/fields/repeating",
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
index 0b53d0f..e995a23 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
@@ -22,14 +22,16 @@
     enctype="multipart/form-data" class="Form-Ajax"
     data-add-date="${properties.addDate != false}"
     data-callback="${properties.callback}">
-    <fieldset class="form-wrapper field">
+    <fieldset class="form-wrapper pt-4 field">
         <input type="hidden" name="_charset_" value="utf-8" />
         <sling:include path="fields" resourceType="sling-cms/components/general/container" />
-        <button type="submit" class="button is-primary">
-            <sling:encode value="${properties.button}" default="Save" mode="HTML" />
-        </button>
-        <c:if test="${properties.skipcancel != true}">
-            <a href="${sling:encode(header.referer,'HTML_ATTR')}" class="button close">Cancel</a>
-        </c:if>
+        <div class="field">
+            <button type="submit" class="button is-primary">
+                <sling:encode value="${properties.button}" default="Save" mode="HTML" />
+            </button>
+            <c:if test="${properties.skipcancel != true}">
+                <a href="${sling:encode(header.referer,'HTML_ATTR')}" class="button close">Cancel</a>
+            </c:if>
+        </div>
     </fieldset>
 </form>
\ No newline at end of file