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 13:51:37 UTC
[sling-org-apache-sling-app-cms] branch master updated:
Improvements to the new modal structure to add titles and make clicking the
background close the modal
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 49982b6 Improvements to the new modal structure to add titles and make clicking the background close the modal
49982b6 is described below
commit 49982b6938bfb9a936cc7a389ac1e15eae6ca713
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Nov 2 09:51:33 2018 -0400
Improvements to the new modal structure to add titles and make clicking
the background close the modal
---
ui/src/main/frontend/src/js/cms.js | 5 ++---
ui/src/main/frontend/src/js/cms.modal.js | 8 ++++----
.../components/editor/slingform/slingform.jsp | 2 +-
.../libs/sling-cms/components/pages/modal/modal.jsp | 7 ++++---
.../sling-cms/content/page/siteeditproperties.json | 21 ---------------------
.../libs/sling-cms/content/site/content.json | 2 +-
6 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/ui/src/main/frontend/src/js/cms.js b/ui/src/main/frontend/src/js/cms.js
index efd9f7e..d6051cf 100644
--- a/ui/src/main/frontend/src/js/cms.js
+++ b/ui/src/main/frontend/src/js/cms.js
@@ -47,11 +47,10 @@ Sling.CMS = {
},
ui: {
confirmMessage: function(title, message, complete){
- var $modal = $('<div class="modal"><div class="modal-background"></div><div class="modal-card is-draggable"><header class="modal-card-head"><p class="modal-card-title">'+title+'</p><button class="delete" aria-label="close"></button></header><section class="modal-card-body">'+message+'</section><footer class="modal-card-foot"><button type="button" class="close-modal button is-primary">OK</button></footer></div>');
+ var $modal = $('<div class="modal"><div class="modal-background"></div><div class="is-draggable modal-content"><div class="box"><h3 class="modal-title">'+title+'</h3><p>'+message+'</p><br/><button type="button" class="close-modal button is-primary">OK</button></div></div><button class="modal-close is-large" aria-label="close"></button>');
$('body').append($modal);
$modal.addClass('is-active');
- $modal.find('.delete,.close-modal').click(function(){
- $modal.css('display','none').remove();
+ $modal.find('.modal-close,.close-modal,.modal-background').click(function(){
complete();
});
$modal.find('.delete,.close-modal').focus();
diff --git a/ui/src/main/frontend/src/js/cms.modal.js b/ui/src/main/frontend/src/js/cms.modal.js
index f687ec8..5a72fa8 100644
--- a/ui/src/main/frontend/src/js/cms.modal.js
+++ b/ui/src/main/frontend/src/js/cms.modal.js
@@ -32,7 +32,7 @@
getModal: function (title, link, button) {
var modal = document.createElement('div');
modal.classList.add('modal');
- modal.innerHTML = '<div class="loader is-loading"></div>';
+ modal.innerHTML = '<div class="box"><h3>Loading...</h3><div class="loader is-loading"></div></div>';
document.querySelector('body').appendChild(modal);
var request = new XMLHttpRequest();
@@ -43,9 +43,9 @@
window.location.reload();
} else {
modal.innerHTML = request.responseText;
- modal.classList.add('is-active');
}
};
+ modal.classList.add('is-active');
request.send();
}
}
@@ -53,7 +53,7 @@
nomnom.decorate(".modal",{
events:{
- ".close,.modal-close" :{
+ ".close,.modal-close,.modal-background" :{
click: function (event) {
this.remove();
}
@@ -61,4 +61,4 @@
}
});
-}(window.nomnom = window.nomnom || {}, window.jQuery || {}));
\ No newline at end of file
+}(window.nomnom = window.nomnom || {}));
\ No newline at end of file
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 30d04e6..bb5ebea 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
@@ -29,7 +29,7 @@
resourceType="sling-cms/components/general/container" />
</fieldset>
<button type="submit" class="button is-primary">
- <sling:encode value="${properties.button}" mode="HTML" />
+ <sling:encode value="${properties.button}" default="Save" mode="HTML" />
</button>
<button type="button" class="button close">Cancel</button>
</form>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/modal/modal.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/modal/modal.jsp
index d09bb00..c95a78b 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/modal/modal.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/modal/modal.jsp
@@ -19,8 +19,9 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<div class="modal-background"></div>
<div class="modal-content">
-<div class="box">
-<sling:include path="container" resourceType="sling-cms/components/general/container" />
-</div>
+ <div class="box">
+ <h3><sling:encode value="${properties['jcr:title']}" mode="HTML" /></h3>
+ <sling:include path="container" resourceType="sling-cms/components/general/container" />
+ </div>
</div>
<button class="modal-close is-large" aria-label="close"></button>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json
deleted file mode 100644
index 707f2b2..0000000
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/siteeditproperties.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "jcr:primaryType": "sling:Page",
- "jcr:content": {
- "sling:resourceType": "sling-cms/components/pages/modal",
- "jcr:title": "Edit Page",
- "jcr:primaryType": "nt:unstructured",
- "container": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "richtext": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/richtext",
- "text": "<h3>Edit Page</h3>"
- },
- "pageeditor": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/cms/pageeditbar/propertieseditor"
- }
- }
- }
-}
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 76bc446..2d9b1fd 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
@@ -112,7 +112,7 @@
"modal": true,
"title": "Edit Page Properties",
"icon": "cog",
- "prefix": "/cms/page/siteeditproperties.html"
+ "prefix": "/cms/page/editproperties.html"
},
"insights": {
"jcr:primaryType": "nt:unstructured",