mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-11 07:55:55 +01:00
Change Fork button to tab
This commit is contained in:
@@ -497,6 +497,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
getForkedRepositories(
|
||||
repository.repository.originUserName.getOrElse(repository.owner),
|
||||
repository.repository.originRepositoryName.getOrElse(repository.name)),
|
||||
context.loginAccount match {
|
||||
case None => List()
|
||||
case account: Option[Account] => getGroupsByUserName(account.get.userName)
|
||||
}, // groups of current user
|
||||
repository)
|
||||
})
|
||||
|
||||
@@ -507,13 +511,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||
val ref = multiParams("splat").head
|
||||
JGitUtil.getTreeId(git, ref).map{ treeId =>
|
||||
html.find(ref,
|
||||
treeId,
|
||||
repository,
|
||||
context.loginAccount match {
|
||||
case None => List()
|
||||
case account: Option[Account] => getGroupsByUserName(account.get.userName)
|
||||
})
|
||||
html.find(ref, treeId, repository)
|
||||
} getOrElse NotFound
|
||||
}
|
||||
})
|
||||
@@ -575,10 +573,6 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
|
||||
html.files(revision, repository,
|
||||
if(path == ".") Nil else path.split("/").toList, // current path
|
||||
context.loginAccount match {
|
||||
case None => List()
|
||||
case account: Option[Account] => getGroupsByUserName(account.get.userName)
|
||||
}, // groups of current user
|
||||
new JGitUtil.CommitInfo(lastModifiedCommit), // last modified commit
|
||||
files, readme, hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
||||
getPullRequestFromBranch(repository.owner, repository.name, revstr, repository.repository.defaultBranch),
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
||||
id: Option[String] = None,
|
||||
isRepoTop: Boolean = false,
|
||||
isNoGroup: Boolean = true,
|
||||
info: Option[Any] = None,
|
||||
error: Option[Any] = None)(body: Html)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@@ -24,37 +23,6 @@
|
||||
@helper.html.information(info)
|
||||
@helper.html.error(error)
|
||||
<div class="head">
|
||||
@if(repository.commitCount > 0){
|
||||
<div class="input-group pull-right">
|
||||
@*
|
||||
<span class="fork">
|
||||
<span class="input-group-btn">*@
|
||||
@if(loginAccount.isEmpty){
|
||||
<a href="@path/signin?redirect=@urlEncode(s"${path}/${repository.owner}/${repository.name}")" class="btn btn-default">
|
||||
Fork <span class="badge">@repository.forkedCount</span>
|
||||
</a>
|
||||
} else {
|
||||
@if(isNoGroup) {
|
||||
<a id="fork-link" href="javascript:void(0);" class="btn btn-default">
|
||||
Fork <span class="badge">@repository.forkedCount</span>
|
||||
</a>
|
||||
} else {
|
||||
<a href="@path/@repository.owner/@repository.name/fork" class="btn btn-default" rel="facebox">
|
||||
Fork <span class="badge">@repository.forkedCount</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
@*
|
||||
</span>
|
||||
<span class="count"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
|
||||
</span>*@
|
||||
</div>
|
||||
@if(loginAccount.isDefined && isNoGroup){
|
||||
<form id="fork-form" method="post" action="@path/@repository.owner/@repository.name/fork" style="display: none;">
|
||||
<input type="hidden" name="account" value="@loginAccount.get.userName"/>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
@helper.html.repositoryicon(repository, true)
|
||||
<a href="@url(repository.owner)">@repository.owner</a> / <a href="@url(repository)" class="strong">@repository.name</a>
|
||||
|
||||
@@ -74,6 +42,7 @@
|
||||
@if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
|
||||
@menuitem("/settings" , "settings" , "tools", "Settings")
|
||||
}
|
||||
@menuitem("/network/members", "fork", "git-branch", "Forks", repository.forkedCount)
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -113,43 +82,3 @@
|
||||
}
|
||||
@body
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$('ul.sidemenu a').mouseover(function(e){
|
||||
var target = e.target;
|
||||
if(e.target.tagName == "I"){
|
||||
target = e.target.parentElement;
|
||||
}
|
||||
$(target).prev('div.gradient').css('border-left', '1px solid silver');
|
||||
});
|
||||
|
||||
$('ul.sidemenu a').mouseout(function(e){
|
||||
var target = e.target;
|
||||
if(e.target.tagName == "I"){
|
||||
target = e.target.parentElement;
|
||||
}
|
||||
$(target).prev('div.gradient').css('border-left', '1px solid #eee');
|
||||
});
|
||||
|
||||
$('a[rel*=facebox]').facebox({
|
||||
'loadingImage': '@assets/vendors/facebox/loading.gif',
|
||||
'closeImage': '@assets/vendors/facebox/closelabel.png'
|
||||
});
|
||||
|
||||
$(document).on("click", ".js-fork-owner-select-target", function() {
|
||||
if (!$(this).hasClass("disabled")) {
|
||||
var account = $(this).text().replace("@@", "");
|
||||
$("#account").val(account);
|
||||
$("#fork").submit();
|
||||
}
|
||||
});
|
||||
|
||||
@if(loginAccount.isDefined){
|
||||
$(document).on("click", "a#fork-link", function(e) {
|
||||
e.preventDefault();
|
||||
$('#fork-form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@(branch: String,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
||||
pathList: List[String],
|
||||
groupNames: List[String],
|
||||
latestCommit: gitbucket.core.util.JGitUtil.CommitInfo,
|
||||
files: List[gitbucket.core.util.JGitUtil.FileInfo],
|
||||
readme: Option[(List[String], String)],
|
||||
@@ -22,7 +21,7 @@
|
||||
} else {
|
||||
s"${(repository.name :: pathList).mkString("/")} at ${encodeRefName(branch)} - ${repository.owner}/${repository.name}"
|
||||
}, Some(repository)) {
|
||||
@html.menu("code", repository, Some(branch), pathList.isEmpty, groupNames.isEmpty, info, error){
|
||||
@html.menu("code", repository, Some(branch), pathList.isEmpty, info, error){
|
||||
<div class="head">
|
||||
@if(pathList.isEmpty){
|
||||
<div class="pull-right pc">
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@(branch: String,
|
||||
treeId: String,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
||||
groupNames: List[String]
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||
@html.menu("code", repository, Some(branch), false, groupNames.isEmpty){
|
||||
@html.menu("code", repository, Some(branch), false){
|
||||
|
||||
<div>
|
||||
<div class="find-input">
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
@(originRepository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo],
|
||||
members: List[(String, String)],
|
||||
groupNames: List[String],
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||
@html.menu("network", repository){
|
||||
<ul class="nav nav-tabs fill-width pull-left">
|
||||
<li class="active"><a href="@url(repository)/network/members">Members</a></li>
|
||||
</ul>
|
||||
<h3>Members of the @repository.name Network</h3>
|
||||
@html.menu("fork", repository){
|
||||
<h3>
|
||||
Forked repositories
|
||||
@if(loginAccount.isEmpty){
|
||||
<a href="@path/signin?redirect=@urlEncode(s"${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="@path/@repository.owner/@repository.name/fork" class="btn btn-success" rel="facebox">Fork</a>
|
||||
}
|
||||
}
|
||||
</h3>
|
||||
@if(loginAccount.isDefined && groupNames.isEmpty){
|
||||
<form id="fork-form" method="post" action="@path/@repository.owner/@repository.name/fork" style="display: none;">
|
||||
<input type="hidden" name="account" value="@loginAccount.get.userName"/>
|
||||
</form>
|
||||
}
|
||||
<div class="block">
|
||||
@if(originRepository.isDefined){
|
||||
@avatar(originRepository.get.owner, 20)
|
||||
@@ -33,3 +47,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('a[rel*=facebox]').facebox({
|
||||
'loadingImage': '@assets/vendors/facebox/loading.gif',
|
||||
'closeImage': '@assets/vendors/facebox/closelabel.png'
|
||||
});
|
||||
|
||||
$(document).on("click", ".js-fork-owner-select-target", function() {
|
||||
if (!$(this).hasClass("disabled")) {
|
||||
var account = $(this).text().replace("@@", "");
|
||||
$("#account").val(account);
|
||||
$("#fork").submit();
|
||||
}
|
||||
});
|
||||
|
||||
@if(loginAccount.isDefined){
|
||||
$(document).on("click", "a#fork-link", function(e) {
|
||||
e.preventDefault();
|
||||
$('#fork-form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user