diff options
author | Unknwon <u@gogs.io> | 2016-02-01 15:58:01 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-01 15:58:01 -0500 |
commit | 66d2ba1b4e0427f448190272677efdbaca2ecaae (patch) | |
tree | a9f7d49a57d86472ce2f1a0fc0c6b8b4b26779d2 | |
parent | 857b3404986eff2881cec75748db8d45707f64b8 (diff) | |
parent | 84749736a81ea768e30aaa312d729c165dc1017d (diff) | |
download | gitea-66d2ba1b4e0427f448190272677efdbaca2ecaae.tar.gz gitea-66d2ba1b4e0427f448190272677efdbaca2ecaae.zip |
Merge pull request #2537 from fnkr/remember-clone-protocol
Remember last selected clone protocol
-rw-r--r-- | public/js/gogs.js | 16 | ||||
-rw-r--r-- | templates/repo/bare.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/wiki/view.tmpl | 10 |
4 files changed, 27 insertions, 11 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index 6c00d27764..71f4859c3c 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -437,12 +437,14 @@ function initRepository() { $('#repo-clone-url').val($(this).data('link')); $(this).addClass('blue'); $('#repo-clone-https').removeClass('blue'); + localStorage.setItem('repo-clone-protocol', 'ssh'); }); $('#repo-clone-https').click(function () { $('.clone-url').text($(this).data('link')); $('#repo-clone-url').val($(this).data('link')); $(this).addClass('blue'); $('#repo-clone-ssh').removeClass('blue'); + localStorage.setItem('repo-clone-protocol', 'https'); }); $('#repo-clone-url').click(function () { $(this).select(); @@ -1038,4 +1040,18 @@ $(window).load(function () { } }).trigger('hashchange'); } + + // Repo clone url. + if ($('#repo-clone-url').length > 0) { + switch (localStorage.getItem('repo-clone-protocol')) { + case 'ssh': + if ($('#repo-clone-ssh').click().length === 0) { + $('#repo-clone-https').click(); + }; + break; + default: + $('#repo-clone-https').click(); + break; + } + } }); diff --git a/templates/repo/bare.tmpl b/templates/repo/bare.tmpl index 936ed859a6..63baea16ac 100644 --- a/templates/repo/bare.tmpl +++ b/templates/repo/bare.tmpl @@ -16,15 +16,15 @@ <div class="item"> <h3>{{.i18n.Tr "repo.clone_this_repo"}} <small>{{.i18n.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}</small></h3> <div class="ui action small input"> + <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> + {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} + </button> {{if not $.DisableSSH}} - <button class="ui blue basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}"> + <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}"> SSH </button> {{end}} - <button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> - {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} - </button> - <input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly> + <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly> <button class="ui basic button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> <i class="octicon octicon-clippy"></i> </button> diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 2e5c7e0841..208b3ad3f4 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -35,7 +35,7 @@ {{if eq $n 0}} <div class="right fitted item"> <div class="ui action small input" id="clone-panel"> - <button class="ui blue basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> + <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} </button> {{if not $.DisableSSH}} diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index 050c34b0a9..c1b6c6f72d 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -29,15 +29,15 @@ </div> <div class="ui six wide column"> <div class="ui action small input" id="clone-panel"> + <button class="ui basic clone button" id="repo-clone-https" data-link="{{.WikiCloneLink.HTTPS}}"> + {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} + </button> {{if not $.DisableSSH}} - <button class="ui blue basic clone button" id="repo-clone-ssh" data-link="{{.WikiCloneLink.SSH}}"> + <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.WikiCloneLink.SSH}}"> SSH </button> {{end}} - <button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.WikiCloneLink.HTTPS}}"> - {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} - </button> - <input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.WikiCloneLink.HTTPS}}{{else}}{{$.WikiCloneLink.SSH}}{{end}}" readonly> + <input id="repo-clone-url" value="{{$.WikiCloneLink.HTTPS}}" readonly> <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> <i class="octicon octicon-clippy"></i> </button> |