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 65ea3b3 Fixed SLING-8005 - made the button the focus when opening a
confirmation modal
65ea3b3 is described below
commit 65ea3b3df93dd6822094aefdeae238e9c10ee737
Author: Dan Klco <[email protected]>
AuthorDate: Wed Oct 10 14:31:22 2018 -0400
Fixed SLING-8005 - made the button the focus when opening a confirmation
modal
---
ui/src/main/frontend/src/js/cms.form.js | 2 +-
ui/src/main/frontend/src/js/cms.js | 32 ++++++++++++++------------------
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/ui/src/main/frontend/src/js/cms.form.js
b/ui/src/main/frontend/src/js/cms.form.js
index c81a961..789341d 100644
--- a/ui/src/main/frontend/src/js/cms.form.js
+++ b/ui/src/main/frontend/src/js/cms.form.js
@@ -55,7 +55,7 @@ nomnom.decorate(".Form-Ajax", class {
if (callback && Sling.CMS.ext[callback]){
Sling.CMS.ext[callback](res, msg);
} else {
- Sling.CMS.ext.reload(res, msg);
+ Sling.CMS.ui.confirmReload(res, msg);
}
},
error: function(xhr, msg, err){
diff --git a/ui/src/main/frontend/src/js/cms.js
b/ui/src/main/frontend/src/js/cms.js
index c1db964..33b8abb 100644
--- a/ui/src/main/frontend/src/js/cms.js
+++ b/ui/src/main/frontend/src/js/cms.js
@@ -47,9 +47,20 @@ Sling.CMS = {
$modal.css('display','none').remove();
complete();
});
+ $modal.find('.delete,.close-modal').focus();
return $modal;
+ },
+ confirmReload: function(res, msg) {
+ if(window.self !== window.top){
+ window.top.Sling.CMS.ui.confirmMessage(msg,
res.title,function(){
+ window.top.location.reload();
+ });
+ } else {
+ Sling.CMS.ui.confirmMessage(msg, res.title,function(){
+ location.reload();
+ });
+ }
}
-
},
utils: {
form2Obj: function ($form){
@@ -62,8 +73,6 @@ Sling.CMS = {
}
};
-
-
Sling.CMS.ext['handlemove'] = function(res, msg){
var changes = res.changes[0];
if(changes.type === 'moved' &&
window.location.pathname.indexOf(changes.argument[0]) !== -1){
@@ -71,7 +80,7 @@ Sling.CMS = {
window.location =
window.location.href.replace(changes.argument[0], changes.argument[1]);
});
} else {
- Sling.CMS.ext.reload(res, msg);
+ Sling.CMS.ui.confirmReload(res, msg);
}
}
@@ -117,18 +126,6 @@ Sling.CMS = {
});
}
};
-
- Sling.CMS.ext['reload'] = function(res, msg) {
- if(window.self !== window.top){
- window.top.Sling.CMS.ui.confirmMessage(msg, res.title,function(){
- window.top.location.reload();
- });
- } else {
- Sling.CMS.ui.confirmMessage(msg, res.title,function(){
- location.reload();
- });
- }
- }
Sling.CMS.ext['handledelete'] = function(res, msg){
if(window.location.pathname.indexOf(res.path) !== -1){
@@ -136,11 +133,10 @@ Sling.CMS = {
window.location = '/cms';
});
} else {
- Sling.CMS.ext.reload(res, msg);
+ Sling.CMS.ui.confirmReload(res, msg);
}
}
-
Sling.CMS.ext['richtext'] = {
decorate: function($ctx){
$ctx.find('.richtext').summernote({