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 51a6d49  Merging and resolving issues
51a6d49 is described below

commit 51a6d490503e20a06330dc867990f3a01910d53f
Author: Dan Klco <[email protected]>
AuthorDate: Thu Oct 11 14:21:14 2018 -0400

    Merging and resolving issues
---
 ui/src/main/frontend/src/js/cms.js          |  6 +--
 ui/src/main/frontend/src/js/cms.nav.js      | 22 +++++-----
 ui/src/main/frontend/src/js/cms.taxonomy.js | 68 +++++++++++++++++------------
 ui/src/main/frontend/src/js/nomnom.js       | 12 ++---
 4 files changed, 60 insertions(+), 48 deletions(-)

diff --git a/ui/src/main/frontend/src/js/cms.js 
b/ui/src/main/frontend/src/js/cms.js
index 8d05921..0eeb090 100644
--- a/ui/src/main/frontend/src/js/cms.js
+++ b/ui/src/main/frontend/src/js/cms.js
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */ 
-
+/* eslint-env es6, browser */
 var Sling = {};
 Sling.CMS = {
     handlers: {
@@ -101,8 +101,8 @@ Sling.CMS = {
 
 
 nomnom.decorate('.suffix-form', {
-    events :{
-        submit : function(event){
+    events: {
+        submit: function (event) {
             event.preventDefault();
             var suffix = $(this).find('input[name=suffix]').val();
             var path = $(this).attr('action');
diff --git a/ui/src/main/frontend/src/js/cms.nav.js 
b/ui/src/main/frontend/src/js/cms.nav.js
index 6ff1604..a035fdb 100644
--- a/ui/src/main/frontend/src/js/cms.nav.js
+++ b/ui/src/main/frontend/src/js/cms.nav.js
@@ -16,14 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-nomnom.decorate(".navbar-burger", {
-    events :{
-        click: function(){
-            var target = document.querySelector(this.dataset.target);
-            target.classList.toggle('is-active');
-            this.classList.toggle('is-active');
+/* eslint-env browser, es6 */
+(function (nomnom) {
+    'use strict';
+    nomnom.decorate(".navbar-burger", {
+        events: {
+            click: function () {
+                var target = document.querySelector(this.dataset.target);
+                target.classList.toggle('is-active');
+                this.classList.toggle('is-active');
+            }
         }
-    }
-});
-
+    });
+}(window.nomnom = window.nomnom || {}));
\ No newline at end of file
diff --git a/ui/src/main/frontend/src/js/cms.taxonomy.js 
b/ui/src/main/frontend/src/js/cms.taxonomy.js
index be802ee..ef20844 100644
--- a/ui/src/main/frontend/src/js/cms.taxonomy.js
+++ b/ui/src/main/frontend/src/js/cms.taxonomy.js
@@ -16,37 +16,47 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-nomnom.decorate('.taxonomy', class {
-    "click::.taxonomy__add"(event){
-        event.preventDefault();
-        event.stopPropagation();
-        var $ctx = $(this);
-        var $span = $('<span/>').html($ctx.find('.taxonomy__template').html());
-        var val = $ctx.find('.taxonomy__field input').val();
-        var found = false;
-        $ctx.find('.taxonomy__item input').each(function(idx, el){
-            if($(el).val() === val){
-                found = true;
+/* eslint-env browser, es6 */
+(function (nomnom, $) {
+    'use strict';
+    nomnom.decorate('.taxonomy', {
+        events: {
+            '.taxonomy__add': {
+                click: function (event) {
+                    event.preventDefault();
+                    event.stopPropagation();
+                    var $ctx = $(this),
+                        $span = 
$('<span/>').html($ctx.find('.taxonomy__template').html()),
+                        val = $ctx.find('.taxonomy__field input').val(),
+                        found = false,
+                        title = $ctx.find('option[value="' + val + 
'"]').text();
+                    $ctx.find('.taxonomy__item input').each(function (idx, el) 
{
+                        if ($(el).val() === val) {
+                            found = true;
+                        }
+                    });
+                    if (found) {
+                        return false;
+                    }
+                    $span.find('input').val(val);
+
+                    if (title !== '') {
+                        $span.find('.taxonomy__title').text(title);
+                        $('.taxonomy__container').append($span);
+                        $ctx.find('.taxonomy__field input').val('');
+                    }
+                }
             }
-        });
-        if(found){
-            return false;
         }
-        $span.find('input').val(val);
-        var title = $ctx.find('option[value="'+val+'"]').text();
+    });
 
-        if(title !== ''){
-            $span.find('.taxonomy__title').text(title);
-            $('.taxonomy__container').append($span);
-            $ctx.find('.taxonomy__field input').val('');
+    nomnom.decorate('.taxonomy__item', {
+        events: {
+            click: function () {
+                $(this).remove();
+                return false;
+            }
         }
-        return false;
-    }
-});
+    });
 
-nomnom.decorate('.taxonomy__item', class {
-    "click::"(){
-        $(this).remove();
-        return false;
-    }
-});
\ No newline at end of file
+}(window.nomnom = window.nomnom || {}, window.jQuery || {}));
\ No newline at end of file
diff --git a/ui/src/main/frontend/src/js/nomnom.js 
b/ui/src/main/frontend/src/js/nomnom.js
index 17f5ea8..5ab09d0 100644
--- a/ui/src/main/frontend/src/js/nomnom.js
+++ b/ui/src/main/frontend/src/js/nomnom.js
@@ -99,17 +99,17 @@
     };
 
     var registerEventHandlers = function(node, propertyName, events) {
-        for ( var eventName in events) {
-            let possibleFunc = events[eventName];
+        for (  eventName in events) {
+            var possibleFunc = events[eventName];
             if (typeof possibleFunc === "function") {
                 node.addEventListener(eventName, function(event) {
                     possibleFunc.call(node, event);
                 });
             } else {
-                let selector = eventName;
-                let targetNode = node;
-                for ( var childEventName in possibleFunc) {
-                    let func = targetedEventHandler(
+                var selector = eventName;
+                var targetNode = node;
+                for (  childEventName in possibleFunc) {
+                    var func = targetedEventHandler(
                             possibleFunc[childEventName], selector);
                     if (selector == "document") {
                         targetNode = document;

Reply via email to