mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-29 21:59:13 +01:00
Merge pull request #2537 from fnkr/remember-clone-protocol
Remember last selected clone protocol
This commit is contained in:
commit
66d2ba1b4e
4 changed files with 27 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue