mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 07:43:18 -05:00
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'));
|
$('#repo-clone-url').val($(this).data('link'));
|
||||||
$(this).addClass('blue');
|
$(this).addClass('blue');
|
||||||
$('#repo-clone-https').removeClass('blue');
|
$('#repo-clone-https').removeClass('blue');
|
||||||
|
localStorage.setItem('repo-clone-protocol', 'ssh');
|
||||||
});
|
});
|
||||||
$('#repo-clone-https').click(function () {
|
$('#repo-clone-https').click(function () {
|
||||||
$('.clone-url').text($(this).data('link'));
|
$('.clone-url').text($(this).data('link'));
|
||||||
$('#repo-clone-url').val($(this).data('link'));
|
$('#repo-clone-url').val($(this).data('link'));
|
||||||
$(this).addClass('blue');
|
$(this).addClass('blue');
|
||||||
$('#repo-clone-ssh').removeClass('blue');
|
$('#repo-clone-ssh').removeClass('blue');
|
||||||
|
localStorage.setItem('repo-clone-protocol', 'https');
|
||||||
});
|
});
|
||||||
$('#repo-clone-url').click(function () {
|
$('#repo-clone-url').click(function () {
|
||||||
$(this).select();
|
$(this).select();
|
||||||
|
@ -1035,4 +1037,16 @@ $(window).load(function () {
|
||||||
}
|
}
|
||||||
}).trigger('hashchange');
|
}).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">
|
<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>
|
<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">
|
<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}}
|
{{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
|
SSH
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
<button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
|
<input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
|
||||||
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
|
|
||||||
</button>
|
|
||||||
<input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" 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">
|
<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>
|
<i class="octicon octicon-clippy"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
{{if eq $n 0}}
|
{{if eq $n 0}}
|
||||||
<div class="right fitted item">
|
<div class="right fitted item">
|
||||||
<div class="ui action small input" id="clone-panel">
|
<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}}
|
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
|
||||||
</button>
|
</button>
|
||||||
{{if not $.DisableSSH}}
|
{{if not $.DisableSSH}}
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ui six wide column">
|
<div class="ui six wide column">
|
||||||
<div class="ui action small input" id="clone-panel">
|
<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}}
|
{{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
|
SSH
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
<button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.WikiCloneLink.HTTPS}}">
|
<input id="repo-clone-url" value="{{$.WikiCloneLink.HTTPS}}" readonly>
|
||||||
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
|
|
||||||
</button>
|
|
||||||
<input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.WikiCloneLink.HTTPS}}{{else}}{{$.WikiCloneLink.SSH}}{{end}}" 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">
|
<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>
|
<i class="octicon octicon-clippy"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue