mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 06:55:54 +01:00
Skip the group popup when user has no group
This commit is contained in:
@@ -436,6 +436,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
repo.html.files(revision, repository,
|
repo.html.files(revision, repository,
|
||||||
if(path == ".") Nil else path.split("/").toList, // current path
|
if(path == ".") Nil else path.split("/").toList, // current path
|
||||||
|
context.loginAccount match {
|
||||||
|
case None => List()
|
||||||
|
case account: Option[model.Account] => getGroupsByUserName(account.get.userName)
|
||||||
|
}, // groups of current user
|
||||||
new JGitUtil.CommitInfo(lastModifiedCommit), // last modified commit
|
new JGitUtil.CommitInfo(lastModifiedCommit), // last modified commit
|
||||||
files, readme, hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
files, readme, hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
||||||
flash.get("info"), flash.get("error"))
|
flash.get("info"), flash.get("error"))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
id: Option[String] = None,
|
id: Option[String] = None,
|
||||||
expand: Boolean = false,
|
expand: Boolean = false,
|
||||||
|
isNoGroup: Boolean = true,
|
||||||
info: Option[Any] = None,
|
info: Option[Any] = None,
|
||||||
error: Option[Any] = None)(body: Html)(implicit context: app.Context)
|
error: Option[Any] = None)(body: Html)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@@ -41,7 +42,11 @@
|
|||||||
@if(loginAccount.isEmpty){
|
@if(loginAccount.isEmpty){
|
||||||
<a title="You must be signed in to fork a repository" href="@path/signin" class="btn btn-small" style="margin-bottom: 10px;">Fork</a>
|
<a title="You must be signed in to fork a repository" href="@path/signin" class="btn btn-small" style="margin-bottom: 10px;">Fork</a>
|
||||||
} else {
|
} else {
|
||||||
<a href="@path/@repository.owner/@repository.name/fork" class="btn btn-small" rel="facebox" style="margin-bottom: 10px;">Fork</a>
|
@if(isNoGroup) {
|
||||||
|
<a href="@path/@repository.owner/@repository.name/fork" class="btn btn-small" style="margin-bottom: 10px;" data-account="@loginAccount.get.userName">Fork</a>
|
||||||
|
} else {
|
||||||
|
<a href="@path/@repository.owner/@repository.name/fork" class="btn btn-small" rel="facebox" style="margin-bottom: 10px;">Fork</a>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<span class="add-on count"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
|
<span class="add-on count"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,6 +194,23 @@ $(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@if(loginAccount.isDefined){
|
||||||
|
$(document).on("click", "a[data-account]", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var form = $('<form/>', {
|
||||||
|
action: $(this).attr('href'),
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
|
var account = $('<input/>', {
|
||||||
|
type: "hidden",
|
||||||
|
name: "account",
|
||||||
|
value: $(this).data('account')
|
||||||
|
});
|
||||||
|
form.append(account);
|
||||||
|
form.submit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@if(settings.ssh && loginAccount.isDefined){
|
@if(settings.ssh && loginAccount.isDefined){
|
||||||
$('#repository-url-http').click(function(){
|
$('#repository-url-http').click(function(){
|
||||||
$('#repository-url-proto').text('HTTP');
|
$('#repository-url-proto').text('HTTP');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
@(branch: String,
|
@(branch: String,
|
||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
|
groupNames: List[String],
|
||||||
latestCommit: util.JGitUtil.CommitInfo,
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
files: List[util.JGitUtil.FileInfo],
|
files: List[util.JGitUtil.FileInfo],
|
||||||
readme: Option[(List[String], String)],
|
readme: Option[(List[String], String)],
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
@html.menu("code", repository, Some(branch), pathList.isEmpty, info, error){
|
@html.menu("code", repository, Some(branch), pathList.isEmpty, groupNames.isEmpty, info, error){
|
||||||
<div class="head">
|
<div class="head">
|
||||||
@helper.html.branchcontrol(
|
@helper.html.branchcontrol(
|
||||||
branch,
|
branch,
|
||||||
|
|||||||
Reference in New Issue
Block a user