diff options
-rw-r--r-- | public/js/gogs.js | 14 | ||||
-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, 25 insertions, 11 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index f979df0762..df48c7dbe9 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -434,12 +434,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(); @@ -1035,4 +1037,16 @@ $(window).load(function () { } }).trigger('hashchange'); } + + // Repo clone url. + if ($('#repo-clone-url').length > 0) { + switch (localStorage.getItem('repo-clone-protocol')) { + case 'ssh': + $('#repo-clone-ssh').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> |