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/11/02 19:31:17 UTC
[sling-org-apache-sling-app-cms] branch master updated: More
cleanup, mostly around file optimization
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 23047f9 More cleanup, mostly around file optimization
23047f9 is described below
commit 23047f965b535fc2eb1db8f1fd893e24a6d48e9b
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Nov 2 15:30:56 2018 -0400
More cleanup, mostly around file optimization
---
ui/src/main/frontend/src/js/cms.modal.js | 2 +-
.../cms/fileeditorinclude/fileeditorinclude.jsp | 51 ++++----
.../components/cms/optimizefile/optimizefile.jsp | 141 +++++++++++----------
.../libs/sling-cms/content/config/create.json | 118 ++++++++---------
.../libs/sling-cms/content/file/optimize.json | 2 +-
.../libs/sling-cms/content/file/upload.json | 1 -
.../libs/sling-cms/content/page/create.json | 1 -
.../libs/sling-cms/content/site/content.json | 2 +-
8 files changed, 164 insertions(+), 154 deletions(-)
diff --git a/ui/src/main/frontend/src/js/cms.modal.js b/ui/src/main/frontend/src/js/cms.modal.js
index 5a72fa8..348c9d0 100644
--- a/ui/src/main/frontend/src/js/cms.modal.js
+++ b/ui/src/main/frontend/src/js/cms.modal.js
@@ -53,7 +53,7 @@
nomnom.decorate(".modal",{
events:{
- ".close,.modal-close,.modal-background" :{
+ ".close,.modal-close,.close-modal,.modal-background" :{
click: function (event) {
this.remove();
}
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/fileeditorinclude/fileeditorinclude.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/fileeditorinclude/fileeditorinclude.jsp
index 1015702..64dd632 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/fileeditorinclude/fileeditorinclude.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/fileeditorinclude/fileeditorinclude.jsp
@@ -20,31 +20,32 @@
<sling:getCAConfigResources var="editors" resource="${slingRequest.requestPathInfo.suffixResource}" bucket="files" name="editors" />
<c:set var="mimetype" value="|${slingRequest.requestPathInfo.suffixResource.valueMap['jcr:content/jcr:mimeType']}|" />
<c:forEach var="editor" items="${editors}">
- <c:set var="mimetypes" value="|${fn:join(sling:getRelativeResource(editor,'jcr:content').valueMap.mimetypes,'|')}|" />
- <c:choose>
- <c:when test="${fn:length(mimetypes) == 2}">
- <c:set var="general" value="${editor}" />
- </c:when>
- <c:when test="${fn:contains(mimetypes,mimetype)}">
- <c:set var="matches" value="${editor}" />
- </c:when>
- </c:choose>
+ <c:set var="mimetypes" value="|${fn:join(sling:getRelativeResource(editor,'jcr:content').valueMap.mimetypes,'|')}|" />
+ <c:choose>
+ <c:when test="${fn:length(mimetypes) == 2}">
+ <c:set var="general" value="${editor}" />
+ </c:when>
+ <c:when test="${fn:contains(mimetypes,mimetype)}">
+ <c:set var="matches" value="${editor}" />
+ </c:when>
+ </c:choose>
</c:forEach>
<form method="post" action="${slingRequest.requestPathInfo.suffix}" enctype="multipart/form-data" class="Form-Ajax">
- <c:choose>
- <c:when test="${matches != null}">
- <sling:include path="${matches.path}/fields" resourceType="sling-cms/components/general/container" />
- </c:when>
- <c:when test="${general != null}">
- <sling:include path="${general.path}/fields" resourceType="sling-cms/components/general/container" />
- </c:when>
- <c:otherwise>
- No editor configured for <sling:encode value="${slingRequest.requestPathInfo.suffixResource.valueMap['jcr:content/jcr:mimeType']}" mode="HTML" />!
- </c:otherwise>
- </c:choose>
- <div class="Field-Group">
- <button type="submit" class="button is-primary">
- <sling:encode value="Save File" mode="HTML" />
- </button>
- </div>
+ <c:choose>
+ <c:when test="${matches != null}">
+ <sling:include path="${matches.path}/fields" resourceType="sling-cms/components/general/container" />
+ </c:when>
+ <c:when test="${general != null}">
+ <sling:include path="${general.path}/fields" resourceType="sling-cms/components/general/container" />
+ </c:when>
+ <c:otherwise>
+ No editor configured for <sling:encode value="${slingRequest.requestPathInfo.suffixResource.valueMap['jcr:content/jcr:mimeType']}" mode="HTML" />!
+ </c:otherwise>
+ </c:choose>
+ <div class="Field-Group">
+ <button type="submit" class="button is-primary">
+ Save File
+ </button>
+ <button type="button" class="button close">Cancel</button>
+ </div>
</form>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/optimizefile/optimizefile.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/optimizefile/optimizefile.jsp
index 4057b07..31270db 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/optimizefile/optimizefile.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/optimizefile/optimizefile.jsp
@@ -20,69 +20,80 @@
<sling:adaptTo var="optimizer" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.fileoptim.models.OptimizeResource" />
<sling:adaptTo var="optimizedFile" adaptable="${sling:getRelativeResource(slingRequest.requestPathInfo.suffixResource,'jcr:content')}" adaptTo="org.apache.sling.fileoptim.models.OptimizedFile" />
<div class="columns">
- <div class="column">
- <h4>Info</h4>
- <c:choose>
- <c:when test="${optimizer.canOptimize && optimizer.result.optimized}">
- <dl>
- <dt>
- Algorithm
- </dt>
- <dd>
- ${optimizer.result.algorithm}
- </dd>
- <dt>
- Original Size
- </dt>
- <dd>
- ${optimizer.result.originalSize}
- </dd>
- <dt>
- Optimized Size
- </dt>
- <dd>
- ${optimizer.result.optimizedSize}
- </dd>
- <dt>
- Savings
- </dt>
- <dd>
- <fmt:formatNumber value="${optimizer.result.savings * 100}" type="number" groupingUsed="false" maxFractionDigits="2" />%
- </dd>
- </dl>
- <form action="${slingRequest.requestPathInfo.suffix}" class="Form-Ajax" method="post">
- <input type="hidden" name=":operation" value="fileoptim:optimize" />
- <input type="submit" value="Optimize" class="button is-primary" />
- </form>
- </c:when>
- <c:when test="${optimizer.optimized}">
- <strong>Already Optimized</strong>
- <dl>
- <dt>
- Algorithm
- </dt>
- <dd>
- ${optimizedFile.algorithm}
- </dd>
- <dt>
- Savings
- </dt>
- <dd>
- <fmt:formatNumber value="${optimizedFile.savings * 100}" type="number" groupingUsed="false" maxFractionDigits="2" />%
- </dd>
- </dl>
- <form action="${slingRequest.requestPathInfo.suffix}" class="Form-Ajax" method="post">
- <input type="hidden" name=":operation" value="fileoptim:restore" />
- <input type="submit" value="Restore Original" class="button is-primary" />
- </form>
- </c:when>
- <c:otherwise>
- <strong>File Cannot be Optimized</strong>
- </c:otherwise>
- </c:choose>
- </div>
- <div class="column">
- <h4>Preview</h4>
- <object data="/system/fileoptim/preview?path=${slingRequest.requestPathInfo.suffix}" class="preview"></object>
- </div>
+ <div class="column">
+ <h4>Info</h4>
+ <c:choose>
+ <c:when test="${optimizer.canOptimize && optimizer.result.optimized}">
+ <dl>
+ <dt>
+ Algorithm
+ </dt>
+ <dd>
+ ${optimizer.result.algorithm}
+ </dd>
+ <dt>
+ Original Size
+ </dt>
+ <dd>
+ ${optimizer.result.originalSize}
+ </dd>
+ <dt>
+ Optimized Size
+ </dt>
+ <dd>
+ ${optimizer.result.optimizedSize}
+ </dd>
+ <dt>
+ Savings
+ </dt>
+ <dd>
+ <fmt:formatNumber value="${optimizer.result.savings * 100}" type="number" groupingUsed="false" maxFractionDigits="2" />%
+ </dd>
+ </dl>
+ <form action="${slingRequest.requestPathInfo.suffix}" class="Form-Ajax" method="post">
+ <input type="hidden" name=":operation" value="fileoptim:optimize" />
+ <button type="submit" class="button is-primary">
+ Optimize
+ </button>
+ <button type="button" class="button close">Cancel</button>
+ </form>
+ </c:when>
+ <c:when test="${optimizer.optimized}">
+ <strong>Already Optimized</strong>
+ <dl>
+ <dt>
+ Algorithm
+ </dt>
+ <dd>
+ ${optimizedFile.algorithm}
+ </dd>
+ <dt>
+ Savings
+ </dt>
+ <dd>
+ <fmt:formatNumber value="${optimizedFile.savings * 100}" type="number" groupingUsed="false" maxFractionDigits="2" />%
+ </dd>
+ </dl>
+ <form action="${slingRequest.requestPathInfo.suffix}" class="Form-Ajax" method="post">
+ <input type="hidden" name=":operation" value="fileoptim:restore" />
+ <button type="submit" class="button is-primary">
+ Restore Original
+ </button>
+ <button type="button" class="button close">Cancel</button>
+ </form>
+ </c:when>
+ <c:otherwise>
+ <strong>File Cannot be Optimized</strong>
+ <div>
+ <button type="button" class="button close">Close</button>
+ </div>
+ </c:otherwise>
+ </c:choose>
+ </div>
+ <div class="column">
+ <c:if test="${optimizer.canOptimize && optimizer.result.optimized}">
+ <h4>Preview</h4>
+ <img src="/system/fileoptim/preview?path=${slingRequest.requestPathInfo.suffix}" class="preview" />
+ </c:if>
+ </div>
</div>
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
index 887ef4f..a65634e 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
@@ -1,61 +1,61 @@
{
- "jcr:primaryType": "sling:Page",
- "jcr:content": {
- "sling:resourceType": "sling-cms/components/pages/modal",
- "jcr:title": "Create Config",
- "jcr:primaryType": "nt:unstructured",
- "container": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "slingform": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "actionSuffix": "/*",
- "button": "Create Site Config",
- "successPrepend": "/libs/sling-cms/content/site/content.html",
- "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
- },
- "name": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Name",
- "name": ":name"
- },
- "nameParam": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": ":nameParam",
- "value": "jcr:title"
- },
- "primaryType": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "jcr:primaryType",
- "value": "sling:Config"
- },
- "pageTemplatesPrimaryType": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "pageTemplates/jcr:primaryType",
- "value": "nt:unstructured"
- },
- "type": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "name": "sling:resourceType",
- "optionsScript": "/libs/sling-cms/components/editor/scripts/configResourceTypeOptions.jsp",
- "required": true
- }
- }
- }
- }
- }
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "sling:resourceType": "sling-cms/components/pages/modal",
+ "jcr:title": "Create Config",
+ "jcr:primaryType": "nt:unstructured",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "slingform": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "actionSuffix": "/*",
+ "button": "Create Site Config",
+ "successPrepend": "/libs/sling-cms/content/site/content.html",
+ "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
+ },
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Name",
+ "name": ":name"
+ },
+ "nameParam": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": ":nameParam",
+ "value": "jcr:title"
+ },
+ "primaryType": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "jcr:primaryType",
+ "value": "sling:Config"
+ },
+ "pageTemplatesPrimaryType": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "pageTemplates/jcr:primaryType",
+ "value": "nt:unstructured"
+ },
+ "type": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "name": "sling:resourceType",
+ "optionsScript": "/libs/sling-cms/components/editor/scripts/configResourceTypeOptions.jsp",
+ "required": true
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/optimize.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/optimize.json
index 117979e..7363391 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/optimize.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/optimize.json
@@ -1,7 +1,7 @@
{
"jcr:primaryType": "sling:Page",
"jcr:content": {
- "sling:resourceType": "sling-cms/components/pages/base",
+ "sling:resourceType": "sling-cms/components/pages/modal",
"jcr:title": "Optimize File",
"jcr:primaryType": "nt:unstructured",
"container": {
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/upload.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/upload.json
index 8d79ada..be0b14a 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/upload.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/file/upload.json
@@ -10,7 +10,6 @@
"slingform": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/slingform",
- "title": "Add File",
"button": "Upload File",
"fields": {
"jcr:primaryType": "nt:unstructured",
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
index d0a7cc1..ddf0fd3 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
@@ -10,7 +10,6 @@
"slingform": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/slingform",
- "title": "Add Page",
"button": "Create Page",
"successPrepend": "/libs/sling-cms/content/site/content.html",
"fields": {
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
index 2d9b1fd..f48b94c 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
@@ -243,7 +243,7 @@
},
"optimize": {
"jcr:primaryType": "nt:unstructured",
- "modal": false,
+ "modal": true,
"title": "Optimize File",
"icon": "archive",
"prefix": "/cms/file/optimize.html"