mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-13 08:55:50 +01:00
Merged branch master into master
This commit is contained in:
@@ -133,9 +133,12 @@ trait ApiControllerBase extends ControllerBase {
|
|||||||
val largeFile = params.get("large_file").exists(s => s.equals("true"))
|
val largeFile = params.get("large_file").exists(s => s.equals("true"))
|
||||||
val content = getContentFromId(git, f.id, largeFile)
|
val content = getContentFromId(git, f.id, largeFile)
|
||||||
request.getHeader("Accept") match {
|
request.getHeader("Accept") match {
|
||||||
case "application/vnd.github.v3.raw" =>
|
case "application/vnd.github.v3.raw" => {
|
||||||
|
contentType = "application/vnd.github.v3.raw"
|
||||||
content
|
content
|
||||||
case "application/vnd.github.v3.html" if isRenderable(f.name) =>
|
}
|
||||||
|
case "application/vnd.github.v3.html" if isRenderable(f.name) => {
|
||||||
|
contentType = "application/vnd.github.v3.html"
|
||||||
content.map(c =>
|
content.map(c =>
|
||||||
List(
|
List(
|
||||||
"<div data-path=\"", path, "\" id=\"file\">", "<article>",
|
"<div data-path=\"", path, "\" id=\"file\">", "<article>",
|
||||||
@@ -143,7 +146,9 @@ trait ApiControllerBase extends ControllerBase {
|
|||||||
"</article>", "</div>"
|
"</article>", "</div>"
|
||||||
).mkString
|
).mkString
|
||||||
)
|
)
|
||||||
case "application/vnd.github.v3.html" =>
|
}
|
||||||
|
case "application/vnd.github.v3.html" => {
|
||||||
|
contentType = "application/vnd.github.v3.html"
|
||||||
content.map(c =>
|
content.map(c =>
|
||||||
List(
|
List(
|
||||||
"<div data-path=\"", path, "\" id=\"file\">", "<div class=\"plain\">", "<pre>",
|
"<div data-path=\"", path, "\" id=\"file\">", "<div class=\"plain\">", "<pre>",
|
||||||
@@ -151,6 +156,7 @@ trait ApiControllerBase extends ControllerBase {
|
|||||||
"</pre>", "</div>", "</div>"
|
"</pre>", "</div>", "</div>"
|
||||||
).mkString
|
).mkString
|
||||||
)
|
)
|
||||||
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
Some(JsonFormat(ApiContents(f, content)))
|
Some(JsonFormat(ApiContents(f, content)))
|
||||||
}
|
}
|
||||||
@@ -277,6 +283,19 @@ trait ApiControllerBase extends ControllerBase {
|
|||||||
org.scalatra.NotFound(ApiError("Rate limiting is not enabled."))
|
org.scalatra.NotFound(ApiError("Rate limiting is not enabled."))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://developer.github.com/v3/issues/#get-a-single-issue
|
||||||
|
*/
|
||||||
|
get("/api/v3/repos/:owner/:repository/issues/:id")(referrersOnly { repository =>
|
||||||
|
(for{
|
||||||
|
issueId <- params("id").toIntOpt
|
||||||
|
issue <- getIssue(repository.owner, repository.name, issueId.toString)
|
||||||
|
openedUser <- getAccountByUserName(issue.openedUserName)
|
||||||
|
} yield {
|
||||||
|
JsonFormat(ApiIssue(issue, RepositoryName(repository), ApiUser(openedUser)))
|
||||||
|
}) getOrElse NotFound()
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
* https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
},
|
},
|
||||||
filter,
|
filter,
|
||||||
getGroupNames(userName),
|
getGroupNames(userName),
|
||||||
getVisibleRepositories(context.loginAccount, withoutPhysicalInfo = true),
|
Nil,
|
||||||
getUserRepositories(userName, withoutPhysicalInfo = true))
|
getUserRepositories(userName, withoutPhysicalInfo = true))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
},
|
},
|
||||||
filter,
|
filter,
|
||||||
getGroupNames(userName),
|
getGroupNames(userName),
|
||||||
getVisibleRepositories(context.loginAccount, withoutPhysicalInfo = true),
|
Nil,
|
||||||
getUserRepositories(userName, withoutPhysicalInfo = true))
|
getUserRepositories(userName, withoutPhysicalInfo = true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,14 +130,9 @@ trait IndexControllerBase extends ControllerBase {
|
|||||||
} getOrElse ""
|
} getOrElse ""
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO Move to RepositoryViwerController?
|
|
||||||
post("/search", searchForm){ form =>
|
|
||||||
redirect(s"/${form.owner}/${form.repository}/search?q=${StringUtil.urlEncode(form.query)}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Move to RepositoryViwerController?
|
// TODO Move to RepositoryViwerController?
|
||||||
get("/:owner/:repository/search")(referrersOnly { repository =>
|
get("/:owner/:repository/search")(referrersOnly { repository =>
|
||||||
defining(params("q").trim, params.getOrElse("type", "code")){ case (query, target) =>
|
defining(params.getOrElse("q", "").trim, params.getOrElse("type", "code")){ case (query, target) =>
|
||||||
val page = try {
|
val page = try {
|
||||||
val i = params.getOrElse("page", "1").toInt
|
val i = params.getOrElse("page", "1").toInt
|
||||||
if(i <= 0) 1 else i
|
if(i <= 0) 1 else i
|
||||||
@@ -160,4 +155,18 @@ trait IndexControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
get("/search"){
|
||||||
|
val query = params.getOrElse("query", "").trim.toLowerCase
|
||||||
|
val visibleRepositories = getVisibleRepositories(context.loginAccount, None)
|
||||||
|
val repositories = visibleRepositories.filter { repository =>
|
||||||
|
repository.name.toLowerCase.indexOf(query) >= 0 || repository.owner.toLowerCase.indexOf(query) >= 0
|
||||||
|
}
|
||||||
|
context.loginAccount.map { account =>
|
||||||
|
gitbucket.core.search.html.repositories(query, repositories, Nil, getUserRepositories(account.userName, withoutPhysicalInfo = true))
|
||||||
|
}.getOrElse {
|
||||||
|
gitbucket.core.search.html.repositories(query, repositories, visibleRepositories, Nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
|||||||
val dummyWebHookInfo = WebHook(repository.owner, repository.name, url, ctype, token)
|
val dummyWebHookInfo = WebHook(repository.owner, repository.name, url, ctype, token)
|
||||||
val dummyPayload = {
|
val dummyPayload = {
|
||||||
val ownerAccount = getAccountByUserName(repository.owner).get
|
val ownerAccount = getAccountByUserName(repository.owner).get
|
||||||
val commits = if(repository.commitCount == 0) List.empty else git.log
|
val commits = if(JGitUtil.isEmpty(git)) List.empty else git.log
|
||||||
.add(git.getRepository.resolve(repository.repository.defaultBranch))
|
.add(git.getRepository.resolve(repository.repository.defaultBranch))
|
||||||
.setMaxCount(4)
|
.setMaxCount(4)
|
||||||
.call.iterator.asScala.map(new CommitInfo(_)).toList
|
.call.iterator.asScala.map(new CommitInfo(_)).toList
|
||||||
|
|||||||
@@ -546,10 +546,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
* @return HTML of the file list
|
* @return HTML of the file list
|
||||||
*/
|
*/
|
||||||
private def fileList(repository: RepositoryService.RepositoryInfo, revstr: String = "", path: String = ".") = {
|
private def fileList(repository: RepositoryService.RepositoryInfo, revstr: String = "", path: String = ".") = {
|
||||||
if(repository.commitCount == 0){
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
html.guide(repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount))
|
if(JGitUtil.isEmpty(git)){
|
||||||
} else {
|
html.guide(repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount))
|
||||||
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
} else {
|
||||||
// get specified commit
|
// get specified commit
|
||||||
JGitUtil.getDefaultBranch(git, repository, revstr).map { case (objectId, revision) =>
|
JGitUtil.getDefaultBranch(git, repository, revstr).map { case (objectId, revision) =>
|
||||||
defining(JGitUtil.getRevCommitFromId(git, objectId)) { revCommit =>
|
defining(JGitUtil.getRevCommitFromId(git, objectId)) { revCommit =>
|
||||||
@@ -569,9 +569,14 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
html.files(revision, repository,
|
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(lastModifiedCommit), // last modified commit
|
new JGitUtil.CommitInfo(lastModifiedCommit), // last modified commit
|
||||||
files, readme, hasDeveloperRole(repository.owner, repository.name, context.loginAccount),
|
JGitUtil.getCommitCount(repository.owner, repository.name, revision),
|
||||||
|
files,
|
||||||
|
readme,
|
||||||
|
hasDeveloperRole(repository.owner, repository.name, context.loginAccount),
|
||||||
getPullRequestFromBranch(repository.owner, repository.name, revstr, repository.repository.defaultBranch),
|
getPullRequestFromBranch(repository.owner, repository.name, revstr, repository.repository.defaultBranch),
|
||||||
flash.get("info"), flash.get("error"))
|
flash.get("info"),
|
||||||
|
flash.get("error")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} getOrElse NotFound()
|
} getOrElse NotFound()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -421,26 +421,20 @@ trait RepositoryService { self: AccountService =>
|
|||||||
object RepositoryService {
|
object RepositoryService {
|
||||||
|
|
||||||
case class RepositoryInfo(owner: String, name: String, repository: Repository,
|
case class RepositoryInfo(owner: String, name: String, repository: Repository,
|
||||||
issueCount: Int, pullCount: Int, commitCount: Int, forkedCount: Int,
|
issueCount: Int, pullCount: Int, forkedCount: Int,
|
||||||
branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]) {
|
branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates instance with issue count and pull request count.
|
* Creates instance with issue count and pull request count.
|
||||||
*/
|
*/
|
||||||
def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) =
|
def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) =
|
||||||
this(
|
this(repo.owner, repo.name, model, issueCount, pullCount, forkedCount, repo.branchList, repo.tags, managers)
|
||||||
repo.owner, repo.name, model,
|
|
||||||
issueCount, pullCount, repo.commitCount, forkedCount,
|
|
||||||
repo.branchList, repo.tags, managers)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates instance without issue count and pull request count.
|
* Creates instance without issue count and pull request count.
|
||||||
*/
|
*/
|
||||||
def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int, managers: Seq[String]) =
|
def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int, managers: Seq[String]) =
|
||||||
this(
|
this(repo.owner, repo.name, model, 0, 0, forkedCount, repo.branchList, repo.tags, managers)
|
||||||
repo.owner, repo.name, model,
|
|
||||||
0, 0, repo.commitCount, forkedCount,
|
|
||||||
repo.branchList, repo.tags, managers)
|
|
||||||
|
|
||||||
def httpUrl(implicit context: Context): String = RepositoryService.httpUrl(owner, name)
|
def httpUrl(implicit context: Context): String = RepositoryService.httpUrl(owner, name)
|
||||||
def sshUrl(implicit context: Context): Option[String] = RepositoryService.sshUrl(owner, name)
|
def sshUrl(implicit context: Context): Option[String] = RepositoryService.sshUrl(owner, name)
|
||||||
@@ -454,7 +448,6 @@ object RepositoryService {
|
|||||||
|
|
||||||
(id, path.substring(id.length).stripPrefix("/"))
|
(id, path.substring(id.length).stripPrefix("/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
||||||
|
|||||||
@@ -32,14 +32,11 @@ object JGitUtil {
|
|||||||
*
|
*
|
||||||
* @param owner the user name of the repository owner
|
* @param owner the user name of the repository owner
|
||||||
* @param name the repository name
|
* @param name the repository name
|
||||||
* @param commitCount the commit count. If the repository has over 1000 commits then this property is 1001.
|
|
||||||
* @param branchList the list of branch names
|
* @param branchList the list of branch names
|
||||||
* @param tags the list of tags
|
* @param tags the list of tags
|
||||||
*/
|
*/
|
||||||
case class RepositoryInfo(owner: String, name: String, commitCount: Int, branchList: List[String], tags: List[TagInfo]){
|
case class RepositoryInfo(owner: String, name: String, branchList: List[String], tags: List[TagInfo]){
|
||||||
def this(owner: String, name: String) = {
|
def this(owner: String, name: String) = this(owner, name, Nil, Nil)
|
||||||
this(owner, name, 0, Nil, Nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,19 +167,25 @@ object JGitUtil {
|
|||||||
revCommit
|
revCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of commits in the specified branch or commit.
|
||||||
|
* If the specified branch has over 10000 commits, this method returns 100001.
|
||||||
|
*/
|
||||||
|
def getCommitCount(owner: String, repository: String, branch: String): Int = {
|
||||||
|
using(Git.open(getRepositoryDir(owner, repository))){ git =>
|
||||||
|
val commitId = git.getRepository.resolve(branch)
|
||||||
|
val commitCount = git.log.add(commitId).call.iterator.asScala.take(10001).size
|
||||||
|
commitCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the repository information. It contains branch names and tag names.
|
* Returns the repository information. It contains branch names and tag names.
|
||||||
*/
|
*/
|
||||||
def getRepositoryInfo(owner: String, repository: String): RepositoryInfo = {
|
def getRepositoryInfo(owner: String, repository: String): RepositoryInfo = {
|
||||||
using(Git.open(getRepositoryDir(owner, repository))){ git =>
|
using(Git.open(getRepositoryDir(owner, repository))){ git =>
|
||||||
try {
|
try {
|
||||||
// get commit count
|
RepositoryInfo(owner, repository,
|
||||||
val commitCount = git.log.all.call.iterator.asScala.map(_ => 1).take(10001).sum
|
|
||||||
|
|
||||||
RepositoryInfo(
|
|
||||||
owner, repository,
|
|
||||||
// commit count
|
|
||||||
commitCount,
|
|
||||||
// branches
|
// branches
|
||||||
git.branchList.call.asScala.map { ref =>
|
git.branchList.call.asScala.map { ref =>
|
||||||
ref.getName.stripPrefix("refs/heads/")
|
ref.getName.stripPrefix("refs/heads/")
|
||||||
@@ -195,9 +198,7 @@ object JGitUtil {
|
|||||||
)
|
)
|
||||||
} catch {
|
} catch {
|
||||||
// not initialized
|
// not initialized
|
||||||
case e: NoHeadException => RepositoryInfo(
|
case e: NoHeadException => RepositoryInfo(owner, repository, Nil, Nil)
|
||||||
owner, repository, 0, Nil, Nil)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +213,7 @@ object JGitUtil {
|
|||||||
*/
|
*/
|
||||||
def getFileList(git: Git, revision: String, path: String = "."): List[FileInfo] = {
|
def getFileList(git: Git, revision: String, path: String = "."): List[FileInfo] = {
|
||||||
using(new RevWalk(git.getRepository)){ revWalk =>
|
using(new RevWalk(git.getRepository)){ revWalk =>
|
||||||
val objectId = git.getRepository.resolve(revision)
|
val objectId = git.getRepository.resolve(revision)
|
||||||
if(objectId == null) return Nil
|
if(objectId == null) return Nil
|
||||||
val revCommit = revWalk.parseCommit(objectId)
|
val revCommit = revWalk.parseCommit(objectId)
|
||||||
|
|
||||||
|
|||||||
@@ -12,21 +12,15 @@
|
|||||||
@if(userRepositories.isEmpty){
|
@if(userRepositories.isEmpty){
|
||||||
<li>No repositories</li>
|
<li>No repositories</li>
|
||||||
} else {
|
} else {
|
||||||
@defining(10){ max =>
|
<li><form class="sidebar-form"><input type="text" id="filter-box" class="form-control input-sm" placeholder="Find repository"/></form></li>
|
||||||
@userRepositories.zipWithIndex.map { case (repository, i) =>
|
@userRepositories.zipWithIndex.map { case (repository, i) =>
|
||||||
<li class="repo-link" style="@if(i > max - 1){display:none;}">
|
<li class="repo-link">
|
||||||
@if(repository.owner == context.loginAccount.get.userName){
|
@if(repository.owner == context.loginAccount.get.userName){
|
||||||
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) <span class="strong">@repository.name</span></a>
|
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) <span class="strong">@repository.name</span></a>
|
||||||
} else {
|
} else {
|
||||||
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
|
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
|
||||||
}
|
}
|
||||||
</li>
|
</li>
|
||||||
}
|
|
||||||
@if(userRepositories.size > max){
|
|
||||||
<li class="show-more">
|
|
||||||
<a href="javascript:void(0);" id="show-more-repos">Show @{userRepositories.size - max} more repositories...</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -34,17 +28,11 @@
|
|||||||
@if(recentRepositories.isEmpty){
|
@if(recentRepositories.isEmpty){
|
||||||
<li>No repositories</li>
|
<li>No repositories</li>
|
||||||
} else {
|
} else {
|
||||||
@defining(10){ max =>
|
<li><form class="sidebar-form"><input type="text" id="filter-box" class="form-control input-sm" placeholder="Find repository"/></form></li>
|
||||||
@recentRepositories.zipWithIndex.map { case (repository, i) =>
|
@recentRepositories.zipWithIndex.map { case (repository, i) =>
|
||||||
<li class="repo-link" style="@if(i > max - 1){display:none;}">
|
<li class="repo-link">
|
||||||
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
|
<a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
|
||||||
</li>
|
</li>
|
||||||
}
|
|
||||||
@if(recentRepositories.size > max){
|
|
||||||
<li class="show-more">
|
|
||||||
<a href="javascript:void(0);" id="show-more-recent-repos">Show @{recentRepositories.size - max} more repositories...</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,9 +46,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#show-more-repos, #show-more-recent-repos').click(function(e){
|
$('#filter-box').keyup(function(){
|
||||||
$(e.target).parents('ul').find('li.repo-link').show();
|
var inputVal = $('#filter-box').val();
|
||||||
$(e.target).parents('li.show-more').remove();
|
$.each($('li.repo-link a'), function(index, elem) {
|
||||||
|
console.log(inputVal);
|
||||||
|
console.log(elem.text.trim());
|
||||||
|
console.log(elem.text.trim().lastIndexOf(inputVal, 0));
|
||||||
|
if (!inputVal || !elem.text.trim() || elem.text.trim().indexOf(inputVal) >= 0) {
|
||||||
|
$(elem).parent().show();
|
||||||
|
} else {
|
||||||
|
$(elem).parent().hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('form.sidebar-form').submit(function () {
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,15 +21,22 @@
|
|||||||
<a href="@condition.copy(state = "closed").toURL">Closed <span class="badge">@closedCount</span></a>
|
<a href="@condition.copy(state = "closed").toURL">Closed <span class="badge">@closedCount</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<form method="GET" id="search-filter-form" class="form-inline pull-right">
|
<form method="GET" action="@helpers.url(repository)/search" id="search-filter-form" class="form-inline pull-right">
|
||||||
@if(isEditable){
|
<div class="input-group">
|
||||||
@if(target == "issues"){
|
<input type="text" class="form-control" name="q" placeholder="Search..."/>
|
||||||
<a class="btn btn-success" href="@helpers.url(repository)/issues/new">New issue</a>
|
<input type="hidden" name="type" value="issue"/>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="submit" id="search-btn" class="btn btn-default"><i class="fa fa-search"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
@if(isEditable){
|
||||||
|
@if(target == "issues"){
|
||||||
|
<a class="btn btn-success" href="@helpers.url(repository)/issues/new">New issue</a>
|
||||||
|
}
|
||||||
|
@if(target == "pulls"){
|
||||||
|
<a class="btn btn-success" href="@helpers.url(repository)/compare">New pull request</a>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@if(target == "pulls"){
|
|
||||||
<a class="btn btn-success" href="@helpers.url(repository)/compare">New pull request</a>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</form>
|
</form>
|
||||||
@gitbucket.core.issues.html.listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), isManageable)
|
@gitbucket.core.issues.html.listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), isManageable)
|
||||||
@if(isManageable){
|
@if(isManageable){
|
||||||
|
|||||||
@@ -53,15 +53,11 @@
|
|||||||
<span class="sr-only">Toggle navigation</span>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@repository.map { repository =>
|
<form id="search" action="@context.path/search" method="GET" class="pc navbar-form navbar-left" role="search">
|
||||||
<form id="search" action="@context.path/search" method="POST" class="pc navbar-form navbar-left" role="search">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<input type="text" name="query" id="navbar-search-input" class="form-control" placeholder="Search repository"/>
|
||||||
<input type="text" name="query" id="navbar-search-input" class="form-control" placeholder="Search this repository"/>
|
</div>
|
||||||
<input type="hidden" name="owner" value="@repository.owner"/>
|
</form>
|
||||||
<input type="hidden" name="repository" value="@repository.name"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
<ul class="pc nav navbar-nav">
|
<ul class="pc nav navbar-nav">
|
||||||
@if(context.loginAccount.isDefined){
|
@if(context.loginAccount.isDefined){
|
||||||
<li><a href="@context.path/dashboard/pulls">Pull requests</a></li>
|
<li><a href="@context.path/dashboard/pulls">Pull requests</a></li>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<ul class="sidebar-menu">
|
<ul class="sidebar-menu">
|
||||||
@menuitem("", "files", "Files", "code")
|
@menuitem("", "files", "Files", "code")
|
||||||
@if(repository.commitCount != 0) {
|
@if(repository.branchList.nonEmpty) {
|
||||||
@menuitem("/branches", "branches", "Branches", "git-branch", repository.branchList.length)
|
@menuitem("/branches", "branches", "Branches", "git-branch", repository.branchList.length)
|
||||||
@menuitem("/tags", "tags", "Tags", "tag", repository.tags.length)
|
@menuitem("/tags", "tags", "Tags", "tag", repository.tags.length)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
|
||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
latestCommit: gitbucket.core.util.JGitUtil.CommitInfo,
|
latestCommit: gitbucket.core.util.JGitUtil.CommitInfo,
|
||||||
|
commitCount: Int,
|
||||||
files: List[gitbucket.core.util.JGitUtil.FileInfo],
|
files: List[gitbucket.core.util.JGitUtil.FileInfo],
|
||||||
readme: Option[(List[String], String)],
|
readme: Option[(List[String], String)],
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t"><i class="octicon octicon-search"></i></a>
|
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t"><i class="octicon octicon-search"></i></a>
|
||||||
<a href="@helpers.url(repository)/commits/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default"><i class="octicon octicon-history"></i> @if(repository.commitCount > 10000){10000+} else {@repository.commitCount} @helpers.plural(repository.commitCount, "commit")</a>
|
<a href="@helpers.url(repository)/commits/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default"><i class="octicon octicon-history"></i> @if(commitCount > 10000){10000+} else {@commitCount} @helpers.plural(commitCount, "commit")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if(pathList.isEmpty){
|
@if(pathList.isEmpty){
|
||||||
@@ -85,7 +86,9 @@
|
|||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<a href="@helpers.url(repository)/new/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default pc" title="Create a new file here" @if(!hasWritePermission){disabled}><i class="octicon octicon-plus"></i></a>
|
@if(hasWritePermission){
|
||||||
|
<a href="@helpers.url(repository)/new/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default pc" title="Create a new file here"><i class="octicon octicon-plus"></i></a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
@*
|
@*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
@import gitbucket.core.view.helpers
|
@import gitbucket.core.view.helpers
|
||||||
@import gitbucket.core.service.RepositorySearchService
|
@import gitbucket.core.service.RepositorySearchService
|
||||||
@gitbucket.core.html.main("Search Results", Some(repository)){
|
@gitbucket.core.html.main("Search Results", Some(repository)){
|
||||||
@gitbucket.core.search.html.menu("code", query, repository){
|
@gitbucket.core.search.html.menu("files", query, repository){
|
||||||
@if(query.nonEmpty) {
|
@if(query.nonEmpty) {
|
||||||
@if(files.isEmpty) {
|
@if(files.isEmpty) {
|
||||||
<h4>We couldn't find any code matching '@query'</h4>
|
<h4>We couldn't find any code matching '@query'</h4>
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
@import gitbucket.core.view.helpers
|
@import gitbucket.core.view.helpers
|
||||||
@import gitbucket.core.service.RepositorySearchService
|
@import gitbucket.core.service.RepositorySearchService
|
||||||
@gitbucket.core.html.main("Search Results", Some(repository)){
|
@gitbucket.core.html.main("Search Results", Some(repository)){
|
||||||
@gitbucket.core.search.html.menu("issue", query, repository){
|
@gitbucket.core.search.html.menu("issues", query, repository){
|
||||||
@if(query.nonEmpty) {
|
@if(query.nonEmpty) {
|
||||||
@if(issues.isEmpty) {
|
@if(issues.isEmpty) {
|
||||||
<h4>We couldn't find any code matching '@query'</h4>
|
<h4>We couldn't find any code matching '@query'</h4>
|
||||||
} else {
|
} else {
|
||||||
<h4>We've found @issues.size code @helpers.plural(issues.size, "result")</h4>
|
<h4>We've found @issues.size @helpers.plural(issues.size, "issue")</h4>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@issues.drop((page - 1) * RepositorySearchService.IssueLimit).take(RepositorySearchService.IssueLimit).map { issue =>
|
@issues.drop((page - 1) * RepositorySearchService.IssueLimit).take(RepositorySearchService.IssueLimit).map { issue =>
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
@(active: String, query: String,
|
@(active: String, query: String,
|
||||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(body: Html)(implicit context: gitbucket.core.controller.Context)
|
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(body: Html)(implicit context: gitbucket.core.controller.Context)
|
||||||
@import gitbucket.core.view.helpers
|
@import gitbucket.core.view.helpers
|
||||||
@gitbucket.core.html.menu("", repository){
|
@gitbucket.core.html.menu(active, repository){
|
||||||
<form action="@helpers.url(repository)/search" method="GET" class="form-inline">
|
<form action="@helpers.url(repository)/search" method="GET" class="form-inline">
|
||||||
<select class="form-control" name="type">
|
<select class="form-control" name="type">
|
||||||
<option value="code" @if(active=="code" ){ selected }>Files</option>
|
<option value="code" @if(active == "files"){ selected }>Files</option>
|
||||||
<option value="issue" @if(active=="issue"){ selected }>Issues</option>
|
@if(repository.repository.options.issuesOption != "DISABLE") {
|
||||||
<option value="wiki" @if(active=="wiki" ){ selected }>Wiki</option>
|
<option value="issue" @if(active == "issues"){ selected }>Issues</option>
|
||||||
|
}
|
||||||
|
@if(repository.repository.options.wikiOption != "DISABLE") {
|
||||||
|
<option value="wiki" @if(active == "wiki"){ selected }>Wiki</option>
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
<input type="text" name="q" value="@query" class="form-control" style="width: 250px; margin-bottom: 0px;"/>
|
<input type="text" name="q" value="@query" class="form-control" style="width: 250px;" placeholder="Search..."/>
|
||||||
<input type="submit" value="Search" class="btn btn-default"/>
|
<input type="submit" value="Search" class="btn btn-default"/>
|
||||||
<input type="hidden" name="type" value="@active"/>
|
<input type="hidden" name="type" value="@active"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
40
src/main/twirl/gitbucket/core/search/repositories.scala.html
Normal file
40
src/main/twirl/gitbucket/core/search/repositories.scala.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
@(query: String,
|
||||||
|
repositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
|
||||||
|
recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
|
||||||
|
userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context)
|
||||||
|
@import gitbucket.core.view.helpers
|
||||||
|
@gitbucket.core.html.main("GitBucket"){
|
||||||
|
@gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){
|
||||||
|
<form action="@context.path/search" method="GET" class="form-inline">
|
||||||
|
<input type="text" name="query" value="@query" class="form-control" style="width: 250px; margin-bottom: 0px;"/>
|
||||||
|
<input type="submit" value="Search" class="btn btn-default"/>
|
||||||
|
</form>
|
||||||
|
@if(repositories.isEmpty) {
|
||||||
|
<h4>We couldn't find any repository matching '@query'</h4>
|
||||||
|
} else {
|
||||||
|
<h4>We've found @repositories.size @helpers.plural(repositories.size, "repository", "repositories")</h4>
|
||||||
|
}
|
||||||
|
@repositories.map { repository =>
|
||||||
|
<div class="block">
|
||||||
|
<div class="repository-icon">
|
||||||
|
@gitbucket.core.helper.html.repositoryicon(repository, true)
|
||||||
|
</div>
|
||||||
|
<div class="repository-content">
|
||||||
|
<div class="block-header">
|
||||||
|
<a href="@helpers.url(repository)">@repository.owner/@repository.name</a>
|
||||||
|
@if(repository.repository.isPrivate){
|
||||||
|
<i class="octicon octicon-lock"></i>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
@if(repository.repository.originUserName.isDefined){
|
||||||
|
<div class="small muted">forked from <a href="@context.path/@repository.repository.parentUserName/@repository.repository.parentRepositoryName">@repository.repository.parentUserName/@repository.repository.parentRepositoryName</a></div>
|
||||||
|
}
|
||||||
|
@if(repository.repository.description.isDefined){
|
||||||
|
<div>@repository.repository.description</div>
|
||||||
|
}
|
||||||
|
<div><span class="muted small">Updated @gitbucket.core.helper.html.datetimeago(repository.repository.lastActivityDate)</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
@if(wikis.isEmpty) {
|
@if(wikis.isEmpty) {
|
||||||
<h4>We couldn't find any code matching '@query'</h4>
|
<h4>We couldn't find any code matching '@query'</h4>
|
||||||
} else {
|
} else {
|
||||||
<h4>We've found @wikis.size code @helpers.plural(wikis.size, "result")</h4>
|
<h4>We've found @wikis.size @helpers.plural(wikis.size, "page")</h4>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@wikis.drop((page - 1) * RepositorySearchService.CodeLimit).take(RepositorySearchService.CodeLimit).map { file =>
|
@wikis.drop((page - 1) * RepositorySearchService.CodeLimit).take(RepositorySearchService.CodeLimit).map { file =>
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
@gitbucket.core.html.menu("wiki", repository){
|
@gitbucket.core.html.menu("wiki", repository){
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@if(page.isDefined){
|
@if(page.isDefined){
|
||||||
<a class="btn btn-small btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_history">Page History</a>
|
<a class="btn btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_history">Page History</a>
|
||||||
<a class="btn btn-small btn-danger" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_delete" id="delete">Delete Page</a>
|
<a class="btn btn-danger" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_delete" id="delete">Delete Page</a>
|
||||||
}
|
}
|
||||||
<a class="btn btn-small btn-success" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
|
||||||
</div>
|
</div>
|
||||||
<h1 class="wiki-title"><span class="muted">Editing</span> @if(pageName.isEmpty){New Page} else {@pageName}</h1>
|
<h1 class="wiki-title"><span class="muted">Editing</span> @if(pageName.isEmpty){New Page} else {@pageName}</h1>
|
||||||
<form action="@helpers.url(repository)/wiki/@if(page.isEmpty){_new} else {_edit}" method="POST" validate="true">
|
<form action="@helpers.url(repository)/wiki/@if(page.isEmpty){_new} else {_edit}" method="POST" validate="true">
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
@if(isEditable) {
|
@if(isEditable) {
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@if(pageName.isEmpty) {
|
@if(pageName.isEmpty) {
|
||||||
<a class="btn btn-small" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
<a class="btn" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
||||||
} else {
|
} else {
|
||||||
<a class="btn btn-small btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_edit">Edit Page</a>
|
<a class="btn btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_edit">Edit Page</a>
|
||||||
<a class="btn btn-small btn-success" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
<a class="btn btn-success" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<h1 class="wiki-title">
|
<h1 class="wiki-title">
|
||||||
@if(pageName.isEmpty){
|
@if(pageName.isEmpty){
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<th colspan="3">
|
<th colspan="3">
|
||||||
<div class="pull-left" style="padding-top: 4px;">Revisions</div>
|
<div class="pull-left" style="padding-top: 4px;">Revisions</div>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<input type="button" id="compare" value="Compare Revisions" class="btn btn-dm btn-default"/>
|
<input type="button" id="compare" value="Compare Revisions" class="btn btn-sm btn-default"/>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -10,13 +10,20 @@
|
|||||||
@gitbucket.core.html.main(s"${pageName} - ${repository.owner}/${repository.name}", Some(repository)){
|
@gitbucket.core.html.main(s"${pageName} - ${repository.owner}/${repository.name}", Some(repository)){
|
||||||
@gitbucket.core.html.menu("wiki", repository){
|
@gitbucket.core.html.menu("wiki", repository){
|
||||||
<div>
|
<div>
|
||||||
<div class="pull-right">
|
<form method="GET" action="@helpers.url(repository)/search" id="search-filter-form" class="form-inline pull-right">
|
||||||
<a class="btn btn-small btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_history">Page History</a>
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" name="q" placeholder="Search..."/>
|
||||||
|
<input type="hidden" name="type" value="wiki"/>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="submit" id="search-btn" class="btn btn-default"><i class="fa fa-search"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_history">Page History</a>
|
||||||
@if(isEditable){
|
@if(isEditable){
|
||||||
<a class="btn btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_edit">Edit Page</a>
|
<a class="btn btn-default" href="@helpers.url(repository)/wiki/@helpers.urlEncode(pageName)/_edit">Edit Page</a>
|
||||||
<a class="btn btn-success" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
<a class="btn btn-success" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
||||||
}
|
}
|
||||||
</div>
|
</form>
|
||||||
<h1 class="body-title">@pageName</h1>
|
<h1 class="body-title">@pageName</h1>
|
||||||
<div>
|
<div>
|
||||||
<span class="muted"><strong>@page.committer</strong> edited this page @gitbucket.core.helper.html.datetimeago(page.time)</span>
|
<span class="muted"><strong>@page.committer</strong> edited this page @gitbucket.core.helper.html.datetimeago(page.time)</span>
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
<h1 class="wiki-title"><span class="muted">Pages</span></h1>
|
<h1 class="wiki-title"><span class="muted">Pages</span></h1>
|
||||||
</li>
|
</li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<div class="btn-group">
|
@if(isEditable){
|
||||||
@if(isEditable){
|
<a class="btn btn-default" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
||||||
<a class="btn btn-small btn-default" href="@helpers.url(repository)/wiki/_new">New Page</a>
|
}
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="pull-left">
|
<ul class="pull-left">
|
||||||
|
|||||||
Reference in New Issue
Block a user