Sha256: c4d0dfa6f7050ca887972820255e9964a623fe7f7fdbfb5cf2f56039008f817e

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

/*global cull, dome*/
this.gts = this.gts || {};

/**
 * When clicking clone URLs, copy them to the related input field.
 */
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 (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;
}());

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dolt-0.29.0 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.28.1 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.28.0 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.27.0 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.26.0 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.25.0 vendor/ui/js/src/components/clone-url-selection.js
dolt-0.24.0 vendor/ui/js/src/components/clone-url-selection.js