diff options
author | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-14 16:49:06 +0200 |
---|---|---|
committer | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-14 16:49:06 +0200 |
commit | fc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb (patch) | |
tree | f1c2af072fb0c80ea031188f53cdf2c9f23efbf4 /client/lib/utils.js | |
parent | e649c79bb71140a15f8e65fdb98ecb367469c0b7 (diff) | |
download | wekan-fc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb.tar.gz wekan-fc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb.tar.bz2 wekan-fc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb.zip |
Refactoring rules description
Diffstat (limited to 'client/lib/utils.js')
-rw-r--r-- | client/lib/utils.js | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/client/lib/utils.js b/client/lib/utils.js index 6b8e3524..1b5ad1f3 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -40,14 +40,14 @@ Utils = { base = 0; increment = 1; // If we drop the card in the first position - } else if (!prevData) { - base = nextData.sort - 1; - increment = -1; + } else if (!prevData) { + base = nextData.sort - 1; + increment = -1; // If we drop the card in the last position - } else if (!nextData) { - base = prevData.sort + 1; - increment = 1; - } + } else if (!nextData) { + base = prevData.sort + 1; + increment = 1; + } // In the general case take the average of the previous and next element // sort indexes. else { @@ -72,14 +72,14 @@ Utils = { base = 0; increment = 1; // If we drop the card in the first position - } else if (!prevCardDomElement) { - base = Blaze.getData(nextCardDomElement).sort - 1; - increment = -1; + } else if (!prevCardDomElement) { + base = Blaze.getData(nextCardDomElement).sort - 1; + increment = -1; // If we drop the card in the last position - } else if (!nextCardDomElement) { - base = Blaze.getData(prevCardDomElement).sort + 1; - increment = 1; - } + } else if (!nextCardDomElement) { + base = Blaze.getData(prevCardDomElement).sort + 1; + increment = 1; + } // In the general case take the average of the previous and next element // sort indexes. else { @@ -121,7 +121,7 @@ Utils = { return Math.sqrt( Math.pow(touchA.screenX - touchB.screenX, 2) + Math.pow(touchA.screenY - touchB.screenY, 2) - ); + ); }, enableClickOnTouch(selector) { @@ -144,6 +144,27 @@ Utils = { } }); }, + + getTriggerActionDesc(event,tempInstance){ + const jqueryEl = tempInstance.$(event.currentTarget.parentNode); + const triggerEls = jqueryEl.find(".trigger-content").children(); + let finalString = ""; + for(let i = 0;i< triggerEls.length;i++){ + const element = tempInstance.$(triggerEls[i]); + if(element.hasClass("trigger-text")){ + finalString += element.text(); + }else if(element.find("select").length > 0){ + finalString += element.find("select option:selected").text(); + }else if(element.find("input").length > 0){ + finalString += element.find("input").val(); + } + // Add space + if(i != length - 1){ + finalString += " "; + } + } + return finalString.toLowerCase(); + }, }; // A simple tracker dependency that we invalidate every time the window is |