You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by je...@apache.org on 2018/11/01 18:38:31 UTC

[sling-org-apache-sling-app-cms] branch master updated (f4e7c1d -> eff7699)

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

jeb pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git.


    from f4e7c1d  SLING-8062 changed modal to be more free form
     new 6e240f3  updates to nomnom to support YUI compression
     new eff7699  SLING-8062 additional modal updates

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ui/src/main/frontend/src/js/nomnom.js              | 320 ++++++++++-----------
 .../libs/sling-cms/content/taxonomy/create.json    |   5 +-
 .../libs/sling-cms/content/taxonomy/edit.json      |   3 +-
 .../libs/sling-cms/content/template/create.json    |   2 +
 4 files changed, 155 insertions(+), 175 deletions(-)


[sling-org-apache-sling-app-cms] 02/02: SLING-8062 additional modal updates

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jeb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit eff7699de1f1382979b1ab0438efa2790cec0468
Author: JE Bailey <je...@apache.org>
AuthorDate: Thu Nov 1 14:37:43 2018 -0400

    SLING-8062 additional modal updates
---
 .../resources/jcr_root/libs/sling-cms/content/taxonomy/create.json   | 5 +++--
 .../resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json     | 3 ++-
 .../resources/jcr_root/libs/sling-cms/content/template/create.json   | 2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json
index 3271749..5271373 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json
@@ -2,8 +2,7 @@
     "jcr:primaryType": "sling:Page",
     "jcr:content": {
         "sling:resourceType": "sling-cms/components/pages/modal",
-        "jcr:title": "Add Taxonomy Item",
-        "modalText": "Create Taxonomy Item",
+        "jcr:title": "Create Taxonomy",
         "jcr:primaryType": "nt:unstructured",
         "container": {
             "jcr:primaryType": "nt:unstructured",
@@ -12,6 +11,8 @@
                 "jcr:primaryType": "nt:unstructured",
                 "sling:resourceType": "sling-cms/components/editor/slingform",
                 "actionSuffix": "/*",
+                "title": "Add Taxonomy",
+                "button": "Create Taxonomy",
                 "fields": {
                     "jcr:primaryType": "nt:unstructured",
                     "sling:resourceType": "sling-cms/components/general/container",
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json
index e2043de..7f861af 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json
@@ -3,7 +3,6 @@
     "jcr:content": {
         "sling:resourceType": "sling-cms/components/pages/modal",
         "jcr:title": "Edit Taxonomy Item",
-        "modalText": "Update Taxonomy",
         "jcr:primaryType": "nt:unstructured",
         "container": {
             "jcr:primaryType": "nt:unstructured",
@@ -11,6 +10,8 @@
             "slingform": {
                 "jcr:primaryType": "nt:unstructured",
                 "sling:resourceType": "sling-cms/components/editor/slingform",
+                "title": "Edit Taxonomy",
+                "button": "Update Taxonomy",
                 "fields": {
                     "jcr:primaryType": "nt:unstructured",
                     "sling:resourceType": "sling-cms/components/general/container",
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/create.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/create.json
index 0e4d80a..ee25355 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/create.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/create.json
@@ -13,6 +13,8 @@
                 "sling:resourceType": "sling-cms/components/editor/slingform",
                 "actionSuffix": "/templates/",
                 "successPrepend": "/libs/sling-cms/content/site/content.html",
+                "title": "Add Template",
+                "button": "Create Taxonomy",
                 "fields": {
                     "jcr:primaryType": "nt:unstructured",
                     "sling:resourceType": "sling-cms/components/general/container",


[sling-org-apache-sling-app-cms] 01/02: updates to nomnom to support YUI compression

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jeb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 6e240f3bdaadd47dcdaa846768bfcaff8980f968
Author: JE Bailey <ja...@sas.com>
AuthorDate: Thu Nov 1 14:32:15 2018 -0400

    updates to nomnom to support YUI compression
---
 ui/src/main/frontend/src/js/nomnom.js | 320 ++++++++++++++++------------------
 1 file changed, 148 insertions(+), 172 deletions(-)

diff --git a/ui/src/main/frontend/src/js/nomnom.js b/ui/src/main/frontend/src/js/nomnom.js
index 07c587b..135d728 100644
--- a/ui/src/main/frontend/src/js/nomnom.js
+++ b/ui/src/main/frontend/src/js/nomnom.js
@@ -19,189 +19,165 @@
 /* eslint-env es6, browser */
 (function(nomnom) {
 
-  if (!Element.prototype.matches) {
-      Element.prototype.matches = Element.prototype.msMatchesSelector;
-  }
-  
-  if (typeof NodeList.prototype.forEach !== "function" && typeof Array.prototype.forEach === "function")  {
-      NodeList.prototype.forEach = Array.prototype.forEach;
-  }
-
-  var tagSelectors = {};
-  var debug = false;
-  var elementMap = new WeakMap();
-  var topics = {};
-  
-// public
-nomnom.decorate = function(selector, config) {
-  if (debug) {
-        console.log("storing selector" + selector);
+    if (!Element.prototype.matches) {
+        Element.prototype.matches = Element.prototype.msMatchesSelector;
     }
-    tagSelectors[selector] = config;
-    let foundItems = document.querySelectorAll(selector);
-    if (foundItems) {
-        foundItems.forEach(function(node) {
-            wrap(node, config);
-        });
+    
+    if (typeof NodeList.prototype.forEach !== "function" && typeof Array.prototype.forEach === "function")  {
+        NodeList.prototype.forEach = Array.prototype.forEach;
     }
-};
 
-nomnom.subscribe = function(topic, listener) {
-  if (!topics[topic]){
-      topics[topic] = new Map();
-  }
-  var caller = this; 
-  topics[topic].set(caller,listener);
-  return {
-      remove: function() {
-          topics[topic].delete(caller);
+    var tagSelectors = {};
+    var debug = false;
+    var elementMap = new WeakMap();
+    
+  // public
+  nomnom.decorate = function(selector, config) {
+    if (debug) {
+          console.log("storing selector" + selector);
       }
-  }
-};
+      tagSelectors[selector] = config;
+      var foundItems = document.querySelectorAll(selector);
+      if (foundItems) {
+          foundItems.forEach(function(node) {
+              wrap(node, config);
+          });
+      }
+  };
 
-nomnom.publish = function(topic) {
-  if (!topics[topic]) {
-      return;
-  }
-  var index = topics[topic].push(listener) - 1;
-  topics[topic].forEach(function(caller, func) {
-    func.apply(caller,arguments);
+  new MutationObserver(function(mutations) {
+      mutations.forEach(function(mutation) {
+          mutation.addedNodes.forEach(function(node) {
+              checkAll(node);
+          });
+      });
+  }).observe(document.body, {
+      attributes : false,
+      childList : true,
+      subtree : true,
+      characterData : false
   });
-};
 
-new MutationObserver(function(mutations) {
-    mutations.forEach(function(mutation) {
-        mutation.addedNodes.forEach(function(node) {
-            checkAll(node);
-        });
-    });
-}).observe(document.body, {
-    attributes : false,
-    childList : true,
-    subtree : true,
-    characterData : false
-});
-
-var wrap = function(node, config) {
-    if (debug) {
-        console.log("decorating element " + node + node.name);
-    }
-    var configSet = elementMap.get(node);
-    if (!configSet) {
-        configSet = new Set();
-        elementMap.set(node, configSet);
-    }
-    if (configSet.has(config)) {
-        return;
-    }
-    configSet.add(config);
-    var names = Object.getOwnPropertyNames(config);
-    var keys = Object.keys(config);
-    var data = config.data;
-    names.forEach(function(name) {
-        if (name === "constructor") {
-            return;
-        }
-        if (debug) {
-            console.log("   decorating " + name);
-        }
-        if (name === "events") {
-            registerEventHandlers(node, data, config[name]);
-        }
-        if (name === "methods") {
-            handleMethods(node, config[name]);
-        }
-    });
-    keys.forEach(function(key) {
-        if (debug) {
-            console.log("   decorating " + key);
-        }
-        node[key] = config[key];
-    });
-    if (config.callbacks) {
-        if (config.callbacks.created){
-            config.callbacks.created.call(node);
-        }
-    }
-};
-
-// generic function to wrap the event handler in the case that
-// we only want it to fire for a specific child event
-var targetedEventHandler = function(fn, correctTarget, data) {
-    return function(event) {
-        if (!event.target.matches(correctTarget)) {
-            return;
-        }
-        fn.call(this, event, data);
-    };
-};
+  var wrap = function(node, config) {
+      if (debug) {
+          console.log("decorating element " + node + node.name);
+      }
+      var configSet = elementMap.get(node);
+      if (!configSet) {
+          configSet = new Set();
+          elementMap.set(node, configSet);
+      }
+      if (configSet.has(config)) {
+          return;
+      }
+      configSet.add(config);
+      var names = Object.getOwnPropertyNames(config);
+      var keys = Object.keys(config);
+      var data = config.data;
+      names.forEach(function(name) {
+          if (name === "constructor") {
+              return;
+          }
+          if (debug) {
+              console.log("   decorating " + name);
+          }
+          if (name === "events") {
+              registerEventHandlers(node, data, config[name]);
+          }
+          if (name === "methods") {
+              handleMethods(node, config[name]);
+          }
+      });
+      keys.forEach(function(key) {
+          if (debug) {
+              console.log("   decorating " + key);
+          }
+          node[key] = config[key];
+      });
+      if (config.callbacks) {
+          if (config.callbacks.created){
+              config.callbacks.created.call(node);
+          }
+      }
+  };
 
-var handleMethods = function(node, funcs) {
-    for ( var funcName in funcs) {
-        node[funcName] = funcs[funcName];
-    }
-};
+  // generic function to wrap the event handler in the case that
+  // we only want it to fire for a specific child event
+  var targetedEventHandler = function(fn, correctTarget, data) {
+      return function(event) {
+          if (!event.target.matches(correctTarget)) {
+              return;
+          }
+          fn.call(this, event, data);
+      };
+  };
+  
+  var handleMethods = function(node, funcs) {
+      for ( var funcName in funcs) {
+          node[funcName] = funcs[funcName];
+      }
+  };
 
-var registerEventHandlers = function(node, data, events) {
-    for ( var eventName in events) {
-        let possibleFunc = events[eventName];
-        let targetNode = node;
-        if (typeof possibleFunc !== "object") {
-            targetNode.addEventListener(eventName, function(event) {
-                possibleFunc.call(node, event, data);
-            });
-        } else {
-            let selector = eventName;
-            if (selector === "document") {
-                targetNode = document;
-            }
-            for ( var childEventName in possibleFunc) {
-                let func = possibleFunc[childEventName];
-                if (selector !== "document"){
-                    func = targetedEventHandler(func, selector, data);
-                }
-                targetNode.addEventListener(childEventName,
-                        function(event) {
-                            func.call(node, event, data);
-                        });
-            }
-        }
-    }
-};
+  var registerEventHandlers = function(node, data, events) {
+      for ( var eventName in events) {
+          var possibleFunc = events[eventName];
+          var targetNode = node;
+          if (typeof possibleFunc !== "object") {
+              targetNode.addEventListener(eventName, function(event) {
+                  possibleFunc.call(node, event, data);
+              });
+          } else {
+              var selector = eventName;
+              if (selector === "document") {
+                  targetNode = document;
+              }
+              for ( var childEventName in possibleFunc) {
+                  var func = possibleFunc[childEventName];
+                  if (selector !== "document"){
+                      func = targetedEventHandler(func, selector, data);
+                  }
+                  targetNode.addEventListener(childEventName,
+                          function(event) {
+                              func.call(node, event, data);
+                          });
+              }
+          }
+      }
+  };
 
-var checkAll = function(node) {
-    var checkSet = new Set();
-    checkSet.add(node);
-    checkSet.forEach(function(element){
-        if (element.querySelectorAll) {
-            check(element);
-        }
-        let elements = element.children;
-        if (elements){
-            for (let i = 0; i < elements.length; i++) {
-                checkSet.add(elements[i]);
-            }
-        }
-        checkSet.delete(element);
-    });
-}
+  var checkAll = function(node) {
+      var checkSet = new Set();
+      checkSet.add(node);
+      checkSet.forEach(function(foundElement){
+          if (foundElement.querySelectorAll) {
+              check(foundElement);
+          }
+          var foundElements = foundElement.children;
+          if (foundElements){
+              for (var i = 0; i < foundElements.length; i++) {
+                  checkSet.add(foundElements[i]);
+              }
+          }
+          checkSet["delete"](foundElement);
+      });
+  }
 
-var check = function(node) {
-    for ( var selector in tagSelectors) {
-        let found = false;
-        if (debug) {
-            console.log("checking nodes for " + selector);
-        }
-        if (node.matches(selector)) {
-            found = true;
-            wrap(node, tagSelectors[selector]);
-        }
-        if (found && debug) {
-            console.log("node found for " + selector);
-        }
-    }
-};
+  var check = function(node) {
+      for ( var selector in tagSelectors) {
+          var found = false;
+          if (debug) {
+              console.log("checking nodes for " + selector);
+          }
+          if (node.matches(selector)) {
+              found = true;
+              wrap(node, tagSelectors[selector]);
+          }
+          if (found && debug) {
+              console.log("node found for " + selector);
+          }
+      }
+  };
 
-return nomnom;
+  return nomnom;
 
 })(window.nomnom = window.nomnom || {});
\ No newline at end of file