vendor/ui/js/src/components/clone-url-selection.js in dolt-0.23.0 vs vendor/ui/js/src/components/clone-url-selection.js in dolt-0.24.0

- old
+ new

@@ -2,24 +2,34 @@ this.gts = this.gts || {}; /** * When clicking clone URLs, copy them to the related input field. */ -this.gts.cloneUrlSelection = function cloneUrlSelection(element) { - var input = element.getElementsByTagName("input")[0]; - - if (input) { - dome.on(input, "focus", function (e) { this.select(); }); - } - - dome.delegate.bycn("gts-repo-url", element, "click", function (e) { - e.preventDefault(); +this.gts.cloneUrlSelection = (function () { + function selectCloneUrl(element, selected) { var links = dome.byClass("gts-repo-url", element); cull.doall(cull.partial(dome.cn.rm, "active"), links); - if (e.target) { - dome.cn.add("active", e.target); - var input = dome.byClass("gts-current-repo-url")[0]; - input.value = e.target.href; + if (selected) { + dome.cn.add("active", selected); + var input = dome.byClass("gts-current-repo-url", element)[0]; + input.value = selected.getAttribute("href").replace("ssh://", ""); input.focus(); } - }); -}; + } + + function cloneUrlSelection(element) { + var input = element.getElementsByTagName("input")[0]; + + if (input) { + dome.on(input, "focus", function (e) { this.select(); }); + } + + dome.delegate.bycn("gts-repo-url", element, "click", function (e) { + e.preventDefault(); + e.stopPropagation(); + selectCloneUrl(element, e.target); + }); + } + + cloneUrlSelection.select = selectCloneUrl; + return cloneUrlSelection; +}());