Remember last selected clone protocol, and establish uniform order (https, ssh)
This commit is contained in:
parent
5d192c2ebf
commit
d568019306
4 changed files with 25 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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>
|
||||
|
|
Reference in a new issue