mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
(refs #115)Add url switcher to the repository url box
This commit is contained in:
@@ -65,7 +65,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
repo.html.commits(if(path.isEmpty) Nil else path.split("/").toList, branchName, repository,
|
repo.html.commits(if(path.isEmpty) Nil else path.split("/").toList, branchName, repository,
|
||||||
logs.splitWith{ (commit1, commit2) =>
|
logs.splitWith{ (commit1, commit2) =>
|
||||||
view.helpers.date(commit1.time) == view.helpers.date(commit2.time)
|
view.helpers.date(commit1.time) == view.helpers.date(commit2.time)
|
||||||
}, page, hasNext)
|
}, page, hasNext, loadSystemSettings())
|
||||||
case Left(_) => NotFound
|
case Left(_) => NotFound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
JGitUtil.ContentInfo(viewer, None)
|
JGitUtil.ContentInfo(viewer, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.html.blob(id, repository, path.split("/").toList, content, new JGitUtil.CommitInfo(revCommit))
|
repo.html.blob(id, repository, path.split("/").toList, content, new JGitUtil.CommitInfo(revCommit), loadSystemSettings())
|
||||||
}
|
}
|
||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
repo.html.commit(id, new JGitUtil.CommitInfo(revCommit),
|
repo.html.commit(id, new JGitUtil.CommitInfo(revCommit),
|
||||||
JGitUtil.getBranchesOfCommit(git, revCommit.getName),
|
JGitUtil.getBranchesOfCommit(git, revCommit.getName),
|
||||||
JGitUtil.getTagsOfCommit(git, revCommit.getName),
|
JGitUtil.getTagsOfCommit(git, revCommit.getName),
|
||||||
repository, diffs, oldCommitId)
|
repository, diffs, oldCommitId, loadSystemSettings())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,8 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
val revCommit = git.log.add(git.getRepository.resolve(branchName)).setMaxCount(1).call.iterator.next
|
val revCommit = git.log.add(git.getRepository.resolve(branchName)).setMaxCount(1).call.iterator.next
|
||||||
(branchName, revCommit.getCommitterIdent.getWhen)
|
(branchName, revCommit.getCommitterIdent.getWhen)
|
||||||
}
|
}
|
||||||
repo.html.branches(branchInfo, hasWritePermission(repository.owner, repository.name, context.loginAccount), repository)
|
repo.html.branches(branchInfo, hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
||||||
|
repository, loadSystemSettings())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -175,7 +176,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
* Displays tags.
|
* Displays tags.
|
||||||
*/
|
*/
|
||||||
get("/:owner/:repository/tags")(referrersOnly {
|
get("/:owner/:repository/tags")(referrersOnly {
|
||||||
repo.html.tags(_)
|
repo.html.tags(_, loadSystemSettings())
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +285,7 @@ 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
|
||||||
new JGitUtil.CommitInfo(revCommit), // latest commit
|
new JGitUtil.CommitInfo(revCommit), // latest commit
|
||||||
files, readme)
|
files, readme, loadSystemSettings())
|
||||||
}
|
}
|
||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<a href="@path/@repository.owner/@repository.name/fork" class="btn" style="margin-bottom: 10px;">Fork</a>
|
<a href="@path/@repository.owner/@repository.name/fork" class="btn" style="margin-bottom: 10px;">Fork</a>
|
||||||
<span class="add-on"><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>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@(id: String, value: String)(html: Html)
|
@(id: String, value: String, prepend: Boolean = false)(html: Html)
|
||||||
<div class="input-append">
|
<div class="input-append@if(prepend){ input-prepend}">
|
||||||
@html
|
@html
|
||||||
<span id="@id" class="add-on btn" data-clipboard-text="@value" data-placement="bottom" title="copy to clipboard"><i class="icon-check"></i></span>
|
<span id="@id" class="add-on btn" data-clipboard-text="@value" data-placement="bottom" title="copy to clipboard"><i class="icon-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
content: util.JGitUtil.ContentInfo,
|
content: util.JGitUtil.ContentInfo,
|
||||||
latestCommit: util.JGitUtil.CommitInfo)(implicit context: app.Context)
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@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.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(branch, repository, "files")
|
@tab(branch, repository, "files", settings)
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
|
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
|
||||||
@pathList.zipWithIndex.map { case (section, i) =>
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
@(branchInfo: Seq[(String, java.util.Date)],
|
@(branchInfo: Seq[(String, java.util.Date)],
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@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.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(repository.repository.defaultBranch, repository, "branches", true)
|
@tab(repository.repository.defaultBranch, repository, "branches", settings, true)
|
||||||
<h1>Branches</h1>
|
<h1>Branches</h1>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -4,13 +4,14 @@
|
|||||||
tags: List[String],
|
tags: List[String],
|
||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
diffs: Seq[util.JGitUtil.DiffInfo],
|
diffs: Seq[util.JGitUtil.DiffInfo],
|
||||||
oldCommitId: Option[String])(implicit context: app.Context)
|
oldCommitId: Option[String],
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@import util.Implicits._
|
@import util.Implicits._
|
||||||
@html.main(commit.shortMessage, Some(repository)){
|
@html.main(commit.shortMessage, Some(repository)){
|
||||||
@html.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(commitId, repository, "commits")
|
@tab(commitId, repository, "commits", settings)
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
commits: Seq[Seq[util.JGitUtil.CommitInfo]],
|
commits: Seq[Seq[util.JGitUtil.CommitInfo]],
|
||||||
page: Int,
|
page: Int,
|
||||||
hasNext: Boolean)(implicit context: app.Context)
|
hasNext: Boolean,
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@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.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(branch, repository, if(pathList.isEmpty) "commits" else "files")
|
@tab(branch, repository, if(pathList.isEmpty) "commits" else "files", settings)
|
||||||
<div class="head">
|
<div class="head">
|
||||||
@if(pathList.isEmpty){
|
@if(pathList.isEmpty){
|
||||||
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> / Commit History
|
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> / Commit History
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
latestCommit: util.JGitUtil.CommitInfo,
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
files: List[util.JGitUtil.FileInfo],
|
files: List[util.JGitUtil.FileInfo],
|
||||||
readme: Option[(util.JGitUtil.FileInfo, String)])(implicit context: app.Context)
|
readme: Option[(util.JGitUtil.FileInfo, String)],
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@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.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(branch, repository, "files")
|
@tab(branch, repository, "files", settings)
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@defining(repository.commitCount){ commitCount =>
|
@defining(repository.commitCount){ commitCount =>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@(id: String, repository: service.RepositoryService.RepositoryInfo, active: String,
|
@(id: String, repository: service.RepositoryService.RepositoryInfo, active: String,
|
||||||
|
settings: service.SystemSettingsService.SystemSettings,
|
||||||
hideBranchPulldown: Boolean = false)(implicit context: app.Context)
|
hideBranchPulldown: Boolean = false)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@@ -22,8 +23,15 @@
|
|||||||
<li@if(active=="branches"){ class="active"}><a href="@url(repository)/branches">Branches@if(repository.branchList.length > 0){ <span class="badge">@repository.branchList.length</span>}</a></li>
|
<li@if(active=="branches"){ class="active"}><a href="@url(repository)/branches">Branches@if(repository.branchList.length > 0){ <span class="badge">@repository.branchList.length</span>}</a></li>
|
||||||
<li@if(active=="tags" ){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
<li@if(active=="tags" ){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
@helper.html.copy("repository-url-copy", repository.url){
|
@helper.html.copy("repository-url-copy", repository.url, true){
|
||||||
<input type="text" value="@repository.url" id="repository-url" readonly>
|
@if(settings.ssh){
|
||||||
|
<div class="btn-group add-on" data-toggle="buttons-radio" style="padding: 0px; border-width: 0px;">
|
||||||
|
<button type="button" class="btn active" id="repository-url-http">HTTP</button><button type="button" class="btn" id="repository-url-ssh">SSH</button>
|
||||||
|
</div>
|
||||||
|
} else {
|
||||||
|
<span class="add-on">HTTP</span>
|
||||||
|
}
|
||||||
|
<input type="text" value="@repository.url" id="repository-url" style="width: 150px;" readonly>
|
||||||
}
|
}
|
||||||
</li>
|
</li>
|
||||||
<li class="pull-right" style="margin-right: 8px;">
|
<li class="pull-right" style="margin-right: 8px;">
|
||||||
@@ -32,3 +40,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@if(settings.ssh){
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#repository-url-http').click(function(){
|
||||||
|
$('#repository-url').val('@repository.url');
|
||||||
|
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
||||||
|
});
|
||||||
|
$('#repository-url-ssh').click(function(){
|
||||||
|
// TODO How should I make a url for ssh access?
|
||||||
|
$('#repository-url').val('ssh://localhost:29418/@repository.owner/@repository.name');
|
||||||
|
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
@(repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
@(repository: service.RepositoryService.RepositoryInfo,
|
||||||
|
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||||
@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.header("code", repository)
|
@html.header("code", repository)
|
||||||
@tab(repository.repository.defaultBranch, repository, "tags", true)
|
@tab(repository.repository.defaultBranch, repository, "tags", settings, true)
|
||||||
<h1>Tags</h1>
|
<h1>Tags</h1>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -80,19 +80,13 @@ table.global-nav th a:link, table.global-nav th a:hover, table.global-nav th a:v
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.input-prepend span.add-on {
|
div.input-prepend span.count {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
-webkit-border-radius: 0 4px 4px 0;
|
-webkit-border-radius: 0 4px 4px 0;
|
||||||
-moz-border-radius: 0 4px 4px 0;
|
-moz-border-radius: 0 4px 4px 0;
|
||||||
border-radius: 0 4px 4px 0;
|
border-radius: 0 4px 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
div.input-prepend span.add-on a {
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
/* General Styles */
|
/* General Styles */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|||||||
Reference in New Issue
Block a user