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 2019/12/18 07:22:33 UTC

[sling-org-apache-sling-app-cms] 01/02: Fixing sonar lint issues

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8919-fix-error-dialog
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit ea7aa310a38282941dbef3df0572513a0c140756
Author: Dan Klco <dk...@apache.org>
AuthorDate: Tue Dec 17 23:21:52 2019 -0800

    Fixing sonar lint issues
---
 ui/src/main/frontend/js/cms.pathfield.js | 37 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/ui/src/main/frontend/js/cms.pathfield.js b/ui/src/main/frontend/js/cms.pathfield.js
index bc5a41a..e66b14d 100644
--- a/ui/src/main/frontend/js/cms.pathfield.js
+++ b/ui/src/main/frontend/js/cms.pathfield.js
@@ -33,9 +33,15 @@ rava.bind('input.pathfield', {
           if (term === '/') {
             term = base;
           }
-          fetch(`/bin/cms/paths?path=${encodeURIComponent(term)}&type=${encodeURIComponent(type)}`).then((resp) => resp.json()).then((data) => {
-            response(data);
-          });
+          fetch(
+            `/bin/cms/paths?path=${encodeURIComponent(
+              term,
+            )}&type=${encodeURIComponent(type)}`,
+          )
+            .then((resp) => resp.json())
+            .then((data) => {
+              response(data);
+            });
         },
       });
     },
@@ -57,18 +63,25 @@ rava.bind('.search-select-button', {
       if (Sling.CMS.pathfield instanceof HTMLInputElement) {
         Sling.CMS.pathfield.value = this.dataset.path;
       } else {
-        Sling.CMS.pathfield.postMessage({
-          action: 'slingcms.setpath',
-          path,
-        }, window.location.origin);
+        Sling.CMS.pathfield.postMessage(
+          {
+            action: 'slingcms.setpath',
+            path,
+          },
+          window.location.origin,
+        );
       }
       this.closest('.modal').remove();
     },
   },
 });
 
-window.addEventListener('message', (event) => {
-  if (event.data.action === 'slingcms.setpath') {
-    Sling.CMS.pathfield.value = event.data.path;
-  }
-}, false);
+window.addEventListener(
+  'message',
+  (event) => {
+    if (event.data.action === 'slingcms.setpath') {
+      Sling.CMS.pathfield.value = event.data.path;
+    }
+  },
+  false,
+);