mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Add a button to show forked repos to the fork account select dialog
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
||||
groupAndPerm: Seq[(String, Boolean)])(implicit context: gitbucket.core.controller.Context)
|
||||
@import gitbucket.core.view.helpers
|
||||
<h2 class="facebox-header">Where should we fork this repository?</h2>
|
||||
<h2 class="facebox-header">
|
||||
Where should we fork this repository?
|
||||
<a class="btn btn-default btn-sm" href="@helpers.url(repository)/network/members">Show forks</a>
|
||||
</h2>
|
||||
<form action="@helpers.url(repository)/fork" id="fork" method="post">
|
||||
<div class="content">
|
||||
<div class="block">
|
||||
@helpers.avatar(context.loginAccount.get.userName, 24) <a href="javascript:void(0);" class="js-fork-owner-select-target">@@@context.loginAccount.get.userName</a>
|
||||
</div>
|
||||
@for((groupName, isManager) <- groupAndPerm) {
|
||||
@if(isManager) {
|
||||
<div class="block js-fork-owner-select-target">
|
||||
@helpers.avatar(groupName, 24) <a href="javascript:void(0);" class="js-fork-owner-select-target">@@@groupName</a>
|
||||
</div>
|
||||
} else {
|
||||
<div class="block" title="You don't have permission to fork here.">
|
||||
@helpers.avatar(groupName, 24) <span class="muted">@@@groupName</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<div class="block">
|
||||
@helpers.avatar(context.loginAccount.get.userName, 24) <a href="javascript:void(0);" class="js-fork-owner-select-target">@@@context.loginAccount.get.userName</a>
|
||||
</div>
|
||||
@for((groupName, isManager) <- groupAndPerm) {
|
||||
@if(isManager) {
|
||||
<div class="block js-fork-owner-select-target">
|
||||
@helpers.avatar(groupName, 24) <a href="javascript:void(0);" class="js-fork-owner-select-target">@@@groupName</a>
|
||||
</div>
|
||||
} else {
|
||||
<div class="block" title="You don't have permission to fork here.">
|
||||
@helpers.avatar(groupName, 24) <span class="muted">@@@groupName</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<input id="account" name="account" type="hidden" />
|
||||
</form>
|
||||
|
||||
@@ -76,10 +76,19 @@
|
||||
@repositoryHeaderComponent(repository, context)
|
||||
}
|
||||
@if(repository.repository.options.allowFork) {
|
||||
<a class="btn btn-default btn-sm" href="@helpers.url(repository)/network/members">
|
||||
<span class="strong"><i class="octicon octicon-repo-forked"></i>Fork</span><span class="muted">: @repository.forkedCount</span>
|
||||
</a>
|
||||
@if(context.loginAccount.isEmpty){
|
||||
<a class="btn btn-default btn-sm" href="@context.path/signin?redirect=@helpers.urlEncode(s"${context.path}/${repository.owner}/${repository.name}")">
|
||||
<span class="strong"><i class="octicon octicon-repo-forked"></i>Fork</span><span class="muted">: @repository.forkedCount</span>
|
||||
</a>
|
||||
} else {
|
||||
<a class="btn btn-default btn-sm" href="@context.path/@repository.owner/@repository.name/fork" rel="facebox">
|
||||
<span class="strong"><i class="octicon octicon-repo-forked"></i>Fork</span><span class="muted">: @repository.forkedCount</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
<form id="fork-form" method="post" action="@context.path/@repository.owner/@repository.name/fork" style="display: none;">
|
||||
<input type="hidden" name="account" value="@context.loginAccount.get.userName"/>
|
||||
</form>
|
||||
</div>
|
||||
@gitbucket.core.helper.html.repositoryicon(repository, true)
|
||||
<a href="@helpers.url(repository.owner)">@repository.owner</a> / <a href="@helpers.url(repository)" class="strong">@repository.name</a>
|
||||
@@ -97,4 +106,19 @@
|
||||
@body
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$('a[rel*=facebox]').facebox({
|
||||
'loadingImage': '@helpers.assets("/vendors/facebox/loading.gif")',
|
||||
'closeImage': '@helpers.assets("/vendors/facebox/closelabel.png")'
|
||||
});
|
||||
|
||||
$(document).on("click", ".js-fork-owner-select-target", function() {
|
||||
var account = $(this).text().replace("@@", "");
|
||||
$("#account").val(account);
|
||||
$("#fork").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -5,23 +5,7 @@
|
||||
@import gitbucket.core.view.helpers
|
||||
@gitbucket.core.html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||
@gitbucket.core.html.menu("fork", repository){
|
||||
<h1 class="body-title">
|
||||
Forked repositories
|
||||
@if(context.loginAccount.isEmpty){
|
||||
<a href="@context.path/signin?redirect=@helpers.urlEncode(s"${context.path}/${repository.owner}/${repository.name}")" class="btn btn-success">Fork</a>
|
||||
} else {
|
||||
@if(groupNames.isEmpty) {
|
||||
<a id="fork-link" href="javascript:void(0);" class="btn btn-success">Fork</a>
|
||||
} else {
|
||||
<a href="@context.path/@repository.owner/@repository.name/fork" class="btn btn-success" rel="facebox">Fork</a>
|
||||
}
|
||||
}
|
||||
</h1>
|
||||
@if(context.loginAccount.isDefined && groupNames.isEmpty){
|
||||
<form id="fork-form" method="post" action="@context.path/@repository.owner/@repository.name/fork" style="display: none;">
|
||||
<input type="hidden" name="account" value="@context.loginAccount.get.userName"/>
|
||||
</form>
|
||||
}
|
||||
<h1 class="body-title">Forked repositories</h1>
|
||||
<div class="block">
|
||||
@if(originRepository.isDefined){
|
||||
@helpers.avatarLink(originRepository.get.owner, 20)
|
||||
@@ -46,24 +30,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('a[rel*=facebox]').facebox({
|
||||
'loadingImage': '@helpers.assets("/vendors/facebox/loading.gif")',
|
||||
'closeImage': '@helpers.assets("/vendors/facebox/closelabel.png")'
|
||||
});
|
||||
|
||||
$(document).on("click", ".js-fork-owner-select-target", function() {
|
||||
var account = $(this).text().replace("@@", "");
|
||||
$("#account").val(account);
|
||||
$("#fork").submit();
|
||||
});
|
||||
|
||||
@if(context.loginAccount.isDefined){
|
||||
$(document).on("click", "a#fork-link", function(e) {
|
||||
e.preventDefault();
|
||||
$('#fork-form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user