Compare commits

...

66 Commits
4.2 ... 4.3

Author SHA1 Message Date
Naoki Takezoe
709fab9ccc GitBucket 4.3 release 2016-07-30 10:34:40 +09:00
Naoki Takezoe
fd13a2db79 Update README.md for 4.3 release 2016-07-30 10:21:01 +09:00
Naoki Takezoe
840d81f7bd (refs #1250) Bump markedj 2016-07-30 10:14:05 +09:00
Naoki Takezoe
5d08f4d339 Merge pull request #1249 from shiena/patch/fix-git-repo-path
fix: can't resolve the git repository path provided by the plugin
2016-07-29 01:26:31 +09:00
Naoki Takezoe
ef48b2d5ef (refs #1248) Move splitPath() to RepositoryInfo 2016-07-28 17:37:35 +09:00
Naoki Takezoe
f54e4f337f Merge pull request #1248 from kounoike/PR-api-for-ghbs
add some API. required by Jenkins GitHub Branch Source plugin
2016-07-28 17:28:53 +09:00
Naoki Takezoe
743965d3b8 (refs #1247) cleanup 2016-07-27 02:36:30 +09:00
Naoki Takezoe
0e787eddfd Merge pull request #1247 from kounoike/PR-api-basicauth
Add Basic Authentication support for API access
2016-07-27 02:32:20 +09:00
Mitsuhiro Koga
442c0d575e Modify contextPath to the literal pattern
Because contextPath can contain some special chars.
2016-07-26 20:50:40 +09:00
Mitsuhiro Koga
485516be2e fix: can't resolve the git repository path provided by the plugin
If the contextPath is not equals to `/`, gitRepositoryPath contains
the contextPath + `/git`.  Therefore, gitbucket can not resolve
the git repository path provided by the plugin.

For example, you can not clone the snippets repository of gist-plugin.

To fix this, also deletes contextPath from requestURI.
2016-07-26 01:01:57 +09:00
KOUNOIKE Yuusuke
6b2fbb3bf0 add some API. required by Jenkins GitHub Branch Source plugin 2016-07-25 23:52:08 +09:00
KOUNOIKE Yuusuke
e510b1c26b Add Basic Authentication support for API access 2016-07-25 23:43:35 +09:00
Naoki Takezoe
8d35494169 Fix message of plugin version 2016-07-20 11:45:16 +09:00
Naoki Takezoe
cf1504bae7 (refs #1245) Display migrated plugin version if migration is failing 2016-07-20 10:58:26 +09:00
Naoki Takezoe
9bb4e473b9 Merge pull request #1236 from mrkm4ntr/fix-plugin-versions
Fix plugin versions in installed plugins page
2016-07-19 09:27:38 +09:00
Naoki Takezoe
d67afebadc Rename CompletionProposalProvider to SuggestionProvider 2016-07-16 12:29:42 +09:00
Naoki Takezoe
417886161c (refs #1242) Bugfix in branch protection for branches which contain / 2016-07-16 11:00:29 +09:00
Naoki Takezoe
1b85d511e9 Purge Emoji support because it will be provided as plugin 2016-07-14 10:35:16 +09:00
Naoki Takezoe
45d84f63c1 Merge remote-tracking branch 'origin/master' 2016-07-14 02:21:42 +09:00
Naoki Takezoe
fff60b2704 Remove head / from resource path 2016-07-14 02:21:27 +09:00
Naoki Takezoe
c9339aec9e Fix error in creating and merging pull request 2016-07-13 21:06:38 +09:00
Naoki Takezoe
7c98ae1341 (refs #1241) Update CompletionProposalProvider interface 2016-07-13 02:33:58 +09:00
Naoki Takezoe
01c2291715 Fix testcase 2016-07-13 02:14:44 +09:00
Naoki Takezoe
2e03f081d9 (refs #1241) Filter CompletionProposalProvider by the completion context 2016-07-13 01:56:43 +09:00
Naoki Takezoe
0cbafdd884 Update TextDecorator interface 2016-07-13 01:43:35 +09:00
Naoki Takezoe
d5a9c2c15d (refs #1241) Add new extension point to add completion proposals provider for the textarea 2016-07-12 19:38:42 +09:00
Naoki Takezoe
1496591244 (refs #1240) Add new extension point to add text decorators 2016-07-12 15:21:40 +09:00
Naoki Takezoe
f5acce3901 Decorate only text node 2016-07-12 01:25:02 +09:00
Shintaro Murakami
5568a0ad8e Fix plugin versions in installed plugins page 2016-07-11 20:46:48 +09:00
Naoki Takezoe
26a18287c7 (refs #1238) Add new extension point to supply assets by plugin 2016-07-11 18:14:43 +09:00
Naoki Takezoe
b0f819b9bd Remove unused import statements 2016-07-11 13:53:07 +09:00
Naoki Takezoe
ebff7baf07 Fix WebHook message garbling:
76079aa1e8
2016-07-11 13:31:06 +09:00
Naoki Takezoe
cf9a55d896 (refs #1237) Fix broken layout 2016-07-10 22:55:34 +09:00
Naoki Takezoe
72f7b659f4 Remove unused import statements 2016-07-10 12:15:17 +09:00
Naoki Takezoe
87192d025b Remove Jsoup dependency 2016-07-10 11:35:03 +09:00
Naoki Takezoe
fd181b9a0c Fix emoji conversion 2016-07-10 02:03:25 +09:00
Naoki Takezoe
9c4cc12a02 Change import to resolve resolving error in IntelliJ 2016-07-09 18:09:54 +09:00
Naoki Takezoe
44497b559e Change import to resolve resolving error in IntelliJ 2016-07-09 18:09:31 +09:00
Naoki Takezoe
09c50a149b Change import to resolve resolving error in IntelliJ 2016-07-09 16:07:32 +09:00
Naoki Takezoe
88beb68e01 Change import to resolve resolving error in IntelliJ 2016-07-09 15:27:04 +09:00
Naoki Takezoe
0da358311b Change import to resolve resolving error in IntelliJ 2016-07-09 14:50:17 +09:00
Naoki Takezoe
cf97b63dab Change import to resolve resolving error in IntelliJ 2016-07-09 14:22:23 +09:00
Naoki Takezoe
4b5f22144e Change import to resolve resolving error in IntelliJ 2016-07-09 14:22:06 +09:00
Naoki Takezoe
0d342a6863 Use completion is disabled in the Wiki editor 2016-07-09 13:46:13 +09:00
Naoki Takezoe
458820a09d Add user name completion in the textarea 2016-07-09 11:47:41 +09:00
Naoki Takezoe
135c34ef0f Remove extension point to add text decorators. We need more consideration. 2016-07-09 11:47:22 +09:00
Naoki Takezoe
8187c5a013 Add new extension point to add TextDecorator. 2016-07-08 22:50:01 +09:00
Naoki Takezoe
6ff48c8130 Clean up 2016-07-08 19:58:22 +09:00
Naoki Takezoe
d37c70cd8d Emoji completion in textarea 2016-07-08 19:51:28 +09:00
Naoki Takezoe
8abf357405 Convert emoji in commit message 2016-07-07 19:53:23 +09:00
Naoki Takezoe
c93ac71634 Merge branch 'rlazoti-emoji-support' 2016-07-07 19:46:30 +09:00
Naoki Takezoe
408180f071 Change EmojiConverter to EmojiUtil 2016-07-07 19:39:30 +09:00
Naoki Takezoe
4e98abfe5c Remove unnecessary self typing 2016-07-07 19:30:47 +09:00
Naoki Takezoe
efbb404bd4 Fix file attachement area in Wiki page editing form 2016-07-05 17:48:53 +09:00
Naoki Takezoe
66f409bfad Merge branch 'emoji-support' of https://github.com/rlazoti/gitbucket into rlazoti-emoji-support
# Conflicts:
#	src/main/scala/view/Markdown.scala
2016-07-05 17:21:10 +09:00
Naoki Takezoe
44ec64fb4b Merge pull request #1232 from shiena/patch/fix-user-profile
fix: can't show the user profile when joining any groups
2016-07-05 01:57:24 +09:00
Mitsuhiro Koga
fb27bd29e8 Add a missing ul tag 2016-07-05 01:47:20 +09:00
Mitsuhiro Koga
c26ca9d463 fix: can't show the user profile when joining any groups 2016-07-04 21:01:47 +09:00
Naoki Takezoe
8c36ba33f4 Update README.md 2016-07-04 08:39:50 +09:00
Naoki Takezoe
fe1e18b495 Bugfix for new installation 2016-07-04 08:33:02 +09:00
Naoki Takezoe
29e632af04 Update README.md 2016-07-03 01:10:17 +09:00
Naoki Takezoe
2b9daae62b Update README.md 2016-07-03 00:52:20 +09:00
Naoki Takezoe
8a11f85dd1 4.2.1 release 2016-07-03 00:46:54 +09:00
Naoki Takezoe
b09c72b106 (refs #1227)Fix migration from 3.14 to 4.0.0 2016-07-03 00:39:38 +09:00
Naoki Takezoe
43456e817a Fix badge position in the sidebar 2016-07-02 21:13:14 +09:00
Rodrigo Lazoti
41e49423b2 Add emoji support for markdown 2015-01-21 22:07:14 -02:00
128 changed files with 2978 additions and 1224 deletions

View File

@@ -50,6 +50,7 @@ GitBucket has the plug-in system to extend GitBucket from outside of GitBucket.
- [gitbucket-commitgraphs-plugin](https://github.com/yoshiyoshifujii/gitbucket-commitgraphs-plugin)
- [gitbucket-asciidoctor-plugin](https://github.com/lefou/gitbucket-asciidoctor-plugin)
- [gitbucket-network-plugin](https://github.com/mrkm4ntr/gitbucket-network-plugin)
- [gitbucket-emoji-plugin](https://github.com/gitbucket/gitbucket-emoji-plugin)
You can find community plugins other than them at [gitbucket community plugins](http://gitbucket-plugins.github.io/).
@@ -64,21 +65,41 @@ Support
Release Notes
-------------
### 4.2 - 2 Jul 2016
### 4.3 - 30 Jul 2016
- Emoji support by [gitbucket-emoji-plugin](https://github.com/gitbucket/gitbucket-emoji-plugin)
- User name suggestion
- Add new web APIs and basic authentication support for API access
- Root Endpoint
- [List endpoints](https://developer.github.com/v3/#root-endpoint)
- [List Branches](https://developer.github.com/v3/repos/branches/#list-branches)
- [Get contents](https://developer.github.com/v3/repos/contents/#get-contents)
- [Get a Reference](https://developer.github.com/v3/git/refs/#get-a-reference)
- [List Collaborators](https://developer.github.com/v3/repos/collaborators/#list-collaborators)
- [List user repositories](https://developer.github.com/v3/repos/#list-user-repositories)
- [Get a group](https://developer.github.com/v3/orgs/#get-an-organization)
- [List group repositories](https://developer.github.com/v3/repos/#list-organization-repositories)
- Add new extension points
- `assetsMapping` : Supplies resources in plugin classpath as web assets
- `suggestionProvider` : Provides suggestion in the Markdown editing textarea
- `textDecorator` : Decorate text nodes in HTML which is converted from Markdown
### 4.2.1 - 3 Jul 2016
- Fix migration bug
This is hotfix for a critical bug in migration. If you are new installation, use 4.2.0. But if you have an exisiting installation and it had been updated to 4.0 from 3.x, you must update to 4.2.1.
### 4.2 - 2 Jul 2016
- New UI based on [AdminLTE](https://github.com/almasaeed2010/AdminLTE)
- git gc
- Issues and Wiki have been possible to be disabled
- SMTP configuration test mail
### 4.1 - 4 Jun 2016
- Generic ssh user
- Improve branch protection UI
- Default value of pull request title
### 4.0 - 30 Apr 2016
- MySQL and PostgreSQL support
- Data export and import
- Migration system has been switched to [solidbase](https://github.com/gitbucket/solidbase)
@@ -86,7 +107,6 @@ Release Notes
**Note:** You can upgrade to GitBucket 4.0 from 3.14. If your GitBucket is 3.13 or before, you have to upgrade 3.14 at first.
### 3.14 - 30 Apr 2016
- File attachment and search for wiki pages
- New extension points to add menus
- Content-Type of webhooks has been choosable

View File

@@ -1,6 +1,6 @@
val Organization = "gitbucket"
val Name = "gitbucket"
val GitBucketVersion = "4.2.0"
val GitBucketVersion = "4.3.0"
val ScalatraVersion = "2.4.1"
val JettyVersion = "9.3.9.v20160517"
@@ -29,7 +29,7 @@ libraryDependencies ++= Seq(
"io.github.gitbucket" %% "scalatra-forms" % "1.0.0",
"commons-io" % "commons-io" % "2.4",
"io.github.gitbucket" % "solidbase" % "1.0.0",
"io.github.gitbucket" % "markedj" % "1.0.9-SNAPSHOT",
"io.github.gitbucket" % "markedj" % "1.0.9",
"org.apache.commons" % "commons-compress" % "1.11",
"org.apache.commons" % "commons-email" % "1.4",
"org.apache.httpcomponents" % "httpclient" % "4.5.1",
@@ -55,9 +55,6 @@ libraryDependencies ++= Seq(
"ru.yandex.qatools.embed" % "postgresql-embedded" % "1.14" % "test"
)
// Twirl settings
play.twirl.sbt.Import.TwirlKeys.templateImports += "gitbucket.core._"
// Compiler settings
scalacOptions := Seq("-deprecation", "-language:postfixOps", "-Ybackend:GenBCode", "-Ydelambdafy:method", "-target:jvm-1.8")
javacOptions in compile ++= Seq("-target", "8", "-source", "8")

View File

@@ -1,7 +1,7 @@
import gitbucket.core.controller._
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.servlet.{AccessTokenAuthenticationFilter, BasicAuthenticationFilter, Database, TransactionFilter}
import gitbucket.core.servlet.{ApiAuthenticationFilter, GitAuthenticationFilter, Database, TransactionFilter}
import gitbucket.core.util.Directory
import java.util.EnumSet
@@ -15,10 +15,10 @@ class ScalatraBootstrap extends LifeCycle {
// Register TransactionFilter and BasicAuthenticationFilter at first
context.addFilter("transactionFilter", new TransactionFilter)
context.getFilterRegistration("transactionFilter").addMappingForUrlPatterns(EnumSet.allOf(classOf[DispatcherType]), true, "/*")
context.addFilter("basicAuthenticationFilter", new BasicAuthenticationFilter)
context.getFilterRegistration("basicAuthenticationFilter").addMappingForUrlPatterns(EnumSet.allOf(classOf[DispatcherType]), true, "/git/*")
context.addFilter("accessTokenAuthenticationFilter", new AccessTokenAuthenticationFilter)
context.getFilterRegistration("accessTokenAuthenticationFilter").addMappingForUrlPatterns(EnumSet.allOf(classOf[DispatcherType]), true, "/api/v3/*")
context.addFilter("gitAuthenticationFilter", new GitAuthenticationFilter)
context.getFilterRegistration("gitAuthenticationFilter").addMappingForUrlPatterns(EnumSet.allOf(classOf[DispatcherType]), true, "/git/*")
context.addFilter("apiAuthenticationFilter", new ApiAuthenticationFilter)
context.getFilterRegistration("apiAuthenticationFilter").addMappingForUrlPatterns(EnumSet.allOf(classOf[DispatcherType]), true, "/api/v3/*")
// Register controllers
context.mount(new AnonymousAccessController, "/*")

View File

@@ -11,5 +11,7 @@ object GitBucketCoreModule extends Module("gitbucket-core",
new Version("4.1.0"),
new Version("4.2.0",
new LiquibaseMigration("update/gitbucket-core_4.2.xml")
)
),
new Version("4.2.1"),
new Version("4.3.0")
)

View File

@@ -14,3 +14,10 @@ case class ApiBranch(
"self" -> ApiPath(s"/api/v3/repos/${repositoryName.fullName}/branches/${name}"),
"html" -> ApiPath(s"/${repositoryName.fullName}/tree/${name}"))
}
case class ApiBranchCommit(sha: String)
case class ApiBranchForList(
name: String,
commit: ApiBranchCommit
)

View File

@@ -0,0 +1,11 @@
package gitbucket.core.api
import gitbucket.core.util.JGitUtil.FileInfo
case class ApiContents(`type`: String, name: String)
object ApiContents{
def apply(fileInfo: FileInfo): ApiContents =
if(fileInfo.isDirectory) ApiContents("dir", fileInfo.name)
else ApiContents("file", fileInfo.name)
}

View File

@@ -0,0 +1,3 @@
package gitbucket.core.api
case class ApiEndPoint(rate_limit_url: ApiPath = ApiPath("/api/v3/rate_limit"))

View File

@@ -0,0 +1,5 @@
package gitbucket.core.api
case class ApiObject(sha: String)
case class ApiRef(ref: String, `object`: ApiObject)

View File

@@ -13,6 +13,7 @@ case class ApiUser(
created_at: Date) {
val url = ApiPath(s"/api/v3/users/${login}")
val html_url = ApiPath(s"/${login}")
val avatar_url = ApiPath(s"/${login}/_avatar")
// val followers_url = ApiPath(s"/api/v3/users/${login}/followers")
// val following_url = ApiPath(s"/api/v3/users/${login}/following{/other_user}")
// val gists_url = ApiPath(s"/api/v3/users/${login}/gists{/gist_id}")

View File

@@ -7,7 +7,7 @@ import gitbucket.core.service.PullRequestService._
import gitbucket.core.service._
import gitbucket.core.util.ControlUtil._
import gitbucket.core.util.Directory._
import gitbucket.core.util.JGitUtil.CommitInfo
import gitbucket.core.util.JGitUtil.{CommitInfo, getFileList, getBranches, getDefaultBranch}
import gitbucket.core.util._
import gitbucket.core.util.Implicits._
import org.eclipse.jgit.api.Git
@@ -54,14 +54,92 @@ trait ApiControllerBase extends ControllerBase {
with CollaboratorsAuthenticator =>
/**
* https://developer.github.com/v3/users/#get-a-single-user
*/
get("/api/v3/users/:userName") {
getAccountByUserName(params("userName")).map { account =>
* https://developer.github.com/v3/#root-endpoint
*/
get("/api/v3/") {
JsonFormat(ApiEndPoint())
}
/**
* https://developer.github.com/v3/orgs/#get-an-organization
*/
get("/api/v3/orgs/:groupName") {
getAccountByUserName(params("groupName")).filter(account => account.isGroupAccount).map { account =>
JsonFormat(ApiUser(account))
} getOrElse NotFound
}
/**
* https://developer.github.com/v3/users/#get-a-single-user
*/
get("/api/v3/users/:userName") {
getAccountByUserName(params("userName")).filterNot(account => account.isGroupAccount).map { account =>
JsonFormat(ApiUser(account))
} getOrElse NotFound
}
/**
* https://developer.github.com/v3/repos/#list-organization-repositories
*/
get("/api/v3/orgs/:orgName/repos") {
JsonFormat(getVisibleRepositories(context.loginAccount, Some(params("orgName"))).map{ r => ApiRepository(r, getAccountByUserName(r.owner).get)})
}
/**
* https://developer.github.com/v3/repos/#list-user-repositories
*/
get("/api/v3/users/:userName/repos") {
JsonFormat(getVisibleRepositories(context.loginAccount, Some(params("userName"))).map{ r => ApiRepository(r, getAccountByUserName(r.owner).get)})
}
/*
* https://developer.github.com/v3/repos/branches/#list-branches
*/
get ("/api/v3/repos/:owner/:repo/branches")(referrersOnly { repository =>
JsonFormat(JGitUtil.getBranches(
owner = repository.owner,
name = repository.name,
defaultBranch = repository.repository.defaultBranch,
origin = repository.repository.originUserName.isEmpty
).map { br =>
ApiBranchForList(br.name, ApiBranchCommit(br.commitId))
})
})
/*
* https://developer.github.com/v3/repos/contents/#get-contents
*/
get("/api/v3/repos/:owner/:repo/contents/*")(referrersOnly { repository =>
val (id, path) = repository.splitPath(multiParams("splat").head)
val refStr = params("ref")
using(Git.open(getRepositoryDir(params("owner"), params("repo")))){ git =>
if (path.isEmpty) {
JsonFormat(getFileList(git, refStr, ".").map{f => ApiContents(f)})
} else {
JsonFormat(getFileList(git, refStr, path).map{f => ApiContents(f)})
}
}
})
/*
* https://developer.github.com/v3/git/refs/#get-a-reference
*/
get("/api/v3/repos/:owner/:repo/git/*") (referrersOnly { repository =>
val revstr = multiParams("splat").head
using(Git.open(getRepositoryDir(params("owner"), params("repo")))) { git =>
//JsonFormat( (revstr, git.getRepository().resolve(revstr)) )
// getRef is deprecated by jgit-4.2. use exactRef() or findRef()
val sha = git.getRepository().getRef(revstr).getObjectId().name()
JsonFormat(ApiRef(revstr, ApiObject(sha)))
}
})
/**
* https://developer.github.com/v3/repos/collaborators/#list-collaborators
*/
get("/api/v3/repos/:owner/:repo/collaborators") (referrersOnly { repository =>
JsonFormat(getCollaborators(params("owner"), params("repo")).map(u => ApiUser(getAccountByUserName(u).get)))
})
/**
* https://developer.github.com/v3/users/#get-the-authenticated-user
*/
@@ -71,6 +149,16 @@ trait ApiControllerBase extends ControllerBase {
} getOrElse Unauthorized
}
/**
* List user's own repository
* https://developer.github.com/v3/repos/#list-your-repositories
*/
get("/api/v3/user/repos")(usersOnly{
JsonFormat(getVisibleRepositories(context.loginAccount, Option(context.loginAccount.get.userName)).map{
r => ApiRepository(r, getAccountByUserName(r.owner).get)
})
})
/**
* Create user repository
* https://developer.github.com/v3/repos/#create

View File

@@ -204,8 +204,7 @@ trait IssuesControllerBase extends ControllerBase {
getIssue(repository.owner, repository.name, params("id")) map { x =>
if(isEditable(x.userName, x.repositoryName, x.openedUserName)){
params.get("dataType") collect {
case t if t == "html" => html.editissue(
x.content, x.issueId, x.userName, x.repositoryName)
case t if t == "html" => html.editissue(x.content, x.issueId, repository)
} getOrElse {
contentType = formats("json")
org.json4s.jackson.Serialization.write(
@@ -232,8 +231,7 @@ trait IssuesControllerBase extends ControllerBase {
getComment(repository.owner, repository.name, params("id")) map { x =>
if(isEditable(x.userName, x.repositoryName, x.commentedUserName)){
params.get("dataType") collect {
case t if t == "html" => html.editcomment(
x.content, x.commentId, x.userName, x.repositoryName)
case t if t == "html" => html.editcomment(x.content, x.commentId, repository)
} getOrElse {
contentType = formats("json")
org.json4s.jackson.Serialization.write(

View File

@@ -125,7 +125,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
* Displays the file list of the specified path and branch.
*/
get("/:owner/:repository/tree/*")(referrersOnly { repository =>
val (id, path) = splitPath(repository, multiParams("splat").head)
val (id, path) = repository.splitPath(multiParams("splat").head)
if(path.isEmpty){
fileList(repository, id)
} else {
@@ -137,7 +137,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
* Displays the commit list of the specified resource.
*/
get("/:owner/:repository/commits/*")(referrersOnly { repository =>
val (branchName, path) = splitPath(repository, multiParams("splat").head)
val (branchName, path) = repository.splitPath(multiParams("splat").head)
val page = params.get("page").flatMap(_.toIntOpt).getOrElse(1)
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
@@ -153,7 +153,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
})
get("/:owner/:repository/new/*")(collaboratorsOnly { repository =>
val (branch, path) = splitPath(repository, multiParams("splat").head)
val (branch, path) = repository.splitPath(multiParams("splat").head)
val protectedBranch = getProtectedBranchInfo(repository.owner, repository.name, branch).needStatusCheck(context.loginAccount.get.userName)
html.editor(branch, repository, if(path.length == 0) Nil else path.split("/").toList,
None, JGitUtil.ContentInfo("text", None, Some("UTF-8")),
@@ -161,7 +161,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
})
get("/:owner/:repository/edit/*")(collaboratorsOnly { repository =>
val (branch, path) = splitPath(repository, multiParams("splat").head)
val (branch, path) = repository.splitPath(multiParams("splat").head)
val protectedBranch = getProtectedBranchInfo(repository.owner, repository.name, branch).needStatusCheck(context.loginAccount.get.userName)
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
@@ -177,7 +177,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
})
get("/:owner/:repository/remove/*")(collaboratorsOnly { repository =>
val (branch, path) = splitPath(repository, multiParams("splat").head)
val (branch, path) = repository.splitPath(multiParams("splat").head)
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(branch))
@@ -235,7 +235,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
})
get("/:owner/:repository/raw/*")(referrersOnly { repository =>
val (id, path) = splitPath(repository, multiParams("splat").head)
val (id, path) = repository.splitPath(multiParams("splat").head)
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(id))
getPathObjectId(git, path, revCommit).flatMap { objectId =>
@@ -253,7 +253,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
* Displays the file content of the specified branch or commit.
*/
val blobRoute = get("/:owner/:repository/blob/*")(referrersOnly { repository =>
val (id, path) = splitPath(repository, multiParams("splat").head)
val (id, path) = repository.splitPath(multiParams("splat").head)
val raw = params.get("raw").getOrElse("false").toBoolean
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(id))
@@ -285,7 +285,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
* Blame data.
*/
ajaxGet("/:owner/:repository/get-blame/*")(referrersOnly { repository =>
val (id, path) = splitPath(repository, multiParams("splat").head)
val (id, path) = repository.splitPath(multiParams("splat").head)
contentType = formats("json")
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
val last = git.log.add(git.getRepository.resolve(id)).addPath(path).setMaxCount(1).call.iterator.next.name
@@ -376,8 +376,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
getCommitComment(repository.owner, repository.name, params("id")) map { x =>
if(isEditable(x.userName, x.repositoryName, x.commentedUserName)){
params.get("dataType") collect {
case t if t == "html" => html.editcomment(
x.content, x.commentId, x.userName, x.repositoryName)
case t if t == "html" => html.editcomment(x.content, x.commentId, repository)
} getOrElse {
contentType = formats("json")
org.json4s.jackson.Serialization.write(
@@ -527,17 +526,6 @@ trait RepositoryViewerControllerBase extends ControllerBase {
}
})
private def splitPath(repository: RepositoryService.RepositoryInfo, path: String): (String, String) = {
val id = repository.branchList.collectFirst {
case branch if(path == branch || path.startsWith(branch + "/")) => branch
} orElse repository.tags.collectFirst {
case tag if(path == tag.name || path.startsWith(tag.name + "/")) => tag.name
} getOrElse path.split("/")(0)
(id, path.substring(id.length).stripPrefix("/"))
}
private val readmeFiles = PluginRegistry().renderableExtensions.map { extension =>
s"readme.${extension}"
} ++ Seq("readme.txt", "readme")

View File

@@ -13,6 +13,7 @@ import gitbucket.core.util.ControlUtil._
import gitbucket.core.util.Directory._
import gitbucket.core.util.StringUtil._
import io.github.gitbucket.scalatra.forms._
import io.github.gitbucket.solidbase.manager.JDBCVersionManager
import org.apache.commons.io.{FileUtils, IOUtils}
import org.apache.commons.mail.{DefaultAuthenticator, HtmlEmail}
import org.scalatra.i18n.Messages
@@ -175,7 +176,11 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
})
get("/admin/plugins")(adminOnly {
html.plugins(PluginRegistry().getPlugins())
val manager = new JDBCVersionManager(request2Session(request).conn)
val plugins = PluginRegistry().getPlugins().map { plugin =>
(plugin, manager.getCurrentVersion(plugin.pluginId))
}
html.plugins(plugins)
})

View File

@@ -149,6 +149,36 @@ abstract class Plugin {
*/
def dashboardTabs(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Context) => Option[Link]] = Nil
/**
* Override to add assets mappings.
*/
val assetsMappings: Seq[(String, String)] = Nil
/**
* Override to add assets mappings.
*/
def assetsMappings(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, String)] = Nil
/**
* Override to add text decorators.
*/
val textDecorators: Seq[TextDecorator] = Nil
/**
* Override to add text decorators.
*/
def textDecorators(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[TextDecorator] = Nil
/**
* Override to add suggestion provider.
*/
val suggestionProviders: Seq[SuggestionProvider] = Nil
/**
* Override to add suggestion provider.
*/
def suggestionProviders(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[SuggestionProvider] = Nil
/**
* This method is invoked in initialization of plugin system.
* Register plugin functionality to PluginRegistry.
@@ -193,6 +223,15 @@ abstract class Plugin {
(dashboardTabs ++ dashboardTabs(registry, context, settings)).foreach { dashboardTab =>
registry.addDashboardTab(dashboardTab)
}
(assetsMappings ++ assetsMappings(registry, context, settings)).foreach { assetMapping =>
registry.addAssetsMapping((assetMapping._1, assetMapping._2, getClass.getClassLoader))
}
(textDecorators ++ textDecorators(registry, context, settings)).foreach { textDecorator =>
registry.addTextDecorator(textDecorator)
}
(suggestionProviders ++ suggestionProviders(registry, context, settings)).foreach { suggestionProvider =>
registry.addSuggestionProvider(suggestionProvider)
}
}
/**

View File

@@ -14,7 +14,6 @@ import gitbucket.core.util.DatabaseConfig
import gitbucket.core.util.Directory._
import io.github.gitbucket.solidbase.Solidbase
import io.github.gitbucket.solidbase.model.Module
import liquibase.database.core.H2Database
import org.apache.commons.codec.binary.{Base64, StringUtils}
import org.slf4j.LoggerFactory
@@ -42,10 +41,13 @@ class PluginRegistry {
private val systemSettingMenus = new ListBuffer[(Context) => Option[Link]]
private val accountSettingMenus = new ListBuffer[(Context) => Option[Link]]
private val dashboardTabs = new ListBuffer[(Context) => Option[Link]]
private val assetsMappings = new ListBuffer[(String, String, ClassLoader)]
private val textDecorators = new ListBuffer[TextDecorator]
def addPlugin(pluginInfo: PluginInfo): Unit = {
plugins += pluginInfo
}
private val suggestionProviders = new ListBuffer[SuggestionProvider]
suggestionProviders += new UserNameSuggestionProvider()
def addPlugin(pluginInfo: PluginInfo): Unit = plugins += pluginInfo
def getPlugins(): List[PluginInfo] = plugins.toList
@@ -66,42 +68,26 @@ class PluginRegistry {
def getImage(id: String): String = images(id)
def addController(path: String, controller: ControllerBase): Unit = {
controllers += ((controller, path))
}
def addController(path: String, controller: ControllerBase): Unit = controllers += ((controller, path))
@deprecated("Use addController(path: String, controller: ControllerBase) instead", "3.4.0")
def addController(controller: ControllerBase, path: String): Unit = {
addController(path, controller)
}
def addController(controller: ControllerBase, path: String): Unit = addController(path, controller)
def getControllers(): Seq[(ControllerBase, String)] = controllers.toSeq
def addJavaScript(path: String, script: String): Unit = {
javaScripts += ((path, script))
}
def addJavaScript(path: String, script: String): Unit = javaScripts += ((path, script))
def getJavaScript(currentPath: String): List[String] = {
javaScripts.filter(x => currentPath.matches(x._1)).toList.map(_._2)
}
def getJavaScript(currentPath: String): List[String] = javaScripts.filter(x => currentPath.matches(x._1)).toList.map(_._2)
def addRenderer(extension: String, renderer: Renderer): Unit = {
renderers += ((extension, renderer))
}
def addRenderer(extension: String, renderer: Renderer): Unit = renderers += ((extension, renderer))
def getRenderer(extension: String): Renderer = {
renderers.get(extension).getOrElse(DefaultRenderer)
}
def getRenderer(extension: String): Renderer = renderers.get(extension).getOrElse(DefaultRenderer)
def renderableExtensions: Seq[String] = renderers.keys.toSeq
def addRepositoryRouting(routing: GitRepositoryRouting): Unit = {
repositoryRoutings += routing
}
def addRepositoryRouting(routing: GitRepositoryRouting): Unit = repositoryRoutings += routing
def getRepositoryRoutings(): Seq[GitRepositoryRouting] = {
repositoryRoutings.toSeq
}
def getRepositoryRoutings(): Seq[GitRepositoryRouting] = repositoryRoutings.toSeq
def getRepositoryRouting(repositoryPath: String): Option[GitRepositoryRouting] = {
PluginRegistry().getRepositoryRoutings().find {
@@ -111,54 +97,49 @@ class PluginRegistry {
}
}
def addReceiveHook(commitHook: ReceiveHook): Unit = {
receiveHooks += commitHook
}
def addReceiveHook(commitHook: ReceiveHook): Unit = receiveHooks += commitHook
def getReceiveHooks: Seq[ReceiveHook] = receiveHooks.toSeq
def addGlobalMenu(globalMenu: (Context) => Option[Link]): Unit = {
globalMenus += globalMenu
}
def addGlobalMenu(globalMenu: (Context) => Option[Link]): Unit = globalMenus += globalMenu
def getGlobalMenus: Seq[(Context) => Option[Link]] = globalMenus.toSeq
def addRepositoryMenu(repositoryMenu: (RepositoryInfo, Context) => Option[Link]): Unit = {
repositoryMenus += repositoryMenu
}
def addRepositoryMenu(repositoryMenu: (RepositoryInfo, Context) => Option[Link]): Unit = repositoryMenus += repositoryMenu
def getRepositoryMenus: Seq[(RepositoryInfo, Context) => Option[Link]] = repositoryMenus.toSeq
def addRepositorySettingTab(repositorySettingTab: (RepositoryInfo, Context) => Option[Link]): Unit = {
repositorySettingTabs += repositorySettingTab
}
def addRepositorySettingTab(repositorySettingTab: (RepositoryInfo, Context) => Option[Link]): Unit = repositorySettingTabs += repositorySettingTab
def getRepositorySettingTabs: Seq[(RepositoryInfo, Context) => Option[Link]] = repositorySettingTabs.toSeq
def addProfileTab(profileTab: (Account, Context) => Option[Link]): Unit = {
profileTabs += profileTab
}
def addProfileTab(profileTab: (Account, Context) => Option[Link]): Unit = profileTabs += profileTab
def getProfileTabs: Seq[(Account, Context) => Option[Link]] = profileTabs.toSeq
def addSystemSettingMenu(systemSettingMenu: (Context) => Option[Link]): Unit = {
systemSettingMenus += systemSettingMenu
}
def addSystemSettingMenu(systemSettingMenu: (Context) => Option[Link]): Unit = systemSettingMenus += systemSettingMenu
def getSystemSettingMenus: Seq[(Context) => Option[Link]] = systemSettingMenus.toSeq
def addAccountSettingMenu(accountSettingMenu: (Context) => Option[Link]): Unit = {
accountSettingMenus += accountSettingMenu
}
def addAccountSettingMenu(accountSettingMenu: (Context) => Option[Link]): Unit = accountSettingMenus += accountSettingMenu
def getAccountSettingMenus: Seq[(Context) => Option[Link]] = accountSettingMenus.toSeq
def addDashboardTab(dashboardTab: (Context) => Option[Link]): Unit = {
dashboardTabs += dashboardTab
}
def addDashboardTab(dashboardTab: (Context) => Option[Link]): Unit = dashboardTabs += dashboardTab
def getDashboardTabs: Seq[(Context) => Option[Link]] = dashboardTabs.toSeq
def addAssetsMapping(assetsMapping: (String, String, ClassLoader)): Unit = assetsMappings += assetsMapping
def getAssetsMappings: Seq[(String, String, ClassLoader)] = assetsMappings.toSeq
def addTextDecorator(textDecorator: TextDecorator): Unit = textDecorators += textDecorator
def getTextDecorators: Seq[TextDecorator] = textDecorators.toSeq
def addSuggestionProvider(suggestionProvider: SuggestionProvider): Unit = suggestionProviders += suggestionProvider
def getSuggestionProviders: Seq[SuggestionProvider] = suggestionProviders.toSeq
}
/**
@@ -195,11 +176,11 @@ object PluginRegistry {
// Initialize
plugin.initialize(instance, context, settings)
instance.addPlugin(PluginInfo(
pluginId = plugin.pluginId,
pluginName = plugin.pluginName,
version = plugin.versions.head.getVersion,
description = plugin.description,
pluginClass = plugin
pluginId = plugin.pluginId,
pluginName = plugin.pluginName,
pluginVersion = plugin.versions.last.getVersion,
description = plugin.description,
pluginClass = plugin
))
} catch {
@@ -231,7 +212,7 @@ case class Link(id: String, label: String, path: String, icon: Option[String] =
case class PluginInfo(
pluginId: String,
pluginName: String,
version: String,
pluginVersion: String,
description: String,
pluginClass: Plugin
)

View File

@@ -0,0 +1,27 @@
package gitbucket.core.plugin
import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo
trait SuggestionProvider {
val id: String
val prefix: String
val suffix: String = " "
val context: Seq[String]
def values(repository: RepositoryInfo): Seq[String]
def template(implicit context: Context): String = "value"
def additionalScript(implicit context: Context): String = ""
}
class UserNameSuggestionProvider extends SuggestionProvider {
override val id: String = "user"
override val prefix: String = "@"
override val context: Seq[String] = Seq("issues")
override def values(repository: RepositoryInfo): Seq[String] = Nil
override def template(implicit context: Context): String = "'@' + value"
override def additionalScript(implicit context: Context): String =
s"""$$.get('${context.path}/_user/proposals', { query: '' }, function (data) { user = data.options; });"""
}

View File

@@ -0,0 +1,10 @@
package gitbucket.core.plugin
import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo
trait TextDecorator {
def decorate(text: String, repository: RepositoryInfo)(implicit context: Context): String
}

View File

@@ -420,6 +420,17 @@ object RepositoryService {
def httpUrl(implicit context: Context): String = RepositoryService.httpUrl(owner, name)
def sshUrl(implicit context: Context): Option[String] = RepositoryService.sshUrl(owner, name)
def splitPath(path: String): (String, String) = {
val id = branchList.collectFirst {
case branch if(path == branch || path.startsWith(branch + "/")) => branch
} orElse tags.collectFirst {
case tag if(path == tag.name || path.startsWith(tag.name + "/")) => tag.name
} getOrElse path.split("/")(0)
(id, path.substring(id.length).stripPrefix("/"))
}
}
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"

View File

@@ -1,6 +1,5 @@
package gitbucket.core.service
import java.io.ByteArrayInputStream
import fr.brouillard.oss.security.xhub.XHub
import fr.brouillard.oss.security.xhub.XHub.{XHubDigest, XHubConverter}
import gitbucket.core.api._
@@ -22,6 +21,7 @@ import org.apache.http.HttpRequest
import org.apache.http.HttpResponse
import gitbucket.core.model.WebHookContentType
import org.apache.http.client.entity.EntityBuilder
import org.apache.http.entity.ContentType
trait WebHookService {
@@ -118,7 +118,7 @@ trait WebHookService {
}
}
case WebHookContentType.JSON => {
httpPost.setEntity(EntityBuilder.create().setText(json).build())
httpPost.setEntity(EntityBuilder.create().setContentType(ContentType.APPLICATION_JSON).setText(json).build())
if (webHook.token.exists(_.trim.nonEmpty)) {
httpPost.addHeader("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, webHook.token.orNull, json.getBytes("UTF-8")))
}

View File

@@ -4,15 +4,14 @@ import javax.servlet._
import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
import gitbucket.core.model.Account
import gitbucket.core.service.AccessTokenService
import gitbucket.core.util.Keys
import gitbucket.core.service.SystemSettingsService.SystemSettings
import gitbucket.core.service.{AccessTokenService, AccountService, SystemSettingsService}
import gitbucket.core.util.{AuthUtil, Keys}
import org.scalatra.servlet.ServletApiImplicits._
import org.scalatra._
class AccessTokenAuthenticationFilter extends Filter with AccessTokenService {
private val tokenHeaderPrefix = "token "
class ApiAuthenticationFilter extends Filter with AccessTokenService with AccountService with SystemSettingsService {
override def init(filterConfig: FilterConfig): Unit = {}
@@ -23,9 +22,9 @@ class AccessTokenAuthenticationFilter extends Filter with AccessTokenService {
implicit val session = req.getAttribute(Keys.Request.DBSession).asInstanceOf[slick.jdbc.JdbcBackend#Session]
val response = res.asInstanceOf[HttpServletResponse]
Option(request.getHeader("Authorization")).map{
case auth if auth.startsWith("token ") => AccessTokenService.getAccountByAccessToken(auth.substring(6).trim).toRight(Unit)
// TODO Basic Authentication Support
case _ => Left(Unit)
case auth if auth.startsWith("token ") => AccessTokenService.getAccountByAccessToken(auth.substring(6).trim).toRight(())
case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(())
case _ => Left(())
}.orElse{
Option(request.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]).map(Right(_))
} match {
@@ -40,4 +39,10 @@ class AccessTokenAuthenticationFilter extends Filter with AccessTokenService {
}
}
}
def doBasicAuth(auth: String, settings: SystemSettings, request: HttpServletRequest): Option[Account] = {
implicit val session = request.getAttribute(Keys.Request.DBSession).asInstanceOf[slick.jdbc.JdbcBackend#Session]
val Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2)
authenticate(settings, username, password)
}
}

View File

@@ -5,16 +5,16 @@ import javax.servlet.http._
import gitbucket.core.plugin.{GitRepositoryFilter, GitRepositoryRouting, PluginRegistry}
import gitbucket.core.service.SystemSettingsService.SystemSettings
import gitbucket.core.service.{RepositoryService, AccountService, SystemSettingsService}
import gitbucket.core.util.{Keys, Implicits}
import gitbucket.core.util.{Keys, Implicits, AuthUtil}
import org.slf4j.LoggerFactory
import Implicits._
/**
* Provides BASIC Authentication for [[GitRepositoryServlet]].
*/
class BasicAuthenticationFilter extends Filter with RepositoryService with AccountService with SystemSettingsService {
class GitAuthenticationFilter extends Filter with RepositoryService with AccountService with SystemSettingsService {
private val logger = LoggerFactory.getLogger(classOf[BasicAuthenticationFilter])
private val logger = LoggerFactory.getLogger(classOf[GitAuthenticationFilter])
def init(config: FilterConfig) = {}
@@ -43,7 +43,7 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
} catch {
case ex: Exception => {
logger.error("error", ex)
requireAuth(response)
AuthUtil.requireAuth(response)
}
}
}
@@ -54,7 +54,7 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
val account = for {
auth <- Option(request.getHeader("Authorization"))
Array(username, password) = decodeAuthHeader(auth).split(":", 2)
Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2)
account <- authenticate(settings, username, password)
} yield {
request.setAttribute(Keys.Request.UserName, account.userName)
@@ -64,7 +64,7 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
if(filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)){
chain.doFilter(request, response)
} else {
requireAuth(response)
AuthUtil.requireAuth(response)
}
}
@@ -81,7 +81,7 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
} else {
val passed = for {
auth <- Option(request.getHeader("Authorization"))
Array(username, password) = decodeAuthHeader(auth).split(":", 2)
Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2)
account <- authenticate(settings, username, password)
} yield if(isUpdating || repository.repository.isPrivate){
if(hasWritePermission(repository.owner, repository.name, Some(account))){
@@ -93,7 +93,7 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
if(passed.getOrElse(false)){
chain.doFilter(request, response)
} else {
requireAuth(response)
AuthUtil.requireAuth(response)
}
}
}
@@ -108,17 +108,4 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
}
}
}
private def requireAuth(response: HttpServletResponse): Unit = {
response.setHeader("WWW-Authenticate", "BASIC realm=\"GitBucket\"")
response.sendError(HttpServletResponse.SC_UNAUTHORIZED)
}
private def decodeAuthHeader(header: String): String = {
try {
new String(new sun.misc.BASE64Decoder().decodeBuffer(header.substring(6)))
} catch {
case _: Throwable => ""
}
}
}

View File

@@ -27,7 +27,7 @@ import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
* Provides Git repository via HTTP.
*
* This servlet provides only Git repository functionality.
* Authentication is provided by [[BasicAuthenticationFilter]].
* Authentication is provided by [[GitAuthenticationFilter]].
*/
class GitRepositoryServlet extends GitServlet with SystemSettingsService {

View File

@@ -35,6 +35,7 @@ class InitializeListener extends ServletContextListener with SystemSettingsServi
Database() withTransaction { session =>
val conn = session.conn
val manager = new JDBCVersionManager(conn)
// Check version
val versionFile = new File(GitBucketHome, "version")
@@ -56,9 +57,8 @@ class InitializeListener extends ServletContextListener with SystemSettingsServi
}
// Change form
val manager = new JDBCVersionManager(conn)
manager.initialize()
manager.updateVersion(GitBucketCoreModule.getModuleId, "4.0")
manager.updateVersion(GitBucketCoreModule.getModuleId, "4.0.0")
conn.select("SELECT PLUGIN_ID, VERSION FROM PLUGIN"){ rs =>
manager.updateVersion(rs.getString("PLUGIN_ID"), rs.getString("VERSION"))
}
@@ -77,6 +77,13 @@ class InitializeListener extends ServletContextListener with SystemSettingsServi
val solidbase = new Solidbase()
solidbase.migrate(conn, Thread.currentThread.getContextClassLoader, DatabaseConfig.liquiDriver, GitBucketCoreModule)
// Rescue code for users who updated from 3.14 to 4.0.0
// https://github.com/gitbucket/gitbucket/issues/1227
val currentVersion = manager.getCurrentVersion(GitBucketCoreModule.getModuleId)
if(currentVersion == "4.0"){
manager.updateVersion(GitBucketCoreModule.getModuleId, "4.0.0")
}
// Load plugins
logger.info("Initialize plugins")
PluginRegistry.initialize(event.getServletContext, loadSystemSettings(), conn)

View File

@@ -0,0 +1,39 @@
package gitbucket.core.servlet
import javax.servlet.http.{HttpServlet, HttpServletRequest, HttpServletResponse}
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.util.FileUtil
import org.apache.commons.io.IOUtils
/**
* Supply assets which are provided by plugins.
*/
class PluginAssetsServlet extends HttpServlet {
override def doGet(req: HttpServletRequest, resp: HttpServletResponse): Unit = {
val assetsMappings = PluginRegistry().getAssetsMappings
val path = req.getRequestURI.substring(req.getContextPath.length)
assetsMappings
.find { case (prefix, _, _) => path.startsWith("/plugin-assets" + prefix) }
.flatMap { case (prefix, resourcePath, classLoader) =>
val resourceName = path.substring(("/plugin-assets" + prefix).length)
Option(classLoader.getResourceAsStream(resourcePath.replaceFirst("^/", "") + resourceName))
}
.map { in =>
try {
val bytes = IOUtils.toByteArray(in)
resp.setContentLength(bytes.length)
resp.setContentType(FileUtil.getContentType(path, bytes))
resp.getOutputStream.write(bytes)
} finally {
in.close()
}
}
.getOrElse {
resp.setStatus(404)
}
}
}

View File

@@ -0,0 +1,21 @@
package gitbucket.core.util
import javax.servlet.http.HttpServletResponse
/**
* Provides HTTP (Basic) Authentication related functions.
*/
object AuthUtil {
def requireAuth(response: HttpServletResponse): Unit = {
response.setHeader("WWW-Authenticate", "BASIC realm=\"GitBucket\"")
response.sendError(HttpServletResponse.SC_UNAUTHORIZED)
}
def decodeAuthHeader(header: String): String = {
try {
new String(new sun.misc.BASE64Decoder().decodeBuffer(header.substring(6)))
} catch {
case _: Throwable => ""
}
}
}

View File

@@ -4,6 +4,8 @@ import gitbucket.core.api.JsonFormat
import gitbucket.core.controller.Context
import gitbucket.core.servlet.Database
import java.util.regex.Pattern.quote
import javax.servlet.http.{HttpSession, HttpServletRequest}
import scala.util.matching.Regex
@@ -73,7 +75,7 @@ object Implicits {
def hasAttribute(name: String): Boolean = request.getAttribute(name) != null
def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^/git/", "/")
def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^" + quote(request.getContextPath) + "/git/", "/")
def baseUrl:String = {
val url = request.getRequestURL.toString

View File

@@ -44,7 +44,7 @@ object Markdown {
val renderer = new GitBucketMarkedRenderer(options, repository,
enableWikiLink, enableRefsLink, enableAnchor, enableTaskList, hasWritePermission, pages)
Marked.marked(source, options, renderer)
helpers.decorateHtml(Marked.marked(source, options, renderer), repository)
}
/**

View File

@@ -5,10 +5,10 @@ import java.util.{Date, Locale, TimeZone}
import gitbucket.core.controller.Context
import gitbucket.core.model.CommitState
import gitbucket.core.plugin.{RenderRequest, PluginRegistry}
import gitbucket.core.plugin.{PluginRegistry, RenderRequest}
import gitbucket.core.service.RepositoryService.RepositoryInfo
import gitbucket.core.service.{RepositoryService, RequestCache}
import gitbucket.core.util.{FileUtil, JGitUtil, StringUtil}
import play.twirl.api.{Html, HtmlFormat}
/**
@@ -151,7 +151,7 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
* Converts commit id, issue id and username to the link.
*/
def link(value: String, repository: RepositoryService.RepositoryInfo)(implicit context: Context): Html =
Html(convertRefsLinks(value, repository))
Html(decorateHtml(convertRefsLinks(value, repository), repository))
def cut(value: String, length: Int): String =
if(value.length > length){
@@ -316,10 +316,18 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
case CommitState.FAILURE => "Failed"
}
/**
* Render a given object as the JSON string.
*/
def json(obj: AnyRef): String = {
implicit val formats = org.json4s.DefaultFormats
org.json4s.jackson.Serialization.write(obj)
}
// This pattern comes from: http://stackoverflow.com/a/4390768/1771641 (extract-url-from-string)
private[this] val detectAndRenderLinksRegex = """(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,13}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""".r
def detectAndRenderLinks(text: String): Html = {
def detectAndRenderLinks(text: String, repository: RepositoryInfo)(implicit context: Context): String = {
val matches = detectAndRenderLinksRegex.findAllMatchIn(text).toSeq
val (x, pos) = matches.foldLeft((collection.immutable.Seq.empty[Html], 0)){ case ((x, pos), m) =>
@@ -333,6 +341,43 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
// append rest fragment
val out = if (pos < text.length) x :+ HtmlFormat.escape(text.substring(pos)) else x
HtmlFormat.fill(out)
decorateHtml(HtmlFormat.fill(out).toString, repository)
}
def decorateHtml(html: String, repository: RepositoryInfo)(implicit context: Context): String = {
PluginRegistry().getTextDecorators.foldLeft(html){ case (html, decorator) =>
val text = new StringBuilder()
val result = new StringBuilder()
var tag = false
html.foreach { c =>
c match {
case '<' if tag == false => {
tag = true
if(text.nonEmpty){
result.append(decorator.decorate(text.toString, repository))
text.setLength(0)
}
result.append(c)
}
case '>' if tag == true => {
tag = false
result.append(c)
}
case _ if tag == false => {
text.append(c)
}
case _ if tag == true => {
result.append(c)
}
}
}
if(text.nonEmpty){
result.append(decorator.decorate(text.toString, repository))
}
result.toString
}
}
}

View File

@@ -1,11 +1,10 @@
@(account: gitbucket.core.model.Account,
groupNames: List[String],
activities: List[gitbucket.core.model.Activity])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@main(account, groupNames, "activity"){
@import gitbucket.core.view.helpers
@gitbucket.core.account.html.main(account, groupNames, "activity"){
<div class="pull-right">
<a href="@path/@{account.userName}.atom"><img src="@assets/common/images/feed.png" alt="activities"></a>
<a href="@context.path/@{account.userName}.atom"><img src="@{helpers.assets}/common/images/feed.png" alt="activities"></a>
</div>
@helper.html.activities(activities)
@gitbucket.core.helper.html.activities(activities)
}

View File

@@ -1,11 +1,9 @@
@(account: gitbucket.core.model.Account,
personalTokens: List[gitbucket.core.model.AccessToken],
gneratedToken: Option[(gitbucket.core.model.AccessToken, String)])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Applications"){
@gitbucket.core.html.main("Applications"){
<div class="container body">
@menu("application", settings.ssh){
@gitbucket.core.account.html.menu("application", context.settings.ssh){
<div class="panel panel-default">
<div class="panel-heading strong">Personal access tokens</div>
<div class="panel-body">
@@ -15,13 +13,13 @@
Tokens you have generated that can be used to access the GitBucket API.
<hr style="margin-top: 10px;">
}
@gneratedToken.map{ case (token, tokenString) =>
@gneratedToken.map { case (token, tokenString) =>
<div class="alert alert-info">
Make sure to copy your new personal access token now. You won't be able to see it again!
</div>
<a href="@path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
<a href="@context.path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
<div style="width: 50%;">
@helper.html.copy("generated-token-copy", tokenString){
@gitbucket.core.helper.html.copy("generated-token-copy", tokenString){
<input type="text" value="@tokenString" class="form-control input-sm" readonly>
}
</div>
@@ -32,11 +30,11 @@
<hr>
}
<strong style="line-height: 30px;">@token.note</strong>
<a href="@path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
<a href="@context.path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
}
</div>
</div>
<form method="POST" action="@path/@account.userName/_personalToken" validate="true">
<form method="POST" action="@context.path/@account.userName/_personalToken" validate="true">
<div class="panel panel-default">
<div class="panel-heading strong">Generate new token</div>
<div class="panel-body">

View File

@@ -1,14 +1,13 @@
@(account: gitbucket.core.model.Account, info: Option[Any], error: Option[Any])(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.util.LDAPUtil
@import context._
@import gitbucket.core.view.helpers._
@html.main("Edit your profile"){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("Edit your profile"){
<div class="container body">
@menu("profile", settings.ssh){
@helper.html.information(info)
@helper.html.error(error)
@gitbucket.core.account.html.menu("profile", context.settings.ssh){
@gitbucket.core.helper.html.information(info)
@gitbucket.core.helper.html.error(error)
@if(LDAPUtil.isDummyMailAddress(account)){<div class="alert alert-danger">Please register your mail address.</div>}
<form action="@url(account.userName)/_edit" method="POST" validate="true">
<form action="@helpers.url(account.userName)/_edit" method="POST" validate="true">
<div class="panel panel-default">
<div class="panel-heading strong">Profile</div>
<div class="panel-body">
@@ -42,7 +41,7 @@
<div class="col-md-6">
<fieldset class="form-group">
<label for="avatar" class="strong">Image (optional):</label>
@helper.html.uploadavatar(Some(account))
@gitbucket.core.helper.html.uploadavatar(Some(account))
</fieldset>
</div>
</div>
@@ -50,10 +49,10 @@
</div>
<div>
<div class="pull-right">
<a href="@path/@account.userName/_delete" class="btn btn-danger" id="delete">Delete account</a>
<a href="@context.path/@account.userName/_delete" class="btn btn-danger" id="delete">Delete account</a>
</div>
<input type="submit" class="btn btn-success" value="Save"/>
@if(!LDAPUtil.isDummyMailAddress(account)){<a href="@url(account.userName)" class="btn btn-default">Cancel</a>}
@if(!LDAPUtil.isDummyMailAddress(account)){<a href="@helpers.url(account.userName)" class="btn btn-default">Cancel</a>}
</div>
</form>
}

View File

@@ -1,11 +1,10 @@
@(account: Option[gitbucket.core.model.Account], members: List[gitbucket.core.model.GroupMember])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(if(account.isEmpty) "Create group" else "Edit group"){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(if(account.isEmpty) "Create group" else "Edit group"){
<div class="content-wrapper main-center">
<div class="content body">
<h2>@{if(account.isEmpty) "Create group" else "Edit group"}</h2>
<form id="form" method="post" action="@if(account.isEmpty){@path/groups/new} else {@path/@account.get.userName/_editgroup}" validate="true">
<form id="form" method="post" action="@if(account.isEmpty){@context.path/groups/new} else {@context.path/@account.get.userName/_editgroup}" validate="true">
<div class="row">
<div class="col-md-5">
<fieldset class="form-group">
@@ -24,7 +23,7 @@
</fieldset>
<fieldset class="form-group">
<label for="avatar" class="strong">Image (Optional)</label>
@helper.html.uploadavatar(account)
@gitbucket.core.helper.html.uploadavatar(account)
</fieldset>
</div>
<div class="col-md-7">
@@ -32,7 +31,7 @@
<label class="strong">Members</label>
<ul id="member-list" class="collaborator">
</ul>
@helper.html.account("memberName", 200)
@gitbucket.core.helper.html.account("memberName", 200)
<input type="button" class="btn btn-default" value="Add" id="addMember"/>
<input type="hidden" id="members" name="members" value="@members.map(member => member.userName + ":" + member.isManager).mkString(",")"/>
<div>
@@ -44,12 +43,12 @@
<fieldset class="border-top">
@if(account.isDefined){
<div class="pull-right">
<a href="@url(account.get.userName)/_deletegroup" id="delete" class="btn btn-danger">Delete Group</a>
<a href="@helpers.url(account.get.userName)/_deletegroup" id="delete" class="btn btn-danger">Delete Group</a>
</div>
}
<input type="submit" class="btn btn-success" value="@if(account.isEmpty){Create Group} else {Update Group}"/>
@if(account.isDefined){
<a href="@url(account.get.userName)" class="btn btn-default">Cancel</a>
<a href="@helpers.url(account.get.userName)" class="btn btn-default">Cancel</a>
}
</fieldset>
</form>
@@ -81,7 +80,7 @@ $(function(){
}
// check existence
$.post('@path/_user/existence', {
$.post('@context.path/_user/existence', {
'userName': userName
}, function(data, status){
if(data == 'true'){
@@ -125,7 +124,7 @@ $(function(){
.append(memberButton)
.append(managerButton))
.append(' ')
.append($('<a>').attr('href', '@path/' + userName).text(userName))
.append($('<a>').attr('href', '@context.path/' + userName).text(userName))
.append(' ')
.append($('<a href="#" class="remove pull-right">(remove)</a>')));
}

View File

@@ -1,12 +1,11 @@
@(account: gitbucket.core.model.Account, groupNames: List[String], active: String,
isGroupManager: Boolean = false)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(account.userName){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(account.userName){
<div class="main-sidebar">
<div class="sidebar">
<div class="user-panel">
<div class="pull-left image">@avatar(account.userName, 40)</div>
<div class="pull-left image">@helpers.avatar(account.userName, 40)</div>
<div class="pull-left info">
<p>@account.userName</p>
@account.fullName
@@ -19,44 +18,44 @@
</p>
}
<p style="color: white;">
<i class="octicon octicon-clock"></i> Joined on @date(account.registeredDate)
<i class="octicon octicon-clock"></i> Joined on @helpers.date(account.registeredDate)
</p>
</div>
@if(groupNames.nonEmpty){
<ul class="sidebar-menu">
<li class="header">Groups</li>
@groupNames.map { groupName =>
<li>@avatarLink(groupName, 20, tooltip = true, label = true)</li>
<li>@helpers.avatarLink(groupName, 20, tooltip = true, label = true)</li>
}
</div>
</ul>
}
</div>
</div>
<div class="content-wrapper">
<div class="content body">
<ul class="nav nav-tabs" style="margin-bottom: 5px;">
<li@if(active == "repositories"){ class="active"}><a href="@url(account.userName)?tab=repositories">Repositories</a></li>
<li@if(active == "repositories"){ class="active"}><a href="@helpers.url(account.userName)?tab=repositories">Repositories</a></li>
@if(account.isGroupAccount){
<li@if(active == "members"){ class="active"}><a href="@url(account.userName)?tab=members">Members</a></li>
<li@if(active == "members"){ class="active"}><a href="@helpers.url(account.userName)?tab=members">Members</a></li>
} else {
<li@if(active == "activity"){ class="active"}><a href="@url(account.userName)?tab=activity">Public Activity</a></li>
<li@if(active == "activity"){ class="active"}><a href="@helpers.url(account.userName)?tab=activity">Public Activity</a></li>
}
@gitbucket.core.plugin.PluginRegistry().getProfileTabs.map { tab =>
@tab(account, context).map { link =>
<li@if(active == link.id){ class="active"}><a href="@path/@link.path">@link.label</a></li>
<li@if(active == link.id){ class="active"}><a href="@context.path/@link.path">@link.label</a></li>
}
}
@if(loginAccount.isDefined && loginAccount.get.userName == account.userName){
@if(context.loginAccount.isDefined && context.loginAccount.get.userName == account.userName){
<li class="pull-right">
<div class="button-group">
<a href="@url(account.userName)/_edit" class="btn btn-default">Edit Your Profile</a>
<a href="@helpers.url(account.userName)/_edit" class="btn btn-default">Edit Your Profile</a>
</div>
</li>
}
@if(loginAccount.isDefined && account.isGroupAccount && isGroupManager){
@if(context.loginAccount.isDefined && account.isGroupAccount && isGroupManager){
<li class="pull-right">
<div class="button-group">
<a href="@url(account.userName)/_editgroup" class="btn btn-default">Edit Group</a>
<a href="@helpers.url(account.userName)/_editgroup" class="btn btn-default">Edit Group</a>
</div>
</li>
}

View File

@@ -1,14 +1,13 @@
@(account: gitbucket.core.model.Account, members: List[String], isGroupManager: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@main(account, Nil, "members", isGroupManager){
@import gitbucket.core.view.helpers
@gitbucket.core.account.html.main(account, Nil, "members", isGroupManager){
@if(members.isEmpty){
No members
} else {
@members.map { userName =>
<div class="block">
<div class="block-header">
@avatar(userName, 20) <a href="@url(userName)">@userName</a>
@helpers.avatar(userName, 20) <a href="@helpers.url(userName)">@userName</a>
</div>
</div>
}

View File

@@ -1,23 +1,22 @@
@(active: String, ssh: Boolean)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
<div class="main-sidebar">
<div class="sidebar">
<ul class="sidebar-menu">
<li@if(active=="profile"){ class="active"}>
<a href="@path/@loginAccount.get.userName/_edit">Profile</a>
<a href="@context.path/@context.loginAccount.get.userName/_edit">Profile</a>
</li>
@if(ssh){
<li@if(active=="ssh"){ class="active"}>
<a href="@path/@loginAccount.get.userName/_ssh">SSH Keys</a>
<a href="@context.path/@context.loginAccount.get.userName/_ssh">SSH Keys</a>
</li>
}
<li@if(active=="application"){ class="active"}>
<a href="@path/@loginAccount.get.userName/_application">Applications</a>
<a href="@context.path/@context.loginAccount.get.userName/_application">Applications</a>
</li>
@gitbucket.core.plugin.PluginRegistry().getAccountSettingMenus.map { menu =>
@menu(context).map { link =>
<li@if(active==link.id){ class="active"}>
<a href="@path/@link.path">@link.label</a>
<a href="@context.path/@link.path">@link.label</a>
</li>
}
}

View File

@@ -1,31 +1,30 @@
@(groupNames: List[String],
isCreateRepoOptionPublic: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Create a New Repository"){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("Create a New Repository"){
<div class="content-wrapper main-center">
<div class="content body">
<h2>Create a new repository</h2>
<p class="muted">
A repository contains all the files for your project, including the revision history.
</p>
<form id="form" method="post" action="@path/new" validate="true">
<form id="form" method="post" action="@context.path/new" validate="true">
<fieldset class="border-top form-group">
<dl style="float: left;">
<dt>Owner</dt>
<dd style="margin-left: 0px;">
<div class="btn-group" id="owner-dropdown">
<button class="btn dropdown-toggle btn-default" data-toggle="dropdown">
<span class="strong">@avatar(loginAccount.get.userName, 20) @loginAccount.get.userName</span>
<span class="strong">@helpers.avatar(context.loginAccount.get.userName, 20) @context.loginAccount.get.userName</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0);" data-name="@loginAccount.get.userName"><i class="octicon octicon-check"></i> <span>@avatar(loginAccount.get.userName, 20) @loginAccount.get.userName</span></a></li>
<li><a href="javascript:void(0);" data-name="@context.loginAccount.get.userName"><i class="octicon octicon-check"></i> <span>@helpers.avatar(context.loginAccount.get.userName, 20) @context.loginAccount.get.userName</span></a></li>
@groupNames.map { groupName =>
<li><a href="javascript:void(0);" data-name="@groupName"><i class="octicon"></i> <span>@avatar(groupName, 20) @groupName</span></a></li>
<li><a href="javascript:void(0);" data-name="@groupName"><i class="octicon"></i> <span>@helpers.avatar(groupName, 20) @groupName</span></a></li>
}
</ul>
<input type="hidden" name="owner" id="owner" value="@loginAccount.get.userName"/>
<input type="hidden" name="owner" id="owner" value="@context.loginAccount.get.userName"/>
</div>
</dd>
</dl>

View File

@@ -1,11 +1,9 @@
@()(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Create your account"){
@gitbucket.core.html.main("Create your account"){
<div class="content-wrapper main-center">
<div class="content body">
<h2>Create your account</h2>
<form action="@path/register" method="POST" validate="true">
<form action="@context.path/register" method="POST" validate="true">
<div class="row">
<div class="col-md-6">
<fieldset>
@@ -39,7 +37,7 @@
<div class="col-md-6">
<fieldset>
<label for="avatar" class="strong">Image (optional):</label>
@helper.html.uploadavatar(None)
@gitbucket.core.helper.html.uploadavatar(None)
</fieldset>
</div>
</div>

View File

@@ -1,31 +1,30 @@
@(account: gitbucket.core.model.Account, groupNames: List[String],
repositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
isGroupManager: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@main(account, groupNames, "repositories", isGroupManager){
@import gitbucket.core.view.helpers
@gitbucket.core.account.html.main(account, groupNames, "repositories", isGroupManager){
@if(repositories.isEmpty){
No repositories
} else {
@repositories.map { repository =>
<div class="block">
<div class="repository-icon">
@helper.html.repositoryicon(repository, true)
@gitbucket.core.helper.html.repositoryicon(repository, true)
</div>
<div class="repository-content">
<div class="block-header">
<a href="@url(repository)">@repository.name</a>
<a href="@helpers.url(repository)">@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="@path/@repository.repository.parentUserName/@repository.repository.parentRepositoryName">@repository.repository.parentUserName/@repository.repository.parentRepositoryName</a></div>
<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 @helper.html.datetimeago(repository.repository.lastActivityDate)</span></div>
<div><span class="muted small">Updated @gitbucket.core.helper.html.datetimeago(repository.repository.lastActivityDate)</span></div>
</div>
</div>
}

View File

@@ -1,10 +1,8 @@
@(account: gitbucket.core.model.Account, sshKeys: List[gitbucket.core.model.SshKey])(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.ssh.SshUtil
@import context._
@import gitbucket.core.view.helpers._
@html.main("SSH Keys"){
@gitbucket.core.html.main("SSH Keys"){
<div class="container body">
@menu("ssh", settings.ssh){
@gitbucket.core.account.html.menu("ssh", context.settings.ssh){
<div class="panel panel-default">
<div class="panel-heading strong">SSH Keys</div>
<div class="panel-body">
@@ -16,11 +14,11 @@
<hr>
}
<strong style="line-height: 30px;">@key.title</strong> (@SshUtil.fingerPrint(key.publicKey).getOrElse("Key is invalid."))
<a href="@path/@account.userName/_ssh/delete/@key.sshKeyId" class="btn btn-sm btn-danger pull-right">Delete</a>
<a href="@context.path/@account.userName/_ssh/delete/@key.sshKeyId" class="btn btn-sm btn-danger pull-right">Delete</a>
}
</div>
</div>
<form method="POST" action="@path/@account.userName/_ssh" validate="true">
<form method="POST" action="@context.path/@account.userName/_ssh" validate="true">
<div class="panel panel-default">
<div class="panel-heading strong">Add an SSH Key</div>
<div class="panel-body">

View File

@@ -1,12 +1,10 @@
@(tableNames: Seq[String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Data export / import"){
@admin.html.menu("data") {
@gitbucket.core.html.main("Data export / import"){
@gitbucket.core.admin.html.menu("data") {
<div class="panel panel-default">
<div class="panel-heading strong">Export</div>
<div class="panel-body">
<form class="form form-horizontal" action="@path/admin/export" method="POST">
<form class="form form-horizontal" action="@context.path/admin/export" method="POST">
@tableNames.map { tableName =>
<div class="checkbox">
<label>
@@ -32,7 +30,7 @@
<div class="panel panel-default">
<div class="panel-heading strong">Import (only XML)</div>
<div class="panel-body">
<form class="form form-horizontal" action="@path/upload/import" method="POST" enctype="multipart/form-data" id="import-form">
<form class="form form-horizontal" action="@context.path/upload/import" method="POST" enctype="multipart/form-data" id="import-form">
<input type="file" name="file" id="file">
<input type="submit" class="btn btn-success pull-right" value="Import" id="import">
</form>

View File

@@ -1,27 +1,26 @@
@(active: String)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
<div class="main-sidebar">
<div class="sidebar">
<ul class="sidebar-menu" id="system-admin-menu-container">
<li@if(active=="users"){ class="active"}>
<a href="@path/admin/users">User Management</a>
<a href="@context.path/admin/users">User Management</a>
</li>
<li@if(active=="system"){ class="active"}>
<a href="@path/admin/system">System Settings</a>
<a href="@context.path/admin/system">System Settings</a>
</li>
<li@if(active=="plugins"){ class="active"}>
<a href="@path/admin/plugins">Plugins</a>
<a href="@context.path/admin/plugins">Plugins</a>
</li>
<li@if(active=="data"){ class="active"}>
<a href="@path/admin/data">Data export / import</a>
<a href="@context.path/admin/data">Data export / import</a>
</li>
<li>
<a href="@path/console/login.jsp" target="_blank">H2 Console</a>
<a href="@context.path/console/login.jsp" target="_blank">H2 Console</a>
</li>
@gitbucket.core.plugin.PluginRegistry().getSystemSettingMenus.map { menu =>
@menu(context).map { link =>
<li@if(active==link.id){ class="active"}>
<a href="@path/@link.path">@link.label</a>
<a href="@context.path/@link.path">@link.label</a>
</li>
}
}

View File

@@ -1,18 +1,16 @@
@(plugins: List[gitbucket.core.plugin.PluginInfo])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Plugins"){
@admin.html.menu("plugins") {
@(plugins: List[(gitbucket.core.plugin.PluginInfo, String)])(implicit context: gitbucket.core.controller.Context)
@gitbucket.core.html.main("Plugins"){
@gitbucket.core.admin.html.menu("plugins") {
<h1>Installed plugins</h1>
@if(plugins.size > 0) {
<ul>
@plugins.map {plugin =>
<li><a href="#@plugin.pluginId">@plugin.pluginId:@plugin.version</a></li>
@plugins.map { case (plugin, migrationVersion) =>
<li><a href="#@plugin.pluginId">@plugin.pluginId:@migrationVersion</a></li>
}
</ul>
@plugins.map {plugin =>
@plugins.map { case (plugin, migrationVersion) =>
<div class="panel panel-default">
<div class="panel-heading strong">@plugin.pluginName</div>
<div class="panel-body">
@@ -22,7 +20,7 @@
</div>
<div class="row">
<label class="col-md-2">Version</label>
<span class="col-md-10">@plugin.version</span>
<span class="col-md-10">@migrationVersion @if(plugin.pluginVersion != migrationVersion){ <span class="error">(Migration is failed, installed version is @plugin.pluginVersion)</span> }</span>
</div>
<div class="row">
<label class="col-md-2">Name</label>

View File

@@ -1,11 +1,8 @@
@(info: Option[Any])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.util.Directory._
@html.main("System Settings"){
@menu("system"){
@helper.html.information(info)
<form action="@path/admin/system" method="POST" validate="true" class="form-horizontal">
@gitbucket.core.html.main("System Settings"){
@gitbucket.core.admin.html.menu("system"){
@gitbucket.core.helper.html.information(info)
<form action="@context.path/admin/system" method="POST" validate="true" class="form-horizontal">
<div class="panel panel-default">
<div class="panel-heading strong">System Settings</div>
<div class="panel-body">
@@ -19,7 +16,7 @@
</tr>
<tr>
<td>GITBUCKET_HOME</td>
<td>@GitBucketHome</td>
<td>@gitbucket.core.util.Directory.GitBucketHome</td>
</tr>
<tr>
<td>DATABASE_URL</td>
@@ -33,7 +30,7 @@
<label><span class="strong">Base URL</span> (e.g. <code>http://example.com/gitbucket</code>)</label>
<fieldset>
<div class="controls">
<input type="text" name="baseUrl" id="baseUrl" class="form-control" value="@settings.baseUrl"/>
<input type="text" name="baseUrl" id="baseUrl" class="form-control" value="@context.settings.baseUrl"/>
<span id="error-baseUrl" class="error"></span>
</div>
</fieldset>
@@ -48,7 +45,7 @@
<hr>
<label><span class="strong">Information</span> (HTML is available)</label>
<fieldset>
<textarea name="information" class="form-control" style="height: 100px;">@settings.information</textarea>
<textarea name="information" class="form-control" style="height: 100px;">@context.settings.information</textarea>
</fieldset>
<!--====================================================================-->
<!-- Account registration -->
@@ -57,11 +54,11 @@
<label class="strong">Account registration</label>
<fieldset>
<label class="radio">
<input type="radio" name="allowAccountRegistration" value="true"@if(settings.allowAccountRegistration){ checked}>
<input type="radio" name="allowAccountRegistration" value="true"@if(context.settings.allowAccountRegistration){ checked}>
<span class="strong">Allow</span> <span class="normal">- Users can create accounts by themselves.</span>
</label>
<label class="radio">
<input type="radio" name="allowAccountRegistration" value="false"@if(!settings.allowAccountRegistration){ checked}>
<input type="radio" name="allowAccountRegistration" value="false"@if(!context.settings.allowAccountRegistration){ checked}>
<span class="strong">Deny</span> - <span class="normal">Only administrators can create accounts.</span>
</label>
</fieldset>
@@ -69,11 +66,11 @@
<label class="strong">Default option to create a new repository</label>
<fieldset>
<label class="radio">
<input type="radio" name="isCreateRepoOptionPublic" value="true"@if(settings.isCreateRepoOptionPublic){ checked}>
<input type="radio" name="isCreateRepoOptionPublic" value="true"@if(context.settings.isCreateRepoOptionPublic){ checked}>
<span class="strong">Public</span> <span class="normal">- All users and guests can read that repository.</span>
</label>
<label class="radio">
<input type="radio" name="isCreateRepoOptionPublic" value="false"@if(!settings.isCreateRepoOptionPublic){ checked}>
<input type="radio" name="isCreateRepoOptionPublic" value="false"@if(!context.settings.isCreateRepoOptionPublic){ checked}>
<span class="strong">Private</span> <span class="normal">- Only collaborators can read that repository.</span>
</label>
</fieldset>
@@ -84,11 +81,11 @@
<label class="strong">Anonymous access</label>
<fieldset>
<label class="radio">
<input type="radio" name="allowAnonymousAccess" value="true"@if(settings.allowAnonymousAccess){ checked}>
<input type="radio" name="allowAnonymousAccess" value="true"@if(context.settings.allowAnonymousAccess){ checked}>
<span class="strong">Allow</span> <span class="normal">- Anyone can view public repositories, user/group profiles.</span>
</label>
<label class="radio">
<input type="radio" name="allowAnonymousAccess" value="false"@if(!settings.allowAnonymousAccess){ checked}>
<input type="radio" name="allowAnonymousAccess" value="false"@if(!context.settings.allowAnonymousAccess){ checked}>
<span class="strong">Deny</span> <span class="normal">- Users must authenticate before viewing any information.</span>
</label>
</fieldset>
@@ -101,7 +98,7 @@
<div class="form-group">
<label class="control-label col-md-3" for="activityLogLimit">Limit</label>
<div class="col-md-9">
<input type="text" id="activityLogLimit" name="activityLogLimit" class="form-control input-mini" value="@settings.activityLogLimit"/>
<input type="text" id="activityLogLimit" name="activityLogLimit" class="form-control input-mini" value="@context.settings.activityLogLimit"/>
<span id="error-activityLogLimit" class="error"></span>
</div>
</div>
@@ -113,7 +110,7 @@
<label class="strong">Services</label>
<fieldset>
<label class="checkbox">
<input type="checkbox" name="gravatar"@if(settings.gravatar){ checked}/>
<input type="checkbox" name="gravatar"@if(context.settings.gravatar){ checked}/>
Use Gravatar for Profile-Images
</label>
</fieldset>
@@ -124,7 +121,7 @@
<label class="strong">SSH access</label>
<fieldset>
<label class="checkbox">
<input type="checkbox" id="ssh" name="ssh"@if(settings.ssh){ checked}/>
<input type="checkbox" id="ssh" name="ssh"@if(context.settings.ssh){ checked}/>
Enable SSH access to git repository
</label>
</fieldset>
@@ -132,14 +129,14 @@
<div class="form-group">
<label class="control-label col-md-3" for="sshHost">SSH Host</label>
<div class="col-md-9">
<input type="text" id="sshHost" name="sshHost" class="form-control" value="@settings.sshHost"/>
<input type="text" id="sshHost" name="sshHost" class="form-control" value="@context.settings.sshHost"/>
<span id="error-sshHost" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="sshPort">SSH Port</label>
<div class="col-md-9">
<input type="text" id="sshPort" name="sshPort" class="form-control" value="@settings.sshPort"/>
<input type="text" id="sshPort" name="sshPort" class="form-control" value="@context.settings.sshPort"/>
<span id="error-sshPort" class="error"></span>
</div>
</div>
@@ -154,7 +151,7 @@
<label class="strong">Authentication</label>
<fieldset>
<label class="checkbox">
<input type="checkbox" id="ldapAuthentication" name="ldapAuthentication"@if(settings.ldap){ checked} />
<input type="checkbox" id="ldapAuthentication" name="ldapAuthentication"@if(context.settings.ldap){ checked} />
LDAP
</label>
</fieldset>
@@ -162,82 +159,82 @@
<div class="form-group">
<label class="control-label col-md-3" for="ldapHost">LDAP Host</label>
<div class="col-md-9">
<input type="text" id="ldapHost" name="ldap.host" class="form-control" value="@settings.ldap.map(_.host)"/>
<input type="text" id="ldapHost" name="ldap.host" class="form-control" value="@context.settings.ldap.map(_.host)"/>
<span id="error-ldap_host" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapPort">LDAP Port</label>
<div class="col-md-9">
<input type="text" id="ldapPort" name="ldap.port" class="form-control input-mini" value="@settings.ldap.map(_.port)"/>
<input type="text" id="ldapPort" name="ldap.port" class="form-control input-mini" value="@context.settings.ldap.map(_.port)"/>
<span id="error-ldap_port" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapBindDN">Bind DN</label>
<div class="col-md-9">
<input type="text" id="ldapBindDN" name="ldap.bindDN" class="form-control" value="@settings.ldap.map(_.bindDN)"/>
<input type="text" id="ldapBindDN" name="ldap.bindDN" class="form-control" value="@context.settings.ldap.map(_.bindDN)"/>
<span id="error-ldap_bindDN" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapBindPassword">Bind Password</label>
<div class="col-md-9">
<input type="password" id="ldapBindPassword" name="ldap.bindPassword" class="form-control" value="@settings.ldap.map(_.bindPassword)"/>
<input type="password" id="ldapBindPassword" name="ldap.bindPassword" class="form-control" value="@context.settings.ldap.map(_.bindPassword)"/>
<span id="error-ldap_bindPassword" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapBaseDN">Base DN</label>
<div class="col-md-9">
<input type="text" id="ldapBaseDN" name="ldap.baseDN" class="form-control" value="@settings.ldap.map(_.baseDN)"/>
<input type="text" id="ldapBaseDN" name="ldap.baseDN" class="form-control" value="@context.settings.ldap.map(_.baseDN)"/>
<span id="error-ldap_baseDN" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapUserNameAttribute">User name attribute</label>
<div class="col-md-9">
<input type="text" id="ldapUserNameAttribute" name="ldap.userNameAttribute" class="form-control" value="@settings.ldap.map(_.userNameAttribute)"/>
<input type="text" id="ldapUserNameAttribute" name="ldap.userNameAttribute" class="form-control" value="@context.settings.ldap.map(_.userNameAttribute)"/>
<span id="error-ldap_userNameAttribute" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapAdditionalFilterCondition">Additional filter condition</label>
<div class="col-md-9">
<input type="text" id="ldapAdditionalFilterCondition" name="ldap.additionalFilterCondition" class="form-control" value="@settings.ldap.map(_.additionalFilterCondition)"/>
<input type="text" id="ldapAdditionalFilterCondition" name="ldap.additionalFilterCondition" class="form-control" value="@context.settings.ldap.map(_.additionalFilterCondition)"/>
<span id="error-ldap_additionalFilterCondition" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapFullNameAttribute">Full name attribute</label>
<div class="col-md-9">
<input type="text" id="ldapFullNameAttribute" name="ldap.fullNameAttribute" class="form-control" value="@settings.ldap.map(_.fullNameAttribute)"/>
<input type="text" id="ldapFullNameAttribute" name="ldap.fullNameAttribute" class="form-control" value="@context.settings.ldap.map(_.fullNameAttribute)"/>
<span id="error-ldap_fullNameAttribute" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapMailAttribute">Mail address attribute</label>
<div class="col-md-9">
<input type="text" id="ldapMailAttribute" name="ldap.mailAttribute" class="form-control" value="@settings.ldap.map(_.mailAttribute)"/>
<input type="text" id="ldapMailAttribute" name="ldap.mailAttribute" class="form-control" value="@context.settings.ldap.map(_.mailAttribute)"/>
<span id="error-ldap_mailAttribute" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Enable TLS</label>
<div class="col-md-9">
<input type="checkbox" name="ldap.tls"@if(settings.ldap.flatMap(_.tls).getOrElse(false)){ checked}/>
<input type="checkbox" name="ldap.tls"@if(context.settings.ldap.flatMap(_.tls).getOrElse(false)){ checked}/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Enable SSL</label>
<div class="col-md-9">
<input type="checkbox" name="ldap.ssl"@if(settings.ldap.flatMap(_.ssl).getOrElse(false)){ checked}/>
<input type="checkbox" name="ldap.ssl"@if(context.settings.ldap.flatMap(_.ssl).getOrElse(false)){ checked}/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="ldapBindDN">Keystore</label>
<div class="col-md-9">
<input type="text" id="ldapKeystore" name="ldap.keystore" class="form-control" value="@settings.ldap.map(_.keystore)"/>
<input type="text" id="ldapKeystore" name="ldap.keystore" class="form-control" value="@context.settings.ldap.map(_.keystore)"/>
<span id="error-ldap_keystore" class="error"></span>
</div>
</div>
@@ -249,7 +246,7 @@
<label class="strong">Notifications</label>
<fieldset>
<label class="checkbox">
<input type="checkbox" id="notification" name="notification"@if(settings.notification){ checked}/>
<input type="checkbox" id="notification" name="notification"@if(context.settings.notification){ checked}/>
Send notifications
</label>
</fieldset>
@@ -260,7 +257,7 @@
<label class="strong">Communication</label>
<fieldset>
<label class="checkbox">
<input type="checkbox" id="useSMTP" name="useSMTP" @if(settings.useSMTP){ checked}/>
<input type="checkbox" id="useSMTP" name="useSMTP" @if(context.settings.useSMTP){ checked}/>
SMTP
</label>
</fieldset>
@@ -268,45 +265,45 @@
<div class="form-group">
<label class="control-label col-md-3" for="smtpHost">SMTP Host</label>
<div class="col-md-9">
<input type="text" id="smtpHost" name="smtp.host" class="form-control" value="@settings.smtp.map(_.host)"/>
<input type="text" id="smtpHost" name="smtp.host" class="form-control" value="@context.settings.smtp.map(_.host)"/>
<span id="error-smtp_host" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="smtpPort">SMTP Port</label>
<div class="col-md-9">
<input type="text" id="smtpPort" name="smtp.port" class="form-control input-mini" value="@settings.smtp.map(_.port)"/>
<input type="text" id="smtpPort" name="smtp.port" class="form-control input-mini" value="@context.settings.smtp.map(_.port)"/>
<span id="error-smtp_port" class="error"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="smtpUser">SMTP User</label>
<div class="col-md-9">
<input type="text" id="smtpUser" name="smtp.user" class="form-control" value="@settings.smtp.map(_.user)"/>
<input type="text" id="smtpUser" name="smtp.user" class="form-control" value="@context.settings.smtp.map(_.user)"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="smtpPassword">SMTP Password</label>
<div class="col-md-9">
<input type="password" id="smtpPassword" name="smtp.password" class="form-control" value="@settings.smtp.map(_.password)"/>
<input type="password" id="smtpPassword" name="smtp.password" class="form-control" value="@context.settings.smtp.map(_.password)"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="smtpPassword">Enable SSL</label>
<div class="col-md-9">
<input type="checkbox" id="smtpSsl" name="smtp.ssl"@if(settings.smtp.flatMap(_.ssl).getOrElse(false)){ checked}/>
<input type="checkbox" id="smtpSsl" name="smtp.ssl"@if(context.settings.smtp.flatMap(_.ssl).getOrElse(false)){ checked}/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="fromAddress">FROM Address</label>
<div class="col-md-9">
<input type="text" id="fromAddress" name="smtp.fromAddress" class="form-control" value="@settings.smtp.map(_.fromAddress)"/>
<input type="text" id="fromAddress" name="smtp.fromAddress" class="form-control" value="@context.settings.smtp.map(_.fromAddress)"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3" for="fromName">FROM Name</label>
<div class="col-md-9">
<input type="text" id="fromName" name="smtp.fromName" class="form-control" value="@settings.smtp.map(_.fromName)"/>
<input type="text" id="fromName" name="smtp.fromName" class="form-control" value="@context.settings.smtp.map(_.fromName)"/>
</div>
</div>
<div class="text-right">
@@ -346,7 +343,7 @@ $(function(){
alert('Destination is required.');
$('#testAddress').focus();
} else {
$.post('@path/admin/system/sendmail', {
$.post('@context.path/admin/system/sendmail', {
'smtp.host': host,
'smtp.port': port,
'smtp.user': user,

View File

@@ -1,9 +1,8 @@
@(account: Option[gitbucket.core.model.Account], error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context)
@import context._
@html.main(if(account.isEmpty) "New User" else "Update User"){
@admin.html.menu("users"){
@helper.html.error(error)
<form method="POST" action="@if(account.isEmpty){@path/admin/users/_newuser} else {@path/admin/users/@account.get.userName/_edituser}" validate="true">
@gitbucket.core.html.main(if(account.isEmpty) "New User" else "Update User"){
@gitbucket.core.admin.html.menu("users"){
@gitbucket.core.helper.html.error(error)
<form method="POST" action="@if(account.isEmpty){@context.path/admin/users/_newuser} else {@context.path/admin/users/@account.get.userName/_edituser}" validate="true">
<div class="row">
<div class="col-md-6">
<fieldset class="form-group">
@@ -71,13 +70,13 @@
<div class="col-md-6">
<fieldset class="form-group">
<label for="avatar" class="strong">Image (Optional)</label>
@helper.html.uploadavatar(account)
@gitbucket.core.helper.html.uploadavatar(account)
</fieldset>
</div>
</div>
<fieldset class="border-top">
<input type="submit" class="btn btn-success" value="@if(account.isEmpty){Create User} else {Update User}"/>
<a href="@path/admin/users" class="btn btn-default">Cancel</a>
<a href="@context.path/admin/users" class="btn btn-default">Cancel</a>
</fieldset>
</form>
}

View File

@@ -1,9 +1,7 @@
@(account: Option[gitbucket.core.model.Account], members: List[gitbucket.core.model.GroupMember])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(if(account.isEmpty) "New Group" else "Update Group"){
@admin.html.menu("users"){
<form method="POST" action="@if(account.isEmpty){@path/admin/users/_newgroup} else {@path/admin/users/@account.get.userName/_editgroup}" validate="true">
@gitbucket.core.html.main(if(account.isEmpty) "New Group" else "Update Group"){
@gitbucket.core.admin.html.menu("users"){
<form method="POST" action="@if(account.isEmpty){@context.path/admin/users/_newgroup} else {@context.path/admin/users/@account.get.userName/_editgroup}" validate="true">
<div class="row">
<div class="col-md-6">
<fieldset class="form-group">
@@ -28,7 +26,7 @@
</fieldset>
<fieldset class="form-group">
<label for="avatar" class="strong">Image (Optional)</label>
@helper.html.uploadavatar(account)
@gitbucket.core.helper.html.uploadavatar(account)
</fieldset>
</div>
<div class="col-md-6">
@@ -36,7 +34,7 @@
<label class="strong">Members</label>
<ul id="member-list" class="collaborator">
</ul>
@helper.html.account("memberName", 200)
@gitbucket.core.helper.html.account("memberName", 200)
<input type="button" class="btn btn-default" value="Add" id="addMember"/>
<input type="hidden" id="members" name="members" value="@members.map(member => member.userName + ":" + member.isManager).mkString(",")"/>
<div>
@@ -47,7 +45,7 @@
</div>
<fieldset class="border-top">
<input type="submit" class="btn btn-success" value="@if(account.isEmpty){Create Group} else {Update Group}"/>
<a href="@path/admin/users" class="btn btn-default">Cancel</a>
<a href="@context.path/admin/users" class="btn btn-default">Cancel</a>
</fieldset>
</form>
}
@@ -77,7 +75,7 @@ $(function(){
}
// check existence
$.post('@path/_user/existence', {
$.post('@context.path/_user/existence', {
'userName': userName,
'userOnly': true
}, function(data, status){
@@ -118,7 +116,7 @@ $(function(){
.append(memberButton)
.append(managerButton))
.append(' ')
.append($('<a>').attr('href', '@path/' + userName).text(userName))
.append($('<a>').attr('href', '@context.path/' + userName).text(userName))
.append(' ')
.append($('<a href="#" class="remove pull-right">(remove)</a>')));
}

View File

@@ -1,11 +1,10 @@
@(users: List[gitbucket.core.model.Account], members: Map[String, List[String]], includeRemoved: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Manage Users"){
@admin.html.menu("users"){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("Manage Users"){
@gitbucket.core.admin.html.menu("users"){
<div class="pull-right" style="margin-bottom: 4px;">
<a href="@path/admin/users/_newuser" class="btn btn-default">New User</a>
<a href="@path/admin/users/_newgroup" class="btn btn-default">New Group</a>
<a href="@context.path/admin/users/_newuser" class="btn btn-default">New User</a>
<a href="@context.path/admin/users/_newgroup" class="btn btn-default">New Group</a>
</div>
<label for="includeRemoved">
<input type="checkbox" id="includeRemoved" name="includeRemoved" @if(includeRemoved){checked}/>
@@ -17,14 +16,14 @@
<td @if(account.isRemoved){style="background-color: #dddddd;"}>
<div class="pull-right">
@if(account.isGroupAccount){
<a href="@path/admin/users/@account.userName/_editgroup">Edit</a>
<a href="@context.path/admin/users/@account.userName/_editgroup">Edit</a>
} else {
<a href="@path/admin/users/@account.userName/_edituser">Edit</a>
<a href="@context.path/admin/users/@account.userName/_edituser">Edit</a>
}
</div>
<div class="strong">
@avatar(account.userName, 20)
<a href="@url(account.userName)">@account.userName</a>
@helpers.avatar(account.userName, 20)
<a href="@helpers.url(account.userName)">@account.userName</a>
@if(account.isGroupAccount){
(Group)
} else {
@@ -36,7 +35,7 @@
}
@if(account.isGroupAccount){
@members(account.userName).map { userName =>
@avatar(userName, 20, tooltip = true)
@helpers.avatar(userName, 20, tooltip = true)
}
}
</div>
@@ -50,10 +49,10 @@
}
</div>
<div>
<span class="muted">Registered:</span> @datetime(account.registeredDate)
<span class="muted">Updated:</span> @datetime(account.updatedDate)
<span class="muted">Registered:</span> @helpers.datetime(account.registeredDate)
<span class="muted">Updated:</span> @helpers.datetime(account.updatedDate)
@if(!account.isGroupAccount){
<span class="muted">Last Login:</span> @account.lastLoginDate.map(datetime)
<span class="muted">Last Login:</span> @account.lastLoginDate.map(helpers.datetime)
}
</div>
</td>
@@ -65,7 +64,7 @@
<script>
$(function(){
$('#includeRemoved').click(function(){
location.href = '@path/admin/users?includeRemoved=' + this.checked;
location.href = '@context.path/admin/users?includeRemoved=' + this.checked;
});
});
</script>

View File

@@ -2,62 +2,61 @@
closedCount: Int,
condition: gitbucket.core.service.IssuesService.IssueSearchCondition,
groups: List[String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<div id="table-issues-control">
@helper.html.dropdown("Visibility"){
@gitbucket.core.helper.html.dropdown("Visibility"){
<li>
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("private")) None else Some("private"))).toURL)">
@helper.html.checkicon(condition.visibility == Some("private"))
@gitbucket.core.helper.html.checkicon(condition.visibility == Some("private"))
Private repository only
</a>
</li>
<li>
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("public")) None else Some("public"))).toURL)">
@helper.html.checkicon(condition.visibility == Some("public"))
@gitbucket.core.helper.html.checkicon(condition.visibility == Some("public"))
Public repository only
</a>
</li>
}
@helper.html.dropdown("Organization"){
@gitbucket.core.helper.html.dropdown("Organization"){
@groups.map { group =>
<li>
<a href="@((if(condition.groups.contains(group)) condition.copy(groups = condition.groups - group) else condition.copy(groups = condition.groups + group)).toURL)">
@helper.html.checkicon(condition.groups.contains(group))
@avatar(group, 20) @group
@gitbucket.core.helper.html.checkicon(condition.groups.contains(group))
@helpers.avatar(group, 20) @group
</a>
</li>
}
}
@helper.html.dropdown("Sort"){
@gitbucket.core.helper.html.dropdown("Sort"){
<li>
<a href="@condition.copy(sort="created", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
@gitbucket.core.helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
</a>
</li>
<li>
<a href="@condition.copy(sort="created", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
@gitbucket.core.helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
</a>
</li>
<li>
<a href="@condition.copy(sort="comments", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
@gitbucket.core.helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
</a>
</li>
<li>
<a href="@condition.copy(sort="comments", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
@gitbucket.core.helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
</a>
</li>
<li>
<a href="@condition.copy(sort="updated", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
@gitbucket.core.helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
</a>
</li>
<li>
<a href="@condition.copy(sort="updated", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
@gitbucket.core.helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
</a>
</li>
}

View File

@@ -7,14 +7,12 @@
groups: List[String],
recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Issues"){
@sidebar(recentRepositories, userRepositories){
@dashboard.html.tab("issues")
@gitbucket.core.html.main("Issues"){
@gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){
@gitbucket.core.dashboard.html.tab("issues")
<div class="container">
@issuesnavi(filter, openCount, closedCount, condition)
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
@gitbucket.core.dashboard.html.issuesnavi(filter, openCount, closedCount, condition)
@gitbucket.core.dashboard.html.issueslist(issues, page, openCount, closedCount, condition, filter, groups)
</div>
}
}

View File

@@ -5,15 +5,14 @@
condition: gitbucket.core.service.IssuesService.IssueSearchCondition,
filter: String,
groups: List[String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@import gitbucket.core.service.IssuesService
@import gitbucket.core.service.IssuesService.IssueInfo
<table class="table table-bordered table-hover table-issues">
<thead>
<tr>
<th style="background-color: #eee;">
@dashboard.html.header(openCount, closedCount, condition, groups)
@gitbucket.core.dashboard.html.header(openCount, closedCount, condition, groups)
</th>
</tr>
</thead>
@@ -21,11 +20,11 @@
@issues.map { case IssueInfo(issue, labels, milestone, commentCount, commitStatus) =>
<tr>
<td style="padding-top: 12px; padding-bottom: 12px;">
<a href="@path/@issue.userName/@issue.repositoryName">@issue.userName/@issue.repositoryName</a>&nbsp;&#xFF65;
<a href="@context.path/@issue.userName/@issue.repositoryName">@issue.userName/@issue.repositoryName</a>&nbsp;&#xFF65;
@if(issue.isPullRequest){
<a href="@path/@issue.userName/@issue.repositoryName/pull/@issue.issueId" class="issue-title">@issue.title</a>
<a href="@context.path/@issue.userName/@issue.repositoryName/pull/@issue.issueId" class="issue-title">@issue.title</a>
} else {
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-title">@issue.title</a>
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-title">@issue.title</a>
}
@gitbucket.core.issues.html.commitstatus(issue, commitStatus)
@labels.map { label =>
@@ -33,20 +32,20 @@
}
<span class="pull-right muted">
@issue.assignedUserName.map { userName =>
@avatar(userName, 20, tooltip = true)
@helpers.avatar(userName, 20, tooltip = true)
}
@if(commentCount > 0){
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<i class="octicon octicon-comment active"></i> @commentCount
</a>
} else {
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count" style="color: silver;">
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count" style="color: silver;">
<i class="octicon octicon-comment"></i> @commentCount
</a>
}
</span>
<div class="small muted" style="margin-top: 2px;">
#@issue.issueId opened by @user(issue.openedUserName, styleClass="username") @datetime(issue.registeredDate)
#@issue.issueId opened by @helpers.user(issue.openedUserName, styleClass="username") @helpers.datetime(issue.registeredDate)
@milestone.map { milestone =>
<span style="margin: 20px;"><a href="@condition.copy(milestone = Some(Some(milestone))).toURL" class="username"><i class="octicon octicon-milestone"></i> @milestone</a></span>
}
@@ -64,5 +63,5 @@
</tbody>
</table>
<div class="pull-right">
@helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), IssuesService.IssueLimit, 10, condition.toURL)
@gitbucket.core.helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), IssuesService.IssueLimit, 10, condition.toURL)
</div>

View File

@@ -2,8 +2,6 @@
openCount: Int,
closedCount: Int,
condition: gitbucket.core.service.IssuesService.IssueSearchCondition)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
<ul class="nav nav-pills pull-left" style="line-height: 14px; margin-bottom: 10px;">
<li class="@(if(condition.state == "open"){"active"})">
<a href="@condition.copy(state = "open").toURL">Open <span class="badge">@openCount</span></a>

View File

@@ -7,14 +7,12 @@
groups: List[String],
recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Pull Requests"){
@sidebar(recentRepositories, userRepositories){
@dashboard.html.tab("pulls")
@gitbucket.core.html.main("Pull Requests"){
@gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){
@gitbucket.core.dashboard.html.tab("pulls")
<div class="container">
@issuesnavi(filter, openCount, closedCount, condition)
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
@gitbucket.core.dashboard.html.issuesnavi(filter, openCount, closedCount, condition)
@gitbucket.core.dashboard.html.issueslist(issues, page, openCount, closedCount, condition, filter, groups)
</div>
}
}

View File

@@ -1,22 +1,24 @@
@(recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<div class="main-sidebar">
<div class="sidebar">
<ul class="nav sidebar-menu">
@if(loginAccount.isDefined){
<li class="header">Your repositories <span class="label label-primary pull-right">@userRepositories.size</span></li>
@if(context.loginAccount.isDefined){
<li class="header">
<span class="label label-primary pull-right">@userRepositories.size</span>
Your repositories
</li>
@if(userRepositories.isEmpty){
<li>No repositories</li>
} else {
@defining(10){ max =>
@userRepositories.zipWithIndex.map { case (repository, i) =>
<li class="repo-link" style="@if(i > max - 1){display:none;}">
@if(repository.owner == loginAccount.get.userName){
<a href="@url(repository)">@helper.html.repositoryicon(repository, false) <span class="strong">@repository.name</span></a>
@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>
} else {
<a href="@url(repository)">@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>
}
@@ -35,7 +37,7 @@
@defining(10){ max =>
@recentRepositories.zipWithIndex.map { case (repository, i) =>
<li class="repo-link" style="@if(i > max - 1){display:none;}">
<a href="@url(repository)">@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>
}
@if(recentRepositories.size > max){

View File

@@ -1,14 +1,12 @@
@(active: String = "")(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
<ul class="nav nav-tabs" style="margin-bottom: 20px;">
<li @if(active == ""){ class="active"}><a href="@path/">News Feed</a></li>
@if(loginAccount.isDefined){
<li @if(active == "pulls" ){ class="active"}><a href="@path/dashboard/pulls">Pull Requests</a></li>
<li @if(active == "issues"){ class="active"}><a href="@path/dashboard/issues">Issues</a></li>
<li @if(active == ""){ class="active"}><a href="@context.path/">News Feed</a></li>
@if(context.loginAccount.isDefined){
<li @if(active == "pulls" ){ class="active"}><a href="@context.path/dashboard/pulls">Pull Requests</a></li>
<li @if(active == "issues"){ class="active"}><a href="@context.path/dashboard/issues">Issues</a></li>
@gitbucket.core.plugin.PluginRegistry().getDashboardTabs.map { tab =>
@tab(context).map { link =>
<li @if(active == link.id){ class="active"}><a href="@path/@link.path">@link.label</a></li>
<li @if(active == link.id){ class="active"}><a href="@context.path/@link.path">@link.label</a></li>
}
}
}

View File

@@ -1,4 +1,4 @@
@(title: String)(implicit context: gitbucket.core.controller.Context)
@main("Error"){
@gitbucket.core.html.main("Error"){
<h1>@title</h1>
}

View File

@@ -1,5 +1,4 @@
@(id: String, width: Int)(implicit context: gitbucket.core.controller.Context)
@import context._
<span style="margin-right: 0px;">
<input type="text" name="@id" id="@id" class="form-control" autocomplete="off" style="width: @{width}px; margin-bottom: 0px; display: inline; vertical-align: middle;"/>
</span>
@@ -7,7 +6,7 @@
$(function(){
$('#@id').typeahead({
source: function (query, process) {
return $.get('@path/_user/proposals', { query: query },
return $.get('@context.path/_user/proposals', { query: query },
function (data) {
return process(data.options);
});

View File

@@ -1,6 +1,5 @@
@(activities: List[gitbucket.core.model.Activity])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@if(activities.isEmpty){
No activity
@@ -29,7 +28,7 @@
} else {
if(commit.nonEmpty){
<div>
<a href={s"${path}/${activity.userName}/${activity.repositoryName}/commit/${commit. substring(0, 40)}"} class="monospace">{commit.substring(0, 7)}</a>
<a href={s"${context.path}/${activity.userName}/${activity.repositoryName}/commit/${commit. substring(0, 40)}"} class="monospace">{commit.substring(0, 7)}</a>
<span>{commit.substring(41)}</span>
</div>
}
@@ -39,19 +38,19 @@
}
case "create_wiki" => customActivity(activity, "book"){
<div class="small activity-message">
Created <a href={s"${path}/${activity.userName}/${activity.repositoryName}/wiki/${activity.additionalInfo.get}"}>{activity.additionalInfo.get}</a>.
Created <a href={s"${context.path}/${activity.userName}/${activity.repositoryName}/wiki/${activity.additionalInfo.get}"}>{activity.additionalInfo.get}</a>.
</div>
}
case "edit_wiki" => customActivity(activity, "book"){
activity.additionalInfo.get.split(":") match {
case Array(pageName, commitId) =>
<div class="small activity-message">
Edited <a href={s"${path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}"}>{pageName}</a>.
<a href={s"${path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}/_compare/${commitId.substring(0, 7)}^...${commitId.substring(0, 7)}"}>View the diff »</a>
Edited <a href={s"${context.path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}"}>{pageName}</a>.
<a href={s"${context.path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}/_compare/${commitId.substring(0, 7)}^...${commitId.substring(0, 7)}"}>View the diff »</a>
</div>
case Array(pageName) =>
<div class="small activity-message">
Edited <a href={s"${path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}"}>{pageName}</a>.
Edited <a href={s"${context.path}/${activity.userName}/${activity.repositoryName}/wiki/${pageName}"}>{pageName}</a>.
</div>
}
}
@@ -65,10 +64,10 @@
<div class="activity-icon-large"><i class="mega-octicon octicon-@image"></i></div>
*@
<div>
<div class="muted small">@helper.html.datetimeago(activity.activityDate)</div>
<div class="muted small">@gitbucket.core.helper.html.datetimeago(activity.activityDate)</div>
<div class="strong">
@avatar(activity.activityUserName, 16)
@activityMessage(activity.message)
@helpers.avatar(activity.activityUserName, 16)
@helpers.activityMessage(activity.message)
</div>
@activity.additionalInfo.map { additionalInfo =>
<div class=" activity-message">@additionalInfo</div>
@@ -81,10 +80,10 @@
<div class="activity-icon-large"><i class="mega-octicon octicon-@image"></i></div>
*@
<div>
<div class="muted small">@helper.html.datetimeago(activity.activityDate)</div>
<div class="muted small">@gitbucket.core.helper.html.datetimeago(activity.activityDate)</div>
<div class="strong">
@avatar(activity.activityUserName, 16)
@activityMessage(activity.message)
@helpers.avatar(activity.activityUserName, 16)
@helpers.activityMessage(activity.message)
</div>
@additionalInfo
</div>
@@ -95,10 +94,10 @@
<div class="activity-icon-small"><i class="octicon octicon-@image"></i></div>
*@
<div>
<span class="muted small">@helper.html.datetimeago(activity.activityDate)</span>
<span class="muted small">@gitbucket.core.helper.html.datetimeago(activity.activityDate)</span>
<div>
@avatar(activity.activityUserName, 16)
@activityMessage(activity.message)
@helpers.avatar(activity.activityUserName, 16)
@helpers.activityMessage(activity.message)
</div>
</div>
}

View File

@@ -1,6 +1,7 @@
@(owner: String, repository: String)(textarea: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
completionContext: String, generateScript: Boolean = true)(textarea: Html)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.util.FileUtil
@import gitbucket.core.view.helpers
<div class="muted attachable">
@textarea
<div class="clickable">Attach images or documents by dragging &amp; dropping, or selecting them.</div>
@@ -8,23 +9,60 @@
@defining("(id=\")([\\w\\-]*)(\")".r.findFirstMatchIn(textarea.body).map(_.group(2))){ textareaId =>
<script>
$(function(){
try {
$([$('#@textareaId').closest('div')[0], $('#@textareaId').next('div')[0]]).dropzone({
url: '@path/upload/file/@owner/@repository',
maxFilesize: 10,
acceptedFiles: @Html(FileUtil.mimeTypeWhiteList.mkString("'", ",", "'")),
dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF.',
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
success: function(file, id) {
var attachFile = (file.type.match(/image\/.*/) ? '\n![' + file.name.split('.')[0] : '\n[' + file.name) +
'](@baseUrl/@owner/@repository/_attached/' + id + ')';
$('#@textareaId').val($('#@textareaId').val() + attachFile);
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
@gitbucket.core.plugin.PluginRegistry().getSuggestionProviders.map { provider =>
@if(provider.context.contains(completionContext)){
var @provider.id = @Html(helpers.json(provider.values(repository)));
@Html(provider.additionalScript)
}
}
$('#@textareaId').textcomplete([
@gitbucket.core.plugin.PluginRegistry().getSuggestionProviders.map { provider =>
@if(provider.context.contains(completionContext)){
{
id: '@{provider.id}',
match: /\B@{provider.prefix}([\-+\w]*)$/,
search: function (term, callback) {
callback($.map(@{provider.id}, function (proposal) {
return proposal.indexOf(term) === 0 ? proposal : null;
}));
},
template: function (value) {
return @{Html(provider.template)};
},
replace: function (value) {
return '@{provider.prefix}' + value + '@{provider.suffix}';
},
index: 1
},
}
}
], {
onKeydown: function (e, commands) {
if (e.ctrlKey && e.keyCode === 74) { // CTRL-J
return commands.KEY_ENTER;
}
}
});
@if(generateScript){
try {
$([$('#@textareaId').closest('div')[0], $('#@textareaId').next('div')[0]]).dropzone({
url: '@context.path/upload/file/@repository.owner/@repository.name',
maxFilesize: 10,
acceptedFiles: @Html(FileUtil.mimeTypeWhiteList.mkString("'", ",", "'")),
dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF.',
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
success: function(file, id) {
var attachFile = (file.type.match(/image\/.*/) ? '\n![' + file.name.split('.')[0] : '\n[' + file.name) +
'](@context.baseUrl/@repository.owner/@repository.name/_attached/' + id + ')';
$('#@textareaId').val($('#@textareaId').val() + attachFile);
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
}
});
} catch(e) {
if (e.message !== "Dropzone already attached.") {
throw e;
}
});
} catch(e) {
if (e.message !== "Dropzone already attached.") {
throw e;
}
}
});

View File

@@ -1,11 +1,8 @@
@(branch: String = "",
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.service.RepositoryService
@import context._
@import gitbucket.core._
@import gitbucket.core.view.helpers._
@helper.html.dropdown(
@import gitbucket.core.view.helpers
@gitbucket.core.helper.html.dropdown(
value = if(branch.length == 40) branch.substring(0, 10) else branch,
prefix = if(branch.length == 40) "tree" else if(repository.branchList.contains(branch)) "branch" else "tree"
) {
@@ -14,7 +11,7 @@
@body
@if(hasWritePermission) {
<li id="create-branch" style="display: none;">
<a><form action="@url(repository)/branches" method="post" style="margin: 0;">
<a><form action="@helpers.url(repository)/branches" method="post" style="margin: 0;">
<span class="new-branch-name">Create branch:&nbsp;<span class="new-branch"></span></span>
<br><span style="padding-left: 17px;">from&nbsp;'@branch'</span>
<input type="hidden" name="new">

View File

@@ -2,18 +2,16 @@
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
latestCommitId: Option[String] = None)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<div class="@if(comment.fileName.isDefined && (!latestCommitId.isDefined || latestCommitId.get == comment.commitId)){inline-comment}"
id="discussion_r@comment.commentId"
@if(comment.fileName.isDefined){filename="@comment.fileName.get"}
@if(comment.newLine.isDefined){newline="@comment.newLine.get"}
@if(comment.oldLine.isDefined){oldline="@comment.oldLine.get"}>
<div class="issue-avatar-image">@avatarLink(comment.commentedUserName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(comment.commentedUserName, 48)</div>
<div class="panel panel-default commit-comment-box commit-comment-@comment.commentId">
<div class="panel-heading">
@user(comment.commentedUserName, styleClass="username strong")
@helpers.user(comment.commentedUserName, styleClass="username strong")
<span class="muted">
commented
@if(comment.issueId.isDefined){
@@ -22,19 +20,19 @@
@if(comment.fileName.isDefined){
on @comment.fileName.get
}
in <a href="@path/@repository.owner/@repository.name/commit/@comment.commitId">@comment.commitId.substring(0, 7)</a>
in <a href="@context.path/@repository.owner/@repository.name/commit/@comment.commitId">@comment.commitId.substring(0, 7)</a>
}
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</span>
<span class="pull-right">
@if(hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false)){
@if(hasWritePermission || context.loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false)){
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-pencil"></i></a>&nbsp;
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-x"></i></a>
}
</span>
</div>
<div class="panel-body issue-content commit-commentContent-@comment.commentId markdown-body">
@markdown(
@helpers.markdown(
markdown = comment.content,
repository = repository,
enableWikiLink = false,

View File

@@ -1,10 +1,10 @@
@(latestUpdatedDate: java.util.Date,
recentOnly: Boolean = true)
@import gitbucket.core.view.helpers._
<span data-toggle="tooltip" title="@datetime(latestUpdatedDate)">
@import gitbucket.core.view.helpers
<span data-toggle="tooltip" title="@helpers.datetime(latestUpdatedDate)">
@if(recentOnly){
@datetimeAgoRecentOnly(latestUpdatedDate)
}else{
@datetimeAgo(latestUpdatedDate)
@helpers.datetimeAgoRecentOnly(latestUpdatedDate)
} else {
@helpers.datetimeAgo(latestUpdatedDate)
}
</span>

View File

@@ -6,8 +6,7 @@
issueId: Option[Int],
hasWritePermission: Boolean,
showLineNotes: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@import org.eclipse.jgit.diff.DiffEntry.ChangeType
@if(showIndex){
<div class="pull-right" style="margin-bottom: 10px;">
@@ -16,7 +15,7 @@
<input type="button" id="btn-split" class="btn btn-default btn-small" value="Split">
</div>
</div>
Showing <a href="javascript:void(0);" id="toggle-file-list">@diffs.size changed @plural(diffs.size, "file")</a>
Showing <a href="javascript:void(0);" id="toggle-file-list">@diffs.size changed @helpers.plural(diffs.size, "file")</a>
<ul id="commit-file-list" style="display: none;">
@diffs.zipWithIndex.map { case (diff, i) =>
<li@if(i > 0){ class="border"}>
@@ -49,7 +48,7 @@
<div class="pull-right align-right">
<label class="no-margin"><input type="checkbox" class="ignore-whitespace" value="1"/> Ignore Space</label>
<label class="no-margin"><input type="checkbox" class="toggle-notes" checked> Show notes</label>
<a href="@url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-default btn-sm" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
<a href="@helpers.url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-default btn-sm" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat"><i class="octicon octicon-diff-renamed"></i></span>
@@ -60,13 +59,13 @@
<div class="pull-right align-right">
<label class="no-margin"><input type="checkbox" class="ignore-whitespace" value="1"/> Ignore Space</label>
<label class="no-margin"><input type="checkbox" class="toggle-notes" checked> Show notes</label>
<a href="@url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-default btn-sm" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
<a href="@helpers.url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-default btn-sm" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat">
@if(diff.changeType == ChangeType.ADD){
<i class="octicon octicon-diff-added"></i>
}else{
} else {
<i class="octicon octicon-diff-modified"></i>
}
</span>
@@ -76,7 +75,7 @@
@if(oldCommitId.isDefined){
<div class="pull-right align-right">
<label class="no-margin"><input type="checkbox" class="toggle-notes" checked> Show notes</label>
<a href="@url(repository)/blob/@oldCommitId.get/@diff.oldPath" class="btn btn-default btn-sm" title="View the whole file at version @oldCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
<a href="@helpers.url(repository)/blob/@oldCommitId.get/@diff.oldPath" class="btn btn-default btn-sm" title="View the whole file at version @oldCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat"><i class="octicon octicon-diff-removed"></i></span>
@@ -104,14 +103,14 @@
@if(diff.newIsImage || diff.oldIsImage){
<div class="diff-image-render diff2up">
@if(oldCommitId.isDefined && diff.oldIsImage){
<div class="diff-image-frame diff-old"><img src="@url(repository)/raw/@oldCommitId.get/@diff.oldPath" class="diff-image" onload="onLoadedDiffImages(this)" style="display:none" /></div>
<div class="diff-image-frame diff-old"><img src="@helpers.url(repository)/raw/@oldCommitId.get/@diff.oldPath" class="diff-image" onload="onLoadedDiffImages(this)" style="display:none" /></div>
} else {
@if(diff.changeType != ChangeType.ADD){
<div style="padding: 12px;">Not supported</div>
}
}
@if(newCommitId.isDefined && diff.newIsImage){
<div class="diff-image-frame diff-new"><img src="@url(repository)/raw/@newCommitId.get/@diff.newPath" class="diff-image" onload="onLoadedDiffImages(this)" style="display:none" /></div>
<div class="diff-image-frame diff-new"><img src="@helpers.url(repository)/raw/@newCommitId.get/@diff.newPath" class="diff-image" onload="onLoadedDiffImages(this)" style="display:none" /></div>
} else {
@if(diff.changeType != ChangeType.DELETE){
<div style="padding: 12px;">Not supported</div>
@@ -131,8 +130,8 @@
</tr>
</table>
}
<script type="text/javascript" src="@assets/vendors/jsdifflib/difflib.js"></script>
<link href="@assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="@helpers.assets/vendors/jsdifflib/difflib.js"></script>
<link href="@helpers.assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script>
$(function(){
@if(showIndex){
@@ -203,7 +202,7 @@ $(function(){
var commitId = $this.closest('.table-bordered').attr('commitId'),
fileName = $this.closest('.table-bordered').attr('fileName'),
oldLineNumber, newLineNumber,
url = '@url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName@issueId.map { id => + '&issueId=@id' };
url = '@helpers.url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName@issueId.map { id => + '&issueId=@id' };
if (viewType == 0) {
oldLineNumber = $this.parent().prev('.oldline').attr('line-number');
newLineNumber = $this.parent().prev('.newline').attr('line-number');

View File

@@ -1,6 +1,5 @@
@(activities: List[gitbucket.core.model.Activity])(implicit context: gitbucket.core.controller.Context)<?xml version="1.0" encoding="UTF-8"?>
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
<id>tag:@context.host,2013:gitbucket</id>
<title>Gitbucket's activities</title>
@@ -9,19 +8,19 @@
<name>Gitbucket</name>
<uri>@context.baseUrl</uri>
</author>
<updated>@datetimeRFC3339(if(activities.isEmpty) new java.util.Date else activities.map(_.activityDate).max)</updated>
<updated>@helpers.datetimeRFC3339(if(activities.isEmpty) new java.util.Date else activities.map(_.activityDate).max)</updated>
@activities.map { activity =>
<entry>
<id>tag:@context.host,@date(activity.activityDate):activity:@activity.activityId</id>
<published>@datetimeRFC3339(activity.activityDate)</published>
<updated>@datetimeRFC3339(activity.activityDate)</updated>
<id>tag:@context.host,@helpers.date(activity.activityDate):activity:@activity.activityId</id>
<published>@helpers.datetimeRFC3339(activity.activityDate)</published>
<updated>@helpers.datetimeRFC3339(activity.activityDate)</updated>
<link type="text/html" rel="alternate" href="@context.baseUrl/@activity.userName/@activity.repositoryName" />
<title type="html">@removeHtml(activityMessage(activity.message))</title>
<title type="html">@helpers.removeHtml(helpers.activityMessage(activity.message))</title>
<author>
<name>@activity.activityUserName</name>
<uri>@url(activity.activityUserName)</uri>
<uri>@helpers.url(activity.activityUserName)</uri>
</author>
<content type="html">@activityMessage(activity.message)</content>
<content type="html">@helpers.activityMessage(activity.message)</content>
</entry>
}
</feed>

View File

@@ -1,16 +1,15 @@
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
groupAndPerm: Map[String, Boolean])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<h2 class="facebox-header">Where should we fork this repository?</h2>
<form action="@url(repository)/fork" id="fork" method="post">
<form action="@helpers.url(repository)/fork" id="fork" method="post">
<div class="owner-select-grid">
<div class="owner-select-target js-fork-owner-select-target enabled">@avatar(loginAccount.get.userName, 100)<span class="owner css-truncate" title="@@@loginAccount.get.userName">@@@loginAccount.get.userName</span></div>
<div class="owner-select-target js-fork-owner-select-target enabled">@helpers.avatar(context.loginAccount.get.userName, 100)<span class="owner css-truncate" title="@@@context.loginAccount.get.userName">@@@context.loginAccount.get.userName</span></div>
@for((groupName, isManager) <- groupAndPerm) {
@if(isManager) {
<div class="owner-select-target js-fork-owner-select-target enabled">@avatar(groupName, 100)<span class="owner css-truncate" title="@@@groupName">@@@groupName</span></div>
<div class="owner-select-target js-fork-owner-select-target enabled">@helpers.avatar(groupName, 100)<span class="owner css-truncate" title="@@@groupName">@@@groupName</span></div>
} else {
<div title="You don't have permission to fork here." class="owner-select-target js-fork-owner-select-target disabled">@avatar(groupName, 100)<span class="owner css-truncate" title="@@@groupName">@@@groupName</span></div>
<div title="You don't have permission to fork here." class="owner-select-target js-fork-owner-select-target disabled">@helpers.avatar(groupName, 100)<span class="owner css-truncate" title="@@@groupName">@@@groupName</span></div>
}
}
</div>

View File

@@ -5,15 +5,14 @@
enableLineBreaks: Boolean,
enableTaskList: Boolean,
hasWritePermission: Boolean,
completionContext: String,
style: String = "",
styleClass: String = "",
placeholder: String = "Leave a comment",
elastic: Boolean = false,
tabIndex: Int = -2,
uid: Long = new java.util.Date().getTime())(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<div class="tabbable">
<ul class="nav nav-tabs fill-width" style="margin-bottom: 10px;">
<li class="active"><a href="#tab@uid" data-toggle="tab">Write</a></li>
@@ -28,11 +27,11 @@
@if(style.nonEmpty){ style="@style"}
@if(styleClass.nonEmpty){ class="@styleClass" }>@content</textarea>
}
@if(enableWikiLink){
@textarea
} else {
@helper.html.attached(repository.owner, repository.name)(textarea)
}
@gitbucket.core.helper.html.attached(
repository = repository,
completionContext = completionContext,
generateScript = enableWikiLink
)(textarea)
</div>
<div class="tab-pane" id="tab@(uid+1)">
<div class="markdown-body" id="preview-area@uid">
@@ -40,8 +39,8 @@
</div>
</div>
</div>
<link href="@assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
<script src="@assets/vendors/google-code-prettify/prettify.js"></script>
<link href="@helpers.assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
<script src="@helpers.assets/vendors/google-code-prettify/prettify.js"></script>
<script>
$(function(){
@if(elastic){
@@ -49,8 +48,8 @@ $(function(){
}
$('#preview@uid').click(function(){
$('#preview-area@uid').html('<img src="@assets/common/images/indicator.gif"> Previewing...');
$.post('@url(repository)/_preview', {
$('#preview-area@uid').html('<img src="@helpers.assets/common/images/indicator.gif"> Previewing...');
$.post('@helpers.url(repository)/_preview', {
content : $('#content@uid').val(),
enableWikiLink : @enableWikiLink,
enableRefsLink : @enableRefsLink,

View File

@@ -1,7 +1,4 @@
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, large: Boolean)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.service.RepositoryService
@import context._
@import gitbucket.core.view.helpers._
@if(repository.repository.isPrivate){
<i class="@{if(large){"mega-"}}octicon octicon-lock"></i>
} else {

View File

@@ -1,8 +1,7 @@
@(account: Option[gitbucket.core.model.Account])(implicit context: gitbucket.core.controller.Context)
@import context._
<div id="avatar" class="muted">
@if(account.nonEmpty && account.get.image.nonEmpty){
<img src="@path/@account.get.userName/_avatar" style="with: 120px; height: 120px;"/>
<img src="@context.path/@account.get.userName/_avatar" style="with: 120px; height: 120px;"/>
} else {
<div id="clickable">Upload Image</div>
}
@@ -17,7 +16,7 @@
<script>
$(function(){
var dropzone = new Dropzone('div#clickable', {
url: '@path/upload/image',
url: '@context.path/upload/image',
previewsContainer: 'div#avatar',
parallelUploads: 1,
thumbnailWidth: 120,

View File

@@ -1,22 +1,21 @@
@(activities: List[gitbucket.core.model.Activity],
recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@main("GitBucket"){
@dashboard.html.sidebar(recentRepositories, userRepositories){
@settings.information.map { information =>
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("GitBucket"){
@gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){
@context.settings.information.map { information =>
<div class="alert alert-info" style="background-color: white; color: #555; border-color: #4183c4; font-size: small; line-height: 120%;">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@Html(information)
</div>
}
@dashboard.html.tab()
@gitbucket.core.dashboard.html.tab()
<div class="container">
<div class="pull-right">
<a href="@path/activities.atom"><img src="@assets/common/images/feed.png" alt="activities"></a>
<a href="@context.path/activities.atom"><img src="@helpers.assets/common/images/feed.png" alt="activities"></a>
</div>
@helper.html.activities(activities)
@gitbucket.core.helper.html.activities(activities)
</div>
}
}

View File

@@ -2,15 +2,14 @@
reopenable: Boolean,
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@if(loginAccount.isDefined){
@import gitbucket.core.view.helpers
@if(context.loginAccount.isDefined){
<hr/><br/>
<form method="POST" validate="true">
<div class="issue-avatar-image">@avatarLink(loginAccount.get.userName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(context.loginAccount.get.userName, 48)</div>
<div class="panel panel-default issue-comment-box">
<div class="panel-body">
@helper.html.preview(
@gitbucket.core.helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
@@ -18,16 +17,17 @@
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = hasWritePermission,
completionContext = "issues",
style = "",
elastic = true,
tabIndex = 1
)
<div class="text-right">
<input type="hidden" name="issueId" value="@issue.issueId"/>
@if((reopenable || !issue.closed) && (hasWritePermission || issue.openedUserName == loginAccount.get.userName)){
<input type="submit" class="btn btn-default" tabindex="3" formaction="@url(repository)/issue_comments/state" value="@{if(issue.closed) "Reopen" else "Close"}" id="action"/>
@if((reopenable || !issue.closed) && (hasWritePermission || issue.openedUserName == context.loginAccount.get.userName)){
<input type="submit" class="btn btn-default" tabindex="3" formaction="@helpers.url(repository)/issue_comments/state" value="@{if(issue.closed) "Reopen" else "Close"}" id="action"/>
}
<input type="submit" class="btn btn-success" tabindex="2" formaction="@url(repository)/issue_comments/new" value="Comment"/>
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
</div>
</div>
</div>

View File

@@ -3,22 +3,21 @@
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
pullreq: Option[gitbucket.core.model.PullRequest] = None)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@import gitbucket.core.model.CommitComment
@if(issue.isDefined){
<div class="issue-avatar-image">@avatarLink(issue.get.openedUserName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(issue.get.openedUserName, 48)</div>
<div class="panel panel-default issue-comment-box">
<div class="panel-heading">
@user(issue.get.openedUserName, styleClass="username strong") <span class="muted">commented @helper.html.datetimeago(issue.get.registeredDate)</span>
@helpers.user(issue.get.openedUserName, styleClass="username strong") <span class="muted">commented @gitbucket.core.helper.html.datetimeago(issue.get.registeredDate)</span>
<span class="pull-right">
@if(hasWritePermission || loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){
@if(hasWritePermission || context.loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){
<a href="#" data-issue-id="@issue.get.issueId"><i class="octicon octicon-pencil" aria-label="Edit"></i></a>
}
</span>
</div>
<div class="panel-body issue-content markdown-body" id="issueContent">
@markdown(
@helpers.markdown(
markdown = issue.get.content getOrElse "No description provided.",
repository = repository,
enableWikiLink = false,
@@ -36,20 +35,20 @@
case comment: gitbucket.core.model.IssueComment => {
@if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch"
&& comment.action != "commit" && comment.action != "refer"){
<div class="issue-avatar-image">@avatarLink(comment.commentedUserName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(comment.commentedUserName, 48)</div>
<div class="panel panel-default issue-comment-box" id="comment-@comment.commentId">
<div class="panel-heading">
@user(comment.commentedUserName, styleClass="username strong")
@helpers.user(comment.commentedUserName, styleClass="username strong")
<span class="muted">
@if(comment.action == "comment"){
commented
} else {
referenced the @issueOrPullRequest()
}
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</span>
@if(comment.action != "commit" && comment.action != "merge" && comment.action != "refer"
&& (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){
&& (hasWritePermission || context.loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){
<span class="pull-right">
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-pencil" aria-label="Edit"></i></a>&nbsp;
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-x" aria-label="Remove"></i></a>
@@ -57,7 +56,7 @@
}
</div>
<div class="panel-body issue-content markdown-body" id="commentContent-@comment.commentId">
@markdown(
@helpers.markdown(
markdown = comment.content,
repository = repository,
enableWikiLink = false,
@@ -80,20 +79,20 @@
<div class="discussion-item discussion-item-commit">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-bookmark"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
added a commit that referenced this @issueOrPullRequest()
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
<div style="discussion-item-content">
@commitId.map{ id =>
<span class="pull-right"><a href="@path/@repository.owner/@repository.name/commit/@id" class="monospace">@id.substring(0, 7)</a></span>
<span class="pull-right"><a href="@context.path/@repository.owner/@repository.name/commit/@id" class="monospace">@id.substring(0, 7)</a></span>
}
<span class="discussion-item-content-head"><i class="octicon octicon-git-commit"></i></span>
@link(head, repository)
@helpers.link(head, repository)
@rest.map{ content =>
<a href="javascript:void(0)" class="omit" onclick="$(this.parentNode).find('.discussion-item-content-text').toggle()">...</a>
<pre class="reset discussion-item-content-text" style="display:none">@link(content, repository)</pre>
<pre class="reset discussion-item-content-text" style="display:none">@helpers.link(content, repository)</pre>
}
</div>
</div>
@@ -103,14 +102,14 @@
<div class="discussion-item discussion-item-refer">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-bookmark"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
referenced the @issueOrPullRequest()
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
<div style="discussion-item-content">
@defining(comment.content.split(":")){ case Array(issueId, rest @ _*) =>
<strong>@issueLink(repository, issueId.toInt): @rest.mkString(":")</strong>
<strong>@helpers.issueLink(repository, issueId.toInt): @rest.mkString(":")</strong>
}
</div>
</div>
@@ -119,8 +118,8 @@
<div class="discussion-item discussion-item-merge">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-git-merge"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
merged commit
<code>@pullreq.map(_.commitIdTo.substring(0, 7))</code> into
@if(pullreq.get.requestUserName == repository.owner){
@@ -128,7 +127,7 @@
} else {
<code>@pullreq.map(_.userName):@pullreq.map(_.branch)</code> from <code>@pullreq.map(_.requestUserName):@pullreq.map(_.requestBranch)</code>
}
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
</div>
}
@@ -136,10 +135,10 @@
<div class="discussion-item discussion-item-close">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-circle-slash"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
closed this @issueOrPullRequest()
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
</div>
}
@@ -147,10 +146,10 @@
<div class="discussion-item discussion-item-reopen">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-primitive-dot"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
reopened the @issueOrPullRequest()
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
</div>
}
@@ -158,16 +157,16 @@
<div class="discussion-item discussion-item-delete_branch">
<div class="discussion-item-header">
<span class="discussion-item-icon"><i class="octicon octicon-git-branch"></i></span>
@avatar(comment.commentedUserName, 16)
@user(comment.commentedUserName, styleClass="username strong")
@helpers.avatar(comment.commentedUserName, 16)
@helpers.user(comment.commentedUserName, styleClass="username strong")
deleted the <code>@pullreq.map(_.requestBranch)</code> branch
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</div>
</div>
}
}
case comment: CommitComment => {
@helper.html.commitcomment(comment, hasWritePermission, repository, pullreq.map(_.commitIdTo))
@gitbucket.core.helper.html.commitcomment(comment, hasWritePermission, repository, pullreq.map(_.commitIdTo))
}
}
<script>
@@ -175,12 +174,12 @@ $(function(){
@if(issue.isDefined){
$('.issue-comment-box i.octicon-pencil').click(function(){
var id = $(this).closest('a').data('comment-id');
var url = '@url(repository)/issue_comments/_data/' + id;
var url = '@helpers.url(repository)/issue_comments/_data/' + id;
var $content = $('#commentContent-' + id);
if(!id){
id = $(this).closest('a').data('issue-id');
url = '@url(repository)/issues/_data/' + id;
url = '@helpers.url(repository)/issues/_data/' + id;
$content = $('#issueContent');
}
@@ -196,7 +195,7 @@ $(function(){
$('.issue-comment-box i.octicon-x').click(function(){
if(confirm('Are you sure you want to delete this?')) {
var id = $(this).closest('a').data('comment-id');
$.post('@url(repository)/issue_comments/delete/' + id,
$.post('@helpers.url(repository)/issue_comments/delete/' + id,
function(data){
if(data > 0) {
$('#comment-' + id).prev('div.issue-avatar-image').remove();
@@ -209,7 +208,7 @@ $(function(){
}
$(document).on('click', '.commit-comment-box i.octicon-pencil', function(){
var id = $(this).closest('a').data('comment-id');
var url = '@url(repository)/commit_comments/_data/' + id;
var url = '@helpers.url(repository)/commit_comments/_data/' + id;
var $content = $('.commit-commentContent-' + id, $(this).closest('.commit-comment-box'));
$.get(url,
@@ -224,7 +223,7 @@ $(function(){
$(document).on('click', '.commit-comment-box i.octicon-x', function(){
if(confirm('Are you sure you want to delete this?')) {
var id = $(this).closest('a').data('comment-id');
$.post('@url(repository)/commit_comments/delete/' + id,
$.post('@helpers.url(repository)/commit_comments/delete/' + id,
function(data){
if(data > 0) {
$('.commit-comment-' + id).closest('.not-diff').remove();
@@ -260,13 +259,13 @@ $(function(){
var $commentContent = $(ev.target).parents('div[class*=commit-commentContent-]'),
commentId = $commentContent.attr('class').match(/commit-commentContent-.+/)[0].replace(/commit-commentContent-/, ''),
checkboxes = $commentContent.find(':checkbox');
$.get('@url(repository)/commit_comments/_data/' + commentId,
$.get('@helpers.url(repository)/commit_comments/_data/' + commentId,
{
dataType : 'html'
},
function(responseContent){
$.ajax({
url: '@url(repository)/commit_comments/edit/' + commentId,
url: '@helpers.url(repository)/commit_comments/edit/' + commentId,
type: 'POST',
data: {
issueId : 0,
@@ -283,13 +282,13 @@ $(function(){
@if(issue.isDefined){
$('#issueContent').on('click', ':checkbox', function(ev){
var checkboxes = $('#issueContent :checkbox');
$.get('@url(repository)/issues/_data/@issue.get.issueId',
$.get('@helpers.url(repository)/issues/_data/@issue.get.issueId',
{
dataType : 'html'
},
function(responseContent){
$.ajax({
url: '@url(repository)/issues/edit/@issue.get.issueId',
url: '@helpers.url(repository)/issues/edit/@issue.get.issueId',
type: 'POST',
data: {
title : $('#issueTitle').text(),
@@ -304,13 +303,13 @@ $(function(){
var $commentContent = $(ev.target).parents('div[id^=commentContent-]'),
commentId = $commentContent.attr('id').replace(/commentContent-/, ''),
checkboxes = $commentContent.find(':checkbox');
$.get('@url(repository)/issue_comments/_data/' + commentId,
$.get('@helpers.url(repository)/issue_comments/_data/' + commentId,
{
dataType : 'html'
},
function(responseContent){
$.ajax({
url: '@url(repository)/issue_comments/edit/' + commentId,
url: '@helpers.url(repository)/issue_comments/edit/' + commentId,
type: 'POST',
data: {
issueId : 0,

View File

@@ -1,11 +1,11 @@
@(issue: gitbucket.core.model.Issue, statusInfo: Option[gitbucket.core.service.IssuesService.CommitStatusInfo])(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@statusInfo.map{ status =>
@if(status.count==1 && status.state.isDefined){
@if(status.targetUrl.isDefined){
<a href="@status.targetUrl.get" class="text-@status.state.get.name" data-toggle="tooltip" title="@status.state.get.name : @status.description.getOrElse(status.context.get)">@commitStateIcon(status.state.get)</a>
<a href="@status.targetUrl.get" class="text-@status.state.get.name" data-toggle="tooltip" title="@status.state.get.name : @status.description.getOrElse(status.context.get)">@helpers.commitStateIcon(status.state.get)</a>
}else{
<span class="text-@status.state.get.name">@commitStateIcon(status.state.get)
<span class="text-@status.state.get.name">@helpers.commitStateIcon(status.state.get)
}
}else{
@defining(status.count==status.successCount){ isSuccess =>

View File

@@ -3,16 +3,15 @@
labels: List[gitbucket.core.model.Label],
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
@html.menu("issues", repository){
<form action="@url(repository)/issues/new" method="POST" validate="true" class="form-group">
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
@gitbucket.core.html.menu("issues", repository){
<form action="@helpers.url(repository)/issues/new" method="POST" validate="true" class="form-group">
<div class="row-fluid">
<div class="col-md-9">
<span id="error-title" class="error"></span>
<input type="text" id="issue-title" name="title" class="form-control" value="" placeholder="Title" style="margin-bottom: 6px;" autofocus/>
@helper.html.preview(
@gitbucket.core.helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
@@ -20,6 +19,7 @@
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = hasWritePermission,
completionContext = "issues",
style = "height: 200px; max-height: 250px;",
elastic = true
)
@@ -28,7 +28,7 @@
</div>
</div>
<div class="col-md-3">
@issueinfo(None, Nil, Nil, collaborators, milestones.map(x => (x, 0, 0)), labels, hasWritePermission, repository)
@gitbucket.core.issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map(x => (x, 0, 0)), labels, hasWritePermission, repository)
</div>
</div>
</form>

View File

@@ -1,7 +1,7 @@
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
@import context._
@(content: String, commentId: Int,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
<span id="error-edit-content-@commentId" class="error"></span>
@helper.html.attached(owner, repository){
@gitbucket.core.helper.html.attached(repository, "issues"){
<textarea id="edit-content-@commentId" class="form-control">@content</textarea>
}
<div>
@@ -19,7 +19,7 @@ $(function(){
$('#update-comment-@commentId').click(function(){
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
$.ajax({
url: '@path/@owner/@repository/issue_comments/edit/@commentId',
url: '@context.path/@repository.owner/@repository.name/issue_comments/edit/@commentId',
type: 'POST',
data: {
issueId : 0, // TODO
@@ -35,7 +35,7 @@ $(function(){
$('#cancel-comment-@commentId').click(function(){
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
$.get('@path/@owner/@repository/issue_comments/_data/@commentId', callback);
$.get('@context.path/@repository.owner/@repository.name/issue_comments/_data/@commentId', callback);
return false;
});
});

View File

@@ -1,6 +1,6 @@
@(content: Option[String], issueId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
@import context._
@helper.html.attached(owner, repository){
@(content: Option[String], issueId: Int,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@gitbucket.core.helper.html.attached(repository, "issues"){
<textarea id="edit-content" class="form-control">@content.getOrElse("")</textarea>
}
<div>
@@ -17,7 +17,7 @@ $(function(){
$('#update-issue').click(function(){
$('#update, #cancel').attr('disabled', 'disabled');
$.ajax({
url: '@path/@owner/@repository/issues/edit/@issueId',
url: '@context.path/@repository.owner/@repository.name/issues/edit/@issueId',
type: 'POST',
data: {
content : $('#edit-content').val()
@@ -31,7 +31,7 @@ $(function(){
$('#cancel-issue').click(function(){
$('#update, #cancel').attr('disabled', 'disabled');
$.get('@path/@owner/@repository/issues/_data/@issueId', callback);
$.get('@context.path/@repository.owner/@repository.name/issues/_data/@issueId', callback);
return false;
});
});

View File

@@ -6,16 +6,15 @@
labels: List[gitbucket.core.model.Label],
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"${issue.title} - Issue #${issue.issueId} - ${repository.owner}/${repository.name}", Some(repository)){
@html.menu("issues", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"${issue.title} - Issue #${issue.issueId} - ${repository.owner}/${repository.name}", Some(repository)){
@gitbucket.core.html.menu("issues", repository){
<div>
<div class="show-title pull-right">
@if(hasWritePermission || loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){
@if(hasWritePermission || context.loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){
<a class="btn btn-default" href="#" id="edit">Edit</a>
}
<a class="btn btn-success" href="@url(repository)/issues/new">New issue</a>
<a class="btn btn-success" href="@helpers.url(repository)/issues/new">New issue</a>
</div>
<div class="edit-title pull-right" style="display: none;">
<a class="btn btn-success" href="#" id="update">Save</a> <a class="btn btn-default" href="#" id="cancel">Cancel</a>
@@ -38,21 +37,21 @@
<span class="label label-success issue-status">Open</span>
}
<span class="muted">
@user(issue.openedUserName, styleClass="username strong") opened this issue @helper.html.datetimeago(issue.registeredDate) - @defining(
@helpers.user(issue.openedUserName, styleClass="username strong") opened this issue @gitbucket.core.helper.html.datetimeago(issue.registeredDate) - @defining(
comments.count( _.action.contains("comment") )
){ count =>
@count @plural(count, "comment")
@count @helpers.plural(count, "comment")
}
</span>
</div>
<hr>
<div style="margin-top: 15px;">
<div class="col-md-9">
@commentlist(Some(issue), comments, hasWritePermission, repository)
@commentform(issue, true, hasWritePermission, repository)
@gitbucket.core.issues.html.commentlist(Some(issue), comments, hasWritePermission, repository)
@gitbucket.core.issues.html.commentform(issue, true, hasWritePermission, repository)
</div>
<div class="col-md-3">
@issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
@gitbucket.core.issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
</div>
</div>
}
@@ -68,7 +67,7 @@ $(function(){
$('#update').click(function(){
$(this).attr('disabled', 'disabled');
$.ajax({
url: '@url(repository)/issues/edit_title/@issue.issueId',
url: '@helpers.url(repository)/issues/edit_title/@issue.issueId',
type: 'POST',
data: {
title : $('#edit-title').val()

View File

@@ -6,17 +6,16 @@
labels: List[gitbucket.core.model.Label],
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<div style="margin-bottom: 14px;">
<span class="muted small strong">Labels</span>
@if(hasWritePermission){
<div class="pull-right">
@helper.html.dropdown("Edit", right = true) {
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
@labels.map { label =>
<li>
<a href="#" class="toggle-label" data-label-id="@label.labelId">
@helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId))
@gitbucket.core.helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId))
<span class="label" style="background-color: #@label.color;">&nbsp;</span>
@label.labelName
</a>
@@ -30,29 +29,29 @@
}
</div>
<ul class="label-list nav nav-pills nav-stacked">
@labellist(issueLabels)
@gitbucket.core.issues.html.labellist(issueLabels)
</ul>
<hr/>
<div style="margin-bottom: 14px;">
<span class="muted small strong">Milestone</span>
@if(hasWritePermission){
<div class="pull-right">
@helper.html.dropdown("Edit", right = true) {
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
<li><a href="javascript:void(0);" class="milestone" data-id=""><i class="octicon octicon-x"></i> Clear this milestone</a></li>
@milestones.filter(_._1.closedDate.isEmpty).map { case (milestone, _, _) =>
<li>
<a href="javascript:void(0);" class="milestone" data-id="@milestone.milestoneId" data-title="@milestone.title">
@issue.map { issue =>
@helper.html.checkicon(Some(milestone.milestoneId) == issue.milestoneId)
@gitbucket.core.helper.html.checkicon(Some(milestone.milestoneId) == issue.milestoneId)
}
@milestone.title
<div class="small" style="padding-left: 20px;">
@milestone.dueDate.map { dueDate =>
@if(isPast(dueDate)){
@if(helpers.isPast(dueDate)){
<i class="octicon octicon-alert" style="color:#BD2C00;"></i>
<span class="milestone-alert">Due by @date(dueDate)</span>
<span class="milestone-alert">Due by @helpers.date(dueDate)</span>
} else {
<span class="muted">Due by @date(dueDate)</span>
<span class="muted">Due by @helpers.date(dueDate)</span>
}
}.getOrElse {
<span class="muted">No due date</span>
@@ -68,7 +67,7 @@
<div id="milestone-progress-area">
@issue.flatMap(_.milestoneId).map { milestoneId =>
@milestones.collect { case (milestone, openCount, closeCount) if(milestone.milestoneId == milestoneId) =>
@issues.milestones.html.progress(openCount + closeCount, closeCount)
@gitbucket.core.issues.milestones.html.progress(openCount + closeCount, closeCount)
}
}
</div>
@@ -89,12 +88,12 @@
<span class="muted small strong">Assignee</span>
@if(hasWritePermission){
<div class="pull-right">
@helper.html.dropdown("Edit", right = true) {
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
<li><a href="javascript:void(0);" class="assign" data-name=""><i class="octicon octicon-x"></i> Clear assignee</a></li>
@collaborators.map { collaborator =>
<li>
<a href="javascript:void(0);" class="assign" data-name="@collaborator">
@helper.html.checkicon(issue.exists(_.assignedUserName.exists(_ == collaborator)))@avatar(collaborator, 20) @collaborator
@gitbucket.core.helper.html.checkicon(issue.exists(_.assignedUserName.exists(_ == collaborator)))@helpers.avatar(collaborator, 20) @collaborator
</a>
</li>
}
@@ -104,7 +103,7 @@
</div>
<span id="label-assigned">
@issue.flatMap(_.assignedUserName).map { userName =>
@avatar(userName, 20) @user(userName, styleClass="username strong small")
@helpers.avatar(userName, 20) @helpers.user(userName, styleClass="username strong small")
}.getOrElse{
<span class="muted small">No one</span>
}
@@ -116,12 +115,12 @@
<hr/>
<div style="margin-bottom: 14px;">
@defining((issue.openedUserName :: comments.map(_.commentedUserName)).distinct){ participants =>
<div class="muted small strong">@participants.size @plural(participants.size, "participant")</div>
<div class="muted small strong">@participants.size @helpers.plural(participants.size, "participant")</div>
}
</div>
@defining((issue.openedUserName :: comments.map(_.commentedUserName)).distinct){ participants =>
@participants.map { participant =>
@avatarLink(participant, 20, tooltip = true)
@helpers.avatarLink(participant, 20, tooltip = true)
}
}
}
@@ -130,7 +129,7 @@ $(function(){
@issue.map { issue =>
$('a.toggle-label').click(function(){
var path = switchLabel($(this));
$.post('@url(repository)/issues/@issue.issueId/label/' + path,
$.post('@helpers.url(repository)/issues/@issue.issueId/label/' + path,
{ labelId : $(this).data('label-id') },
function(data){
$('ul.label-list').empty().html(data);
@@ -142,7 +141,7 @@ $(function(){
$('a.milestone').click(function(){
var title = $(this).data('title');
var milestoneId = $(this).data('id');
$.post('@url(repository)/issues/@issue.issueId/milestone',
$.post('@helpers.url(repository)/issues/@issue.issueId/milestone',
{ milestoneId: milestoneId },
function(data){
displayMilestone(title, milestoneId, data);
@@ -153,7 +152,7 @@ $(function(){
$('a.assign').click(function(){
var $this = $(this);
var userName = $this.data('name');
$.post('@url(repository)/issues/@issue.issueId/assign',
$.post('@helpers.url(repository)/issues/@issue.issueId/assign',
{ assignedUserName: userName },
function(){
displayAssignee($this, userName);
@@ -171,7 +170,7 @@ $(function(){
});
$('input[name=labelNames]').val(labelNames.join(','));
$.post('@url(repository)/issues/new/label',
$.post('@helpers.url(repository)/issues/new/label',
{ labelNames : labelNames.join(',') },
function(data){
$('ul.label-list').empty().html(data);

View File

@@ -1,7 +1,6 @@
@(label: Option[gitbucket.core.model.Label],
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@defining(label.map(_.labelId).getOrElse("new")){ labelId =>
<div id="edit-label-area-@labelId">
<form class="form-inline">
@@ -23,7 +22,7 @@
<script>
$(function(){
$('#submit-@labelId').click(function(e){
$.post('@url(repository)/issues/labels/@{if(labelId == "new") "new" else labelId + "/edit"}', {
$.post('@helpers.url(repository)/issues/labels/@{if(labelId == "new") "new" else labelId + "/edit"}', {
'labelName' : $('#labelName-@labelId').val(),
'labelColor': $('#labelColor-@labelId').val()
}, function(data, status){

View File

@@ -2,14 +2,13 @@
counts: Map[String, Int],
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<tr id="label-row-@label.labelId">
<td style="padding-top: 15px; padding-bottom: 15px;">
<div class="milestone row" id="label-@label.labelId">
<div class="col-md-8">
<div style="margin-top: 6px">
<a href="@url(repository)/issues?labels=@urlEncode(label.labelName)" id="label-row-content-@label.labelId">
<a href="@helpers.url(repository)/issues?labels=@helpers.urlEncode(label.labelName)" id="label-row-content-@label.labelId">
<span style="background-color: #@label.color; color: #@label.fontColor; padding: 8px; font-size: 120%; border-radius: 4px;">
<i class="octicon octicon-tag" style="color: #@label.fontColor;"></i>
@label.labelName

View File

@@ -2,11 +2,10 @@
counts: Map[String, Int],
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"Labels - ${repository.owner}/${repository.name}"){
@html.menu("labels", repository){
@if(loginAccount.isDefined){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"Labels - ${repository.owner}/${repository.name}"){
@gitbucket.core.html.menu("labels", repository){
@if(context.loginAccount.isDefined){
<div class="pull-right" style="margin-bottom: 10px;">
<a class="btn btn-success" href="javascript:void(0);" id="new-label-button">New label</a>
</div>
@@ -47,7 +46,7 @@ $(function(){
$('div#edit-label-area-new').remove();
$('#new-label-table').hide();
} else {
$.get('@url(repository)/issues/labels/new',
$.get('@helpers.url(repository)/issues/labels/new',
function(data){
$('#new-label-table').show().find('tr td').append(data);
}
@@ -58,14 +57,14 @@ $(function(){
function deleteLabel(labelId){
if(confirm('Once you delete this label, there is no going back.\nAre you sure?')){
$.post('@url(repository)/issues/labels/' + labelId + '/delete', function(){
$.post('@helpers.url(repository)/issues/labels/' + labelId + '/delete', function(){
$('tr#label-row-' + labelId).remove();
});
}
}
function editLabel(labelId){
$.get('@url(repository)/issues/labels/' + labelId + '/edit',
$.get('@helpers.url(repository)/issues/labels/' + labelId + '/edit',
function(data){
$('#label-' + labelId).hide().parent().append(data);
}

View File

@@ -9,10 +9,9 @@
condition: gitbucket.core.service.IssuesService.IssueSearchCondition,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main((if(target == "issues") "Issues" else "Pull requests") + s" - ${repository.owner}/${repository.name}", Some(repository)){
@html.menu(target, repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main((if(target == "issues") "Issues" else "Pull requests") + s" - ${repository.owner}/${repository.name}", Some(repository)){
@gitbucket.core.html.menu(target, repository){
<ul class="nav nav-pills pull-left" style="line-height: 14px; margin-bottom: 10px;">
<li class="@if(condition.state == "open"){active}">
<a href="@condition.copy(state = "open").toURL">Open <span class="badge">@openCount</span></a>
@@ -22,16 +21,16 @@
</li>
</ul>
<form method="GET" id="search-filter-form" class="form-inline pull-right">
@if(loginAccount.isDefined){
@if(context.loginAccount.isDefined){
@if(target == "issues"){
<a class="btn btn-success" href="@url(repository)/issues/new">New issue</a>
<a class="btn btn-success" href="@helpers.url(repository)/issues/new">New issue</a>
}
@if(target == "pulls"){
<a class="btn btn-success" href="@url(repository)/compare">New pull request</a>
<a class="btn btn-success" href="@helpers.url(repository)/compare">New pull request</a>
}
}
</form>
@listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission)
@gitbucket.core.issues.html.listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission)
@if(hasWritePermission){
<form id="batcheditForm" method="POST">
<input type="hidden" name="value"/>
@@ -99,16 +98,16 @@ $(function(){
};
$('a.toggle-state').click(function(){
submitBatchEdit('@url(repository)/issues/batchedit/state', $(this).data('id'));
submitBatchEdit('@helpers.url(repository)/issues/batchedit/state', $(this).data('id'));
});
$('a.toggle-label').click(function(){
submitBatchEdit('@url(repository)/issues/batchedit/label', $(this).data('id'));
submitBatchEdit('@helpers.url(repository)/issues/batchedit/label', $(this).data('id'));
});
$('a.toggle-assign').click(function(){
submitBatchEdit('@url(repository)/issues/batchedit/assign', $(this).data('name'));
submitBatchEdit('@helpers.url(repository)/issues/batchedit/assign', $(this).data('name'));
});
$('a.toggle-milestone').click(function(){
submitBatchEdit('@url(repository)/issues/batchedit/milestone', $(this).data('id'));
submitBatchEdit('@helpers.url(repository)/issues/batchedit/milestone', $(this).data('id'));
});
});
</script>

View File

@@ -9,8 +9,7 @@
labels: List[gitbucket.core.model.Label] = Nil,
repository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo] = None,
hasWritePermission: Boolean = false)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@import gitbucket.core.service.IssuesService.IssueInfo
@*
@if(condition.nonEmpty){
@@ -28,96 +27,96 @@
<th style="background-color: #eee;">
<input type="checkbox"/>
<span id="table-issues-control">
@helper.html.dropdown("Author") {
@gitbucket.core.helper.html.dropdown("Author") {
@collaborators.map { collaborator =>
<li>
<a href="@condition.copy(author = (if(condition.author == Some(collaborator)) None else Some(collaborator))).toURL">
@helper.html.checkicon(condition.author == Some(collaborator))
@avatar(collaborator, 20) @collaborator
@gitbucket.core.helper.html.checkicon(condition.author == Some(collaborator))
@helpers.avatar(collaborator, 20) @collaborator
</a>
</li>
}
}
@helper.html.dropdown("Label") {
@gitbucket.core.helper.html.dropdown("Label") {
@labels.map { label =>
<li>
<a href="@condition.copy(labels = (if(condition.labels.contains(label.labelName)) condition.labels - label.labelName else condition.labels + label.labelName)).toURL">
@helper.html.checkicon(condition.labels.contains(label.labelName))
@gitbucket.core.helper.html.checkicon(condition.labels.contains(label.labelName))
<span style="background-color: #@label.color;" class="label-color">&nbsp;&nbsp;</span>
@label.labelName
</a>
</li>
}
}
@helper.html.dropdown("Milestone") {
@gitbucket.core.helper.html.dropdown("Milestone") {
<li>
<a href="@condition.copy(milestone = (if(condition.milestone == Some(None)) None else Some(None))).toURL">
@helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone
@gitbucket.core.helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone
</a>
</li>
@milestones.filter(_.closedDate.isEmpty).map { milestone =>
<li>
<a href="@condition.copy(milestone = (if(condition.milestone == Some(Some(milestone.title))) None else Some(Some(milestone.title)))).toURL">
@helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title
@gitbucket.core.helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title
</a>
</li>
}
}
@helper.html.dropdown("Assignee") {
@gitbucket.core.helper.html.dropdown("Assignee") {
<li>
<a href="@condition.copy(assigned = (if(condition.assigned == Some(None)) None else Some(None))).toURL">
@helper.html.checkicon(condition.assigned == Some(None)) Assigned to nobody
@gitbucket.core.helper.html.checkicon(condition.assigned == Some(None)) Assigned to nobody
</a>
</li>
@collaborators.map { collaborator =>
<li>
<a href="@condition.copy(assigned = (if(condition.assigned == Some(Some(collaborator))) None else Some(Some(collaborator)))).toURL">
@helper.html.checkicon(condition.assigned == Some(Some(collaborator)))
@avatar(collaborator, 20) @collaborator
@gitbucket.core.helper.html.checkicon(condition.assigned == Some(Some(collaborator)))
@helpers.avatar(collaborator, 20) @collaborator
</a>
</li>
}
}
@helper.html.dropdown("Sort"){
@gitbucket.core.helper.html.dropdown("Sort"){
<li>
<a href="@condition.copy(sort="created", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
@gitbucket.core.helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
</a>
</li>
<li>
<a href="@condition.copy(sort="created", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
@gitbucket.core.helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
</a>
</li>
<li>
<a href="@condition.copy(sort="comments", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
@gitbucket.core.helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
</a>
</li>
<li>
<a href="@condition.copy(sort="comments", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
@gitbucket.core.helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
</a>
</li>
<li>
<a href="@condition.copy(sort="updated", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
@gitbucket.core.helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
</a>
</li>
<li>
<a href="@condition.copy(sort="updated", direction="asc" ).toURL">
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
@gitbucket.core.helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
</a>
</li>
}
</span>
@if(hasWritePermission){
<span id="table-issues-batchedit">
@helper.html.dropdown("Mark as") {
@gitbucket.core.helper.html.dropdown("Mark as") {
<li><a href="javascript:void(0);" class="toggle-state" data-id="open">Open</a></li>
<li><a href="javascript:void(0);" class="toggle-state" data-id="close">Close</a></li>
}
@helper.html.dropdown("Label") {
@gitbucket.core.helper.html.dropdown("Label") {
@labels.map { label =>
<li>
<a href="javascript:void(0);" class="toggle-label" data-id="@label.labelId">
@@ -128,16 +127,16 @@
</li>
}
}
@helper.html.dropdown("Milestone") {
@gitbucket.core.helper.html.dropdown("Milestone") {
<li><a href="javascript:void(0);" class="toggle-milestone" data-id="">No milestone</a></li>
@milestones.filter(_.closedDate.isEmpty).map { milestone =>
<li><a href="javascript:void(0);" class="toggle-milestone" data-id="@milestone.milestoneId">@milestone.title</a></li>
}
}
@helper.html.dropdown("Assignee") {
@gitbucket.core.helper.html.dropdown("Assignee") {
<li><a href="javascript:void(0);" class="toggle-assign" data-name=""><i class="octicon octicon-x"></i> Clear assignee</a></li>
@collaborators.map { collaborator =>
<li><a href="javascript:void(0);" class="toggle-assign" data-name="@collaborator"><i class="octicon"></i>@avatar(collaborator, 20) @collaborator</a></li>
<li><a href="javascript:void(0);" class="toggle-assign" data-name="@collaborator"><i class="octicon"></i>@helpers.avatar(collaborator, 20) @collaborator</a></li>
}
}
</span>
@@ -161,9 +160,9 @@
*@
@if(repository.isDefined){
@if(target == "issues"){
<a href="@url(repository.get)/issues/new">Create a new issue.</a>
<a href="@helpers.url(repository.get)/issues/new">Create a new issue.</a>
} else {
<a href="@url(repository.get)/compare">Create a new pull request.</a>
<a href="@helpers.url(repository.get)/compare">Create a new pull request.</a>
}
}
@*
@@ -182,33 +181,33 @@
<i class="octicon octicon-issue-@(if(issue.closed) "closed" else "opened")" style="margin-right: 3px;"></i>
*@
@if(repository.isEmpty){
<a href="@path/@issue.userName/@issue.repositoryName">@issue.repositoryName</a>&nbsp;&#xFF65;
<a href="@context.path/@issue.userName/@issue.repositoryName">@issue.repositoryName</a>&nbsp;&#xFF65;
}
@if(target == "issues"){
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-title">@issue.title</a>
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-title">@issue.title</a>
} else {
<a href="@path/@issue.userName/@issue.repositoryName/pull/@issue.issueId" class="issue-title">@issue.title</a>
<a href="@context.path/@issue.userName/@issue.repositoryName/pull/@issue.issueId" class="issue-title">@issue.title</a>
}
@commitstatus(issue, commitStatus)
@gitbucket.core.issues.html.commitstatus(issue, commitStatus)
@labels.map { label =>
<span class="label-color small" style="background-color: #@label.color; color: #@label.fontColor; padding-left: 4px; padding-right: 4px">@label.labelName</span>
}
<span class="pull-right small">
@issue.assignedUserName.map { userName =>
@avatar(userName, 20, tooltip = true)
@helpers.avatar(userName, 20, tooltip = true)
}
@if(commentCount > 0){
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count">
<i class="octicon octicon-comment active"></i> @commentCount
</a>
} else {
<a href="@path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count" style="color: silver;">
<a href="@context.path/@issue.userName/@issue.repositoryName/issues/@issue.issueId" class="issue-comment-count" style="color: silver;">
<i class="octicon octicon-comment"></i> @commentCount
</a>
}
</span>
<div class="small muted" style="margin-left: 12px; margin-top: 2px;">
#@issue.issueId opened @helper.html.datetimeago(issue.registeredDate) by @user(issue.openedUserName, styleClass="username")
#@issue.issueId opened @gitbucket.core.helper.html.datetimeago(issue.registeredDate) by @helpers.user(issue.openedUserName, styleClass="username")
@milestone.map { milestone =>
<span style="margin: 20px;"><a href="@condition.copy(milestone = Some(Some(milestone))).toURL" class="username"><i class="octicon octicon-milestone"></i> @milestone</a></span>
}
@@ -219,5 +218,5 @@
</tbody>
</table>
<div class="pull-right">
@helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), gitbucket.core.service.IssuesService.IssueLimit, 10, condition.toURL)
@gitbucket.core.helper.html.paginator(page, (if(condition.state == "open") openCount else closedCount), gitbucket.core.service.IssuesService.IssueLimit, 10, condition.toURL)
</div>

View File

@@ -1,15 +1,14 @@
@(milestone: Option[gitbucket.core.model.Milestone],
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"Milestones - ${repository.owner}/${repository.name}"){
@html.menu("milestones", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"Milestones - ${repository.owner}/${repository.name}"){
@gitbucket.core.html.menu("milestones", repository){
@if(milestone.isEmpty){
<h4>New milestone</h4>
<div class="muted">Create a new milestone to help organize your issues and pull requests.</div>
}
<hr style="margin-top: 12px; margin-bottom: 18px;" class="fill-width"/>
<form method="POST" action="@url(repository)/issues/milestones/@if(milestone.isEmpty){new}else{@milestone.get.milestoneId/edit}" validate="true">
<form method="POST" action="@helpers.url(repository)/issues/milestones/@if(milestone.isEmpty){new}else{@milestone.get.milestoneId/edit}" validate="true">
<fieldset class="form-group">
<input type="text" id="title" name="title" class="form-control" style="width: 500px;" value="@milestone.map(_.title)" placeholder="Title"/>
<span id="error-title" class="error"></span>
@@ -21,7 +20,7 @@
</fieldset>
<fieldset class="form-group">
<label for="dueDate" class="strong">Due Date</label>
@helper.html.datepicker("dueDate", milestone.flatMap(_.dueDate))
@gitbucket.core.helper.html.datepicker("dueDate", milestone.flatMap(_.dueDate))
<span id="error-dueDate" class="error"></span>
</fieldset>
<hr>
@@ -31,10 +30,10 @@
} else {
@if(milestone.get.closedDate.isDefined){
<input type="button" class="btn btn-default" value="Open" id="open"
onclick="location.href='@url(repository)/issues/milestones/@milestone.get.milestoneId/close';"/>
onclick="location.href='@helpers.url(repository)/issues/milestones/@milestone.get.milestoneId/close';"/>
} else {
<input type="button" class="btn btn-default" value="Close" id="close"
onclick="location.href='@url(repository)/issues/milestones/@milestone.get.milestoneId/open';"/>
onclick="location.href='@helpers.url(repository)/issues/milestones/@milestone.get.milestoneId/open';"/>
}
<input type="submit" class="btn btn-success" value="Update milestone"/>
}

View File

@@ -2,13 +2,12 @@
milestones: List[(gitbucket.core.model.Milestone, Int, Int)],
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"Milestones - ${repository.owner}/${repository.name}"){
@html.menu("milestones", repository){
@if(loginAccount.isDefined){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"Milestones - ${repository.owner}/${repository.name}"){
@gitbucket.core.html.menu("milestones", repository){
@if(context.loginAccount.isDefined){
<div class="pull-right" style="margin-bottom: 10px;">
<a class="btn btn-success" href="@url(repository)/issues/milestones/new">New milestone</a>
<a class="btn btn-success" href="@helpers.url(repository)/issues/milestones/new">New milestone</a>
</div>
}
<table class="table table-bordered table-hover table-issues">
@@ -35,17 +34,17 @@
<td style="padding-top: 15px; padding-bottom: 15px;">
<div class="milestone row">
<div class="col-md-4">
<a href="@url(repository)/issues?milestone=@milestone.title&state=open" class="milestone-title">@milestone.title</a>
<a href="@helpers.url(repository)/issues?milestone=@milestone.title&state=open" class="milestone-title">@milestone.title</a>
<div>
@if(milestone.closedDate.isDefined){
<span class="muted">Closed @helper.html.datetimeago(milestone.closedDate.get)</span>
<span class="muted">Closed @gitbucket.core.helper.html.datetimeago(milestone.closedDate.get)</span>
} else {
@milestone.dueDate.map { dueDate =>
@if(isPast(dueDate)){
@if(helpers.isPast(dueDate)){
<i class="octicon octicon-alert" style="color:#BD2C00;"></i>
<span class="muted milestone-alert">Due by @date(dueDate)</span>
<span class="muted milestone-alert">Due by @helpers.date(dueDate)</span>
} else {
<span class="muted">Due by @date(dueDate)</span>
<span class="muted">Due by @helpers.date(dueDate)</span>
}
}.getOrElse {
<span class="muted">No due date</span>
@@ -54,7 +53,7 @@
</div>
</div>
<div class="col-md-8">
@progress(openCount + closedCount, closedCount)
@gitbucket.core.issues.milestones.html.progress(openCount + closedCount, closedCount)
<div>
<div>
@if(closedCount == 0){
@@ -67,13 +66,13 @@
</div>
<div class="milestone-menu">
@if(hasWritePermission){
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/edit">Edit</a> &nbsp;&nbsp;
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/edit">Edit</a> &nbsp;&nbsp;
@if(milestone.closedDate.isDefined){
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/open">Open</a> &nbsp;&nbsp;
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/open">Open</a> &nbsp;&nbsp;
} else {
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/close">Close</a> &nbsp;&nbsp;
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/close">Close</a> &nbsp;&nbsp;
}
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/delete" class="delete">Delete</a>
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/delete" class="delete">Delete</a>
}
</div>
</div>
@@ -81,7 +80,7 @@
</div>
@if(milestone.description.isDefined){
<div class="milestone-description markdown-body">
@markdown(
@helpers.markdown(
markdown = milestone.description.get,
repository = repository,
enableWikiLink = false,
@@ -98,7 +97,7 @@
<td style="padding: 20px; background-color: #eee; text-align: center;">
No milestones to show.
@if(hasWritePermission){
<a href="@url(repository)/issues/milestones/new">Create a new milestone.</a>
<a href="@helpers.url(repository)/issues/milestones/new">Create a new milestone.</a>
}
</td>
</tr>

View File

@@ -1,56 +1,56 @@
@(title: String, repository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo] = None)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.plugin.PluginRegistry
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>@title</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon" href="@assets/common/images/gitbucket.png" type="image/vnd.microsoft.icon" />
<link rel="icon" href="@helpers.assets/common/images/gitbucket.png" type="image/vnd.microsoft.icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="@assets/vendors/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="@assets/vendors/octicons-4.2.0/octicons.css" rel="stylesheet">
<link href="@assets/vendors/datepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="@assets/vendors/colorpicker/css/bootstrap-colorpicker.css" rel="stylesheet">
<link href="@assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
<link href="@assets/vendors/facebox/facebox.css" rel="stylesheet"/>
<link href="@assets/vendors/AdminLTE-2.2.3/css/AdminLTE.min.css" rel="stylesheet">
<link href="@assets/vendors/AdminLTE-2.2.3/css/skins/skin-blue.min.css" rel="stylesheet">
<link href="@assets/common/css/gitbucket.css" rel="stylesheet">
<script src="@assets/vendors/jquery/jquery-1.11.1.js"></script>
<script src="@assets/vendors/dropzone/dropzone.js"></script>
<script src="@assets/common/js/validation.js"></script>
<script src="@assets/common/js/gitbucket.js"></script>
<script src="@assets/vendors/bootstrap-3.3.6/js/bootstrap.js"></script>
<script src="@assets/vendors/bootstrap3-typeahead/bootstrap3-typeahead.js"></script>
<script src="@assets/vendors/datepicker/js/moment.js"></script>
<script src="@assets/vendors/datepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="@assets/vendors/colorpicker/js/bootstrap-colorpicker.js"></script>
<script src="@assets/vendors/google-code-prettify/prettify.js"></script>
<script src="@assets/vendors/zclip/ZeroClipboard.min.js"></script>
<script src="@assets/vendors/elastic/jquery.elastic.source.js"></script>
<script src="@assets/vendors/facebox/facebox.js"></script>
<script src="@assets/vendors/jquery-hotkeys/jquery.hotkeys.js"></script>
<link href="@helpers.assets/vendors/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="@helpers.assets/vendors/octicons-4.2.0/octicons.css" rel="stylesheet">
<link href="@helpers.assets/vendors/datepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="@helpers.assets/vendors/colorpicker/css/bootstrap-colorpicker.css" rel="stylesheet">
<link href="@helpers.assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
<link href="@helpers.assets/vendors/facebox/facebox.css" rel="stylesheet"/>
<link href="@helpers.assets/vendors/AdminLTE-2.2.3/css/AdminLTE.min.css" rel="stylesheet">
<link href="@helpers.assets/vendors/AdminLTE-2.2.3/css/skins/skin-blue.min.css" rel="stylesheet">
<link href="@helpers.assets/common/css/gitbucket.css" rel="stylesheet">
<script src="@helpers.assets/vendors/jquery/jquery-1.11.1.js"></script>
<script src="@helpers.assets/vendors/dropzone/dropzone.js"></script>
<script src="@helpers.assets/common/js/validation.js"></script>
<script src="@helpers.assets/common/js/gitbucket.js"></script>
<script src="@helpers.assets/vendors/bootstrap-3.3.6/js/bootstrap.js"></script>
<script src="@helpers.assets/vendors/bootstrap3-typeahead/bootstrap3-typeahead.js"></script>
<script src="@helpers.assets/vendors/datepicker/js/moment.js"></script>
<script src="@helpers.assets/vendors/datepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="@helpers.assets/vendors/colorpicker/js/bootstrap-colorpicker.js"></script>
<script src="@helpers.assets/vendors/google-code-prettify/prettify.js"></script>
<script src="@helpers.assets/vendors/zclip/ZeroClipboard.min.js"></script>
<script src="@helpers.assets/vendors/elastic/jquery.elastic.source.js"></script>
<script src="@helpers.assets/vendors/facebox/facebox.js"></script>
<script src="@helpers.assets/vendors/jquery-hotkeys/jquery.hotkeys.js"></script>
<script src="@helpers.assets/vendors/jquery-textcomplete-1.6.2/jquery.textcomplete.js"></script>
@repository.map { repository =>
@if(!repository.repository.isPrivate){
<meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
}
}
<script src="@assets/vendors/AdminLTE-2.2.3/js/app.js" type="text/javascript"></script>
<script src="@helpers.assets/vendors/AdminLTE-2.2.3/js/app.js" type="text/javascript"></script>
</head>
<body class="skin-blue">
<div class="wrapper">
<header class="main-header">
<a href="@path/" class="logo">
<img src="@assets/common/images/gitbucket.png" style="width: 24px; height: 24px; display: inline;"/>
<a href="@context.path/" class="logo">
<img src="@helpers.assets/common/images/gitbucket.png" style="width: 24px; height: 24px; display: inline;"/>
GitBucket
<span class="header-version">@gitbucket.core.GitBucketCoreModule.getVersions.last.getVersion</span>
</a>
<nav class="navbar navbar-static-top" role="navigation">
@repository.map { repository =>
<form id="search" action="@path/search" method="POST" class="navbar-form navbar-left" role="search">
<form id="search" action="@context.path/search" method="POST" class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" name="query" id="navbar-search-input" class="form-control" placeholder="Search this repository"/>
<input type="hidden" name="owner" value="@repository.owner"/>
@@ -59,44 +59,44 @@
</form>
}
<ul class="nav navbar-nav">
@if(loginAccount.isDefined){
<li><a href="@path/dashboard/pulls">Pull requests</a></li>
<li><a href="@path/dashboard/issues">Issues</a></li>
@if(context.loginAccount.isDefined){
<li><a href="@context.path/dashboard/pulls">Pull requests</a></li>
<li><a href="@context.path/dashboard/issues">Issues</a></li>
}
@gitbucket.core.plugin.PluginRegistry().getGlobalMenus.map { menu =>
@menu(context).map { link =>
<li><a href="@path/@link.path">@link.label</a></li>
<li><a href="@context.path/@link.path">@link.label</a></li>
}
}
</ul>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
@if(loginAccount.isDefined){
@if(context.loginAccount.isDefined){
<li class="dropdown">
<a class="dropdown-toggle menu" data-toggle="dropdown" href="#">
<i class="octicon octicon-plus" style="color: black;"></i><span class="caret" style="color: black; vertical-align: middle;"></span>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="@path/new">New repository</a></li>
<li><a href="@path/groups/new">New group</a></li>
<li><a href="@context.path/new">New repository</a></li>
<li><a href="@context.path/groups/new">New group</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle menu" data-toggle="dropdown" href="#" data-toggle="tooltip" data-placement="bottom" title="Signed is as @loginAccount.get.userName">
@avatar(loginAccount.get.userName, 16)<span class="caret" style="color: black; vertical-align: middle;"></span>
<a class="dropdown-toggle menu" data-toggle="dropdown" href="#" data-toggle="tooltip" data-placement="bottom" title="Signed is as @context.loginAccount.get.userName">
@helpers.avatar(context.loginAccount.get.userName, 16)<span class="caret" style="color: black; vertical-align: middle;"></span>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="@url(loginAccount.get.userName)">Your profile</a></li>
<li><a href="@url(loginAccount.get.userName)/_edit">Account settings</a></li>
@if(loginAccount.get.isAdmin){
<li><a href="@path/admin/users">System administration</a></li>
<li><a href="@helpers.url(context.loginAccount.get.userName)">Your profile</a></li>
<li><a href="@helpers.url(context.loginAccount.get.userName)/_edit">Account settings</a></li>
@if(context.loginAccount.get.isAdmin){
<li><a href="@context.path/admin/users">System administration</a></li>
}
<li><a href="@path/signout">Sign out</a></li>
<li><a href="@context.path/signout">Sign out</a></li>
</ul>
</li>
} else {
<li>
<a href="@path/signin?redirect=@urlEncode(currentPath)" class="pull-right" id="signin">Sign in</a>
<a href="@context.path/signin?redirect=@helpers.urlEncode(context.currentPath)" class="pull-right" id="signin">Sign in</a>
</li>
}
</ul>
@@ -112,7 +112,7 @@
});
});
</script>
@PluginRegistry().getJavaScript(request.getRequestURI).map { script =>
@PluginRegistry().getJavaScript(context.request.getRequestURI).map { script =>
<script>
@Html(script)
</script>

View File

@@ -3,18 +3,17 @@
id: Option[String] = None,
info: Option[Any] = None,
error: Option[Any] = None)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers
@menuitem(path: String, name: String, label: String, icon: String, count: Int = 0) = {
<li @if(active == name){class="active"}>
@if(path.startsWith("http")){
<a href="@path" target="_blank">
<i class="menu-icon octicon octicon-@icon"></i> <span class="pc">@label @if(count > 0) { <span class="label label-primary pull-right">@count</span> }</span>
<i class="menu-icon octicon octicon-@icon"></i> @label @if(count > 0) { <span class="label label-primary pull-right">@count</span> }
</a>
} else {
<a href="@url(repository)@path">
<i class="menu-icon octicon octicon-@icon"></i> <span class="pc">@label @if(count > 0) { <span class="label label-primary pull-right">@count</span> }</span>
<a href="@helpers.url(repository)@path">
<i class="menu-icon octicon octicon-@icon"></i> @label @if(count > 0) { <span class="label label-primary pull-right">@count</span> }
</a>
}
</li>
@@ -46,7 +45,7 @@
}
}
@menuitem("/network/members", "fork", "Forks", "repo-forked", repository.forkedCount)
@if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
@if(context.loginAccount.isDefined && (context.loginAccount.get.isAdmin || repository.managers.contains(context.loginAccount.get.userName))){
@menuitem("/settings", "settings", "Settings", "tools")
}
@gitbucket.core.plugin.PluginRegistry().getRepositoryMenus.map { menu =>
@@ -58,23 +57,23 @@
</div>
</div>
<div class="content-wrapper">
<div class="content body">
<div class="content body clearfix">
<div class="headbar">
<div class="container">
@helper.html.information(info)
@helper.html.error(error)
@gitbucket.core.helper.html.information(info)
@gitbucket.core.helper.html.error(error)
<div class="head">
@helper.html.repositoryicon(repository, true)
<a href="@url(repository.owner)">@repository.owner</a> / <a href="@url(repository)" class="strong">@repository.name</a>
@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>
@defining(repository.repository){ x =>
@if(repository.repository.originRepositoryName.isDefined){
<div class="forked">
forked from <a href="@path/@x.parentUserName/@x.parentRepositoryName">@x.parentUserName/@x.parentRepositoryName</a>
forked from <a href="@context.path/@x.parentUserName/@x.parentRepositoryName">@x.parentUserName/@x.parentRepositoryName</a>
</div>
}
@x.description.map { description =>
<div class="normal muted" style="margin-left: 36px; font-size: 80%;">@detectAndRenderLinks(description)</div>
<div class="normal muted" style="margin-left: 36px; font-size: 80%;">@Html(helpers.detectAndRenderLinks(description, repository))</div>
}
}
</div>

View File

@@ -1,39 +1,37 @@
@(commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]],
comments: Option[List[gitbucket.core.model.Comment]] = None,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.model._
@import gitbucket.core.view.helpers
<table class="table table-bordered">
@commits.map { day =>
<tr>
<th rowspan="@day.size" width="100">@date(day.head.commitTime)</th>
<th rowspan="@day.size" width="100">@helpers.date(day.head.commitTime)</th>
@day.zipWithIndex.map { case (commit, i) =>
@if(i != 0){ <tr> }
<td>
<div class="pull-right text-right">
<a href="@url(repository)/commit/@commit.id" class="monospace commit-message strong"><i class="octicon octicon-diff" style="color: black;"></i>@commit.id.substring(0, 7)</a><br>
<a href="@url(repository)/tree/@commit.id" class="button-link">Browse files »</a>
<a href="@helpers.url(repository)/commit/@commit.id" class="monospace commit-message strong"><i class="octicon octicon-diff" style="color: black;"></i>@commit.id.substring(0, 7)</a><br>
<a href="@helpers.url(repository)/tree/@commit.id" class="button-link">Browse files »</a>
</div>
<div>
<div class="commit-avatar-image">@avatarLink(commit, 40)</div>
<div class="commit-avatar-image">@helpers.avatarLink(commit, 40)</div>
<div>
<a href="@url(repository)/commit/@commit.id" class="commit-message strong">@link(commit.summary, repository)</a>
<a href="@helpers.url(repository)/commit/@commit.id" class="commit-message strong">@helpers.link(commit.summary, repository)</a>
@if(commit.description.isDefined){
<a href="javascript:void(0)" onclick="$('#description-@commit.id').toggle();" class="omit">...</a>
}
<br>
@if(commit.description.isDefined){
<pre id="description-@commit.id" style="display: none;" class="commit-description">@link(commit.description.get, repository)</pre>
<pre id="description-@commit.id" style="display: none;" class="commit-description">@helpers.link(commit.description.get, repository)</pre>
}
<div>
@if(commit.isDifferentFromAuthor) {
@user(commit.authorName, commit.authorEmailAddress, "username")
<span class="muted">authored @helper.html.datetimeago(commit.authorTime)</span>
@helpers.user(commit.authorName, commit.authorEmailAddress, "username")
<span class="muted">authored @gitbucket.core.helper.html.datetimeago(commit.authorTime)</span>
<span class="octicon octicon-arrow-right" style="margin-top : -2px;"></span>
}
@user(commit.committerName, commit.committerEmailAddress, "username")
<span class="muted">committed @helper.html.datetimeago(commit.commitTime)</span>
@helpers.user(commit.committerName, commit.committerEmailAddress, "username")
<span class="muted">committed @gitbucket.core.helper.html.datetimeago(commit.commitTime)</span>
</div>
</div>
</div>

View File

@@ -14,51 +14,50 @@
collaborators: List[String],
milestones: List[gitbucket.core.model.Milestone],
labels: List[gitbucket.core.model.Label])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){
@html.menu("pulls", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"Pull Requests - ${repository.owner}/${repository.name}", Some(repository)){
@gitbucket.core.html.menu("pulls", repository){
<div class="pullreq-info">
<div id="compare-edit">
@helper.html.dropdown(originRepository.owner + "/" + originRepository.name, "base fork") {
@gitbucket.core.helper.html.dropdown(originRepository.owner + "/" + originRepository.name, "base fork") {
@members.map { case (owner, name) =>
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name">@helper.html.checkicon(owner == originRepository.owner) @owner/@name</a></li>
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name">@gitbucket.core.helper.html.checkicon(owner == originRepository.owner) @owner/@name</a></li>
}
}
@helper.html.dropdown(originId, "base") {
@gitbucket.core.helper.html.dropdown(originId, "base") {
@originRepository.branchList.map { branch =>
<li><a href="#" class="origin-branch" data-branch="@encodeRefName(branch)">@helper.html.checkicon(branch == originId) @branch</a></li>
<li><a href="#" class="origin-branch" data-branch="@helpers.encodeRefName(branch)">@gitbucket.core.helper.html.checkicon(branch == originId) @branch</a></li>
}
}
...
@helper.html.dropdown(forkedRepository.owner + "/" + forkedRepository.name, "head fork") {
@gitbucket.core.helper.html.dropdown(forkedRepository.owner + "/" + forkedRepository.name, "head fork") {
@members.map { case (owner, name) =>
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name">@helper.html.checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name">@gitbucket.core.helper.html.checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
}
}
@helper.html.dropdown(forkedId, "compare") {
@gitbucket.core.helper.html.dropdown(forkedId, "compare") {
@forkedRepository.branchList.map { branch =>
<li><a href="#" class="forked-branch" data-branch="@encodeRefName(branch)">@helper.html.checkicon(branch == forkedId) @branch</a></li>
<li><a href="#" class="forked-branch" data-branch="@helpers.encodeRefName(branch)">@gitbucket.core.helper.html.checkicon(branch == forkedId) @branch</a></li>
}
}
</div>
<div class="check-conflict" style="display: none;">
<img src="@assets/common/images/indicator.gif"/> Checking...
<img src="@helpers.assets/common/images/indicator.gif"/> Checking...
</div>
</div>
@if(commits.nonEmpty && loginAccount.isDefined){
@if(commits.nonEmpty && context.loginAccount.isDefined){
<div style="margin-bottom: 10px; padding: 8px; background-color: #fff9ea" id="create-pull-request" class="box-content">
<a href="#" class="btn btn-success" id="show-form">Create pull request</a>
&nbsp;&nbsp;
<span class="muted">Discuss and review the changes in this comparison with others.</span>
</div>
<div id="pull-request-form" @*class="box"*@ style="display: none; margin-bottom: 20px;">
<form method="POST" action="@path/@originRepository.owner/@originRepository.name/pulls/new" validate="true">
<form method="POST" action="@context.path/@originRepository.owner/@originRepository.name/pulls/new" validate="true">
<div class="row">
<div class="col-md-9">
<span class="error" id="error-title"></span>
<input type="text" name="title" value="@title" class="form-control" style="margin-bottom: 6px;" placeholder="Title"/>
@helper.html.preview(
@gitbucket.core.helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
@@ -66,6 +65,7 @@
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = true,
completionContext = "issues",
style = "height: 200px;"
)
<input type="hidden" name="targetUserName" value="@originRepository.owner"/>
@@ -80,7 +80,7 @@
</div>
</div>
<div class="col-md-3">
@issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map((_, 0, 0)), labels, hasOriginWritePermission, repository)
@gitbucket.core.issues.html.issueinfo(None, Nil, Nil, collaborators, milestones.map((_, 0, 0)), labels, hasOriginWritePermission, repository)
</div>
</div>
</form>
@@ -108,23 +108,23 @@
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-commit"></i>
@defining(commits.flatten){ commits =>
<strong>@commits.size</strong> @plural(commits.size, "commit")
<strong>@commits.size</strong> @helpers.plural(commits.size, "commit")
}
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-diff"></i>
<strong>@diffs.size</strong> @plural(diffs.size, "file") changed
<strong>@diffs.size</strong> @helpers.plural(diffs.size, "file") changed
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-comment"></i>
@defining(comments.collect { case c: gitbucket.core.model.CommitComment => c }){ comments =>
<strong>@comments.size</strong> commit @plural(comments.size, "comment")
<strong>@comments.size</strong> commit @helpers.plural(comments.size, "comment")
}
</td>
<td style="width: 25%; text-align: center;">
<i class="octicon octicon-organization"></i>
@defining(commits.flatMap(_.map(_.authorEmailAddress)).distinct){ contributors =>
<strong>@contributors.size</strong> @plural(contributors.size, "contributor")
<strong>@contributors.size</strong> @helpers.plural(contributors.size, "contributor")
}
</td>
</tr>
@@ -133,16 +133,16 @@
<div class="box" style="margin-bottom: 20px;">
@commits.map { day =>
<div style="margin-top: 8px; margin-bottom: 8px;" class="muted">
Commits on @date(day.head.commitTime)
Commits on @helpers.date(day.head.commitTime)
</div>
<table style="width: 100%;">
@day.map { commit =>
<tr>
<td style="width: 20%;">
<i class="octicon octicon-git-commit"></i>
@avatar(commit, 20)
@user(commit.authorName, commit.authorEmailAddress, "username strong")
</td>
@helpers.avatar(commit, 20)
@helpers.user(commit.authorName, commit.authorEmailAddress, "username strong")
</td>
<td><span class="monospace">@commit.shortMessage</span></td>
@*
<span class="badge" style="display: inline">@if(comments.isDefined){
@@ -153,16 +153,16 @@
}</span>
*@
<td style="width: 10%; text-align: right;">
<a href="@url(repository)/commit/@commit.id" class="monospace">@commit.id.substring(0, 7)</a>
<a href="@helpers.url(repository)/commit/@commit.id" class="monospace">@commit.id.substring(0, 7)</a>
</td>
</tr>
}
</table>
}
</div>
@helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true, None, false, false)
@gitbucket.core.helper.html.diff(diffs, repository, Some(commitId), Some(sourceId), true, None, false, false)
<p>Showing you all comments on commits in this comparison.</p>
@issues.html.commentlist(None, comments, false, repository, None)
@gitbucket.core.issues.html.commentlist(None, comments, false, repository, None)
}
}
}
@@ -175,11 +175,11 @@ $(function(){
e.parents('div.btn-group').find('button span.strong').text(e.text());
@if(members.isEmpty){
location.href = '@url(repository)/compare/' +
location.href = '@helpers.url(repository)/compare/' +
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' +
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'));
} else {
location.href = '@path/' +
location.href = '@context.path/' +
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' +
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' +
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' +
@@ -197,10 +197,10 @@ $(function(){
$('#show-form').click();
}
@if(loginAccount.isDefined){
@if(context.loginAccount.isDefined){
function checkConflict(from, to){
$('.check-conflict').show();
$.get('@url(forkedRepository)/compare/' + from + '...' + to + '/mergecheck',
$.get('@helpers.url(forkedRepository)/compare/' + from + '...' + to + '/mergecheck',
function(data){ $('.check-conflict').html(data); });
}

View File

@@ -7,12 +7,10 @@
labels: List[gitbucket.core.model.Label],
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.model._
@import gitbucket.core.view.helpers
<div class="col-md-9">
<div id="comment-list">
@issues.html.commentlist(Some(issue), comments, hasWritePermission, repository, Some(pullreq))
@gitbucket.core.issues.html.commentlist(Some(issue), comments, hasWritePermission, repository, Some(pullreq))
</div>
@defining(comments.flatMap {
case comment: gitbucket.core.model.IssueComment => Some(comment)
@@ -20,18 +18,18 @@
}.exists(_.action == "merge")){ merged =>
@if(!issue.closed){
<div class="check-conflict" style="display: none;">
<div class="box issue-comment-box" style="background-color: #fbeed5">
<div class="issue-comment-box" style="background-color: #fbeed5">
<div class="box-content"class="issue-content" style="border: 1px solid #c09853; padding: 10px;">
<img src="@assets/common/images/indicator.gif"/> Checking...
<img src="@helpers.assets/common/images/indicator.gif"/> Checking...
</div>
</div>
</div>
}
@if(hasWritePermission && issue.closed && pullreq.userName == pullreq.requestUserName && merged &&
pullreq.repositoryName == pullreq.requestRepositoryName && repository.branchList.contains(pullreq.requestBranch)){
<div class="box issue-comment-box" style="background-color: #d0eeff;">
<div class="issue-comment-box" style="background-color: #d0eeff;">
<div class="box-content"class="issue-content" style="border: 1px solid #87a8c9; padding: 10px;">
<a href="@url(repository)/pull/@issue.issueId/delete/@encodeRefName(pullreq.requestBranch)" class="btn btn-info pull-right delete-branch" data-name="@pullreq.requestBranch">Delete branch</a>
<a href="@helpers.url(repository)/pull/@issue.issueId/delete/@helpers.encodeRefName(pullreq.requestBranch)" class="btn btn-info pull-right delete-branch" data-name="@pullreq.requestBranch">Delete branch</a>
<div>
<span class="strong">Pull request successfully merged and closed</span>
</div>
@@ -39,11 +37,11 @@
</div>
</div>
}
@issues.html.commentform(issue, !merged, hasWritePermission, repository)
@gitbucket.core.issues.html.commentform(issue, !merged, hasWritePermission, repository)
}
</div>
<div class="col-md-3">
@issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
@gitbucket.core.issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
</div>
<script>
$(function(){
@@ -54,7 +52,7 @@ $(function(){
var checkConflict = $('.check-conflict').show();
if(checkConflict.length){
$.get('@url(repository)/pull/@issue.issueId/mergeguide', function(data){ $('.check-conflict').html(data); });
$.get('@helpers.url(repository)/pull/@issue.issueId/mergeguide', function(data){ $('.check-conflict').html(data); });
}
@if(hasWritePermission){

View File

@@ -3,19 +3,16 @@
pullreq: gitbucket.core.model.PullRequest,
originRepository: gitbucket.core.service.RepositoryService.RepositoryInfo,
forkedRepository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.service.SystemSettingsService
@import context._
@import gitbucket.core.view.helpers._
@import model.CommitState
<div class="box issue-comment-box" style="background-color: @if(status.hasProblem){ #fbeed5 }else{ #d8f5cd };">
@import gitbucket.core.view.helpers
<div class="issue-comment-box" style="background-color: @if(status.hasProblem){ #fbeed5 }else{ #d8f5cd };">
<div class="box-content issue-content" style="border: 1px solid @if(status.hasProblem){ #c09853 }else{ #95c97e };padding:0">
<div id="merge-pull-request">
@if(!status.statuses.isEmpty){
<div class="build-statuses">
@defining(status.commitStateSummary){ case (summaryState, summary) =>
<a class="pull-right" id="toggle-all-checks"></a>
<span class="build-status-icon text-@{summaryState.name}">@commitStateIcon(summaryState)</span>
<strong class="text-@{summaryState.name}">@commitStateText(summaryState, pullreq.commitIdTo)</strong>
<span class="build-status-icon text-@{summaryState.name}">@helpers.commitStateIcon(summaryState)</span>
<strong class="text-@{summaryState.name}">@helpers.commitStateText(summaryState, pullreq.commitIdTo)</strong>
<span class="text-@{summaryState.name}">— @summary checks</span>
}
</div>
@@ -26,7 +23,7 @@
@if(required){ <span class="label">Required</span> }
@status.targetUrl.map { url => <a href="@url">Details</a> }
</div>
<span class="build-status-icon text-@{status.state.name}">@commitStateIcon(status.state)</span>
<span class="build-status-icon text-@{status.state.name}">@helpers.commitStateIcon(status.state)</span>
<strong>@status.context</strong>
@status.description.map { desc => <span class="muted">— @desc</span> }
</div>
@@ -48,7 +45,7 @@
@if(status.branchIsOutOfDate){
@if(status.hasUpdatePermission){
<div class="pull-right">
<form method="POST" action="@url(originRepository)/pull/@pullreq.issueId/update_branch">
<form method="POST" action="@helpers.url(originRepository)/pull/@pullreq.issueId/update_branch">
<input type="hidden" name="expected_head_oid" value="@pullreq.commitIdFrom">
<button class="btn btn-default"@if(!status.canUpdate){ disabled="true"} id="update-branch-button">Update branch</button>
</form>
@@ -102,10 +99,10 @@
you can perform a manual merge on the command line.
</p>
}
@helper.html.copy("repository-url-copy", forkedRepository.httpUrl){
@gitbucket.core.helper.html.copy("repository-url-copy", forkedRepository.httpUrl){
<div class="input-group-btn" data-toggle="buttons">
<label class="btn btn-sm btn-default active" id="repository-url-http"><input type="radio" checked>HTTP</label>
@if(settings.ssh && loginAccount.isDefined){
@if(context.settings.ssh && context.loginAccount.isDefined){
<label class="btn btn-sm btn-default" id="repository-url-ssh"><input type="radio">SSH</label>
}
</div>
@@ -117,7 +114,7 @@
</p>
@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" +
s"git pull ${forkedRepository.httpUrl} ${pullreq.requestBranch}"){ command =>
@helper.html.copy("merge-command-copy-1", command, "position: absolute; right: 31px;")()
@gitbucket.core.helper.html.copy("merge-command-copy-1", command, "position: absolute; right: 31px;")()
<pre style="font-size: 12px; border-radius: 3px;" id="merge-command">@Html(command)</pre>
}
</div>
@@ -127,7 +124,7 @@
</p>
@defining(s"git checkout ${pullreq.branch}\ngit merge --no-ff ${pullreq.requestUserName}-${pullreq.requestBranch}\n" +
s"git push origin ${pullreq.branch}"){ command =>
@helper.html.copy("merge-command-copy-2", command, "position: absolute; right: 31px;")()
@gitbucket.core.helper.html.copy("merge-command-copy-2", command, "position: absolute; right: 31px;")()
<pre style="font-size: 12px; border-radius: 3px;">@command</pre>
}
</div>
@@ -136,7 +133,7 @@
}
</div>
<div id="confirm-merge-form" style="display: none; padding: 12px;">
<form method="POST" action="@url(originRepository)/pull/@pullreq.issueId/merge">
<form method="POST" action="@helpers.url(originRepository)/pull/@pullreq.issueId/merge" validate="true">
<div class="strong">
Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
</div>

View File

@@ -10,19 +10,19 @@
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
flash: Map[String, String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.model._
@html.main(s"${issue.title} - Pull Request #${issue.issueId} - ${repository.owner}/${repository.name}", Some(repository)){
@html.menu("pulls", repository){
@import gitbucket.core.view.helpers
@import gitbucket.core.model.IssueComment
@import gitbucket.core.model.CommitComment
@gitbucket.core.html.main(s"${issue.title} - Pull Request #${issue.issueId} - ${repository.owner}/${repository.name}", Some(repository)){
@gitbucket.core.html.menu("pulls", repository){
@defining(dayByDayCommits.flatten){ commits =>
<div>
<div class="show-title pull-right">
@if(hasWritePermission || loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){
@if(hasWritePermission || context.loginAccount.map(_.userName == issue.openedUserName).getOrElse(false)){
<a class="btn" href="#" id="edit">Edit</a>
}
@if(loginAccount.isDefined){
<a class="btn btn-success" href="@url(repository)/compare">New pull request</a>
@if(context.loginAccount.isDefined){
<a class="btn btn-success" href="@helpers.url(repository)/compare">New pull request</a>
}
</div>
<div class="edit-title pull-right" style="display: none;">
@@ -47,21 +47,21 @@
}.find(_.action == "merge").map{ comment =>
<span class="label label-info issue-status">Merged</span>
<span class="muted">
@user(comment.commentedUserName, styleClass="username strong") merged @commits.size @plural(commits.size, "commit")
@helpers.user(comment.commentedUserName, styleClass="username strong") merged @commits.size @helpers.plural(commits.size, "commit")
into <code>@pullreq.userName:@pullreq.branch</code> from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
@helper.html.datetimeago(comment.registeredDate)
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
</span>
}.getOrElse {
<span class="label label-important issue-status">Closed</span>
<span class="muted">
@user(issue.openedUserName, styleClass="username strong") wants to merge @commits.size @plural(commits.size, "commit")
@helpers.user(issue.openedUserName, styleClass="username strong") wants to merge @commits.size @helpers.plural(commits.size, "commit")
into <code>@pullreq.userName:@pullreq.branch</code> from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
</span>
}
} else {
<span class="label label-success issue-status">Open</span>
<span class="muted">
@user(issue.openedUserName, styleClass="username strong") wants to merge @commits.size @plural(commits.size, "commit")
@helpers.user(issue.openedUserName, styleClass="username strong") wants to merge @commits.size @helpers.plural(commits.size, "commit")
into <code>@pullreq.userName:@pullreq.branch</code> from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
</span>
}
@@ -82,13 +82,13 @@
@flash.get("info").map{ info =>
<div class="alert alert-info">@info</div>
}
@pulls.html.conversation(issue, pullreq, comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
@gitbucket.core.pulls.html.conversation(issue, pullreq, comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
</div>
<div class="tab-pane" id="commits">
@pulls.html.commits(dayByDayCommits, Some(comments), repository)
@gitbucket.core.pulls.html.commits(dayByDayCommits, Some(comments), repository)
</div>
<div class="tab-pane" id="files">
@helper.html.diff(diffs, repository, Some(commits.head.id), Some(commits.last.id), true, Some(pullreq.issueId), hasWritePermission, true)
@gitbucket.core.helper.html.diff(diffs, repository, Some(commits.head.id), Some(commits.last.id), true, Some(pullreq.issueId), hasWritePermission, true)
</div>
</div>
}
@@ -126,7 +126,7 @@ $(function(){
$('#update').click(function(){
$(this).attr('disabled', 'disabled');
$.ajax({
url: '@url(repository)/issues/edit_title/@issue.issueId',
url: '@helpers.url(repository)/issues/edit_title/@issue.issueId',
type: 'POST',
data: {
title : $('#edit-title').val()

View File

@@ -5,13 +5,12 @@
latestCommit: gitbucket.core.util.JGitUtil.CommitInfo,
hasWritePermission: Boolean,
isBlame: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"${(repository.name :: pathList).mkString("/")} at ${encodeRefName(branch)} - ${repository.owner}/${repository.name}", Some(repository)) {
@html.menu("files", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"${(repository.name :: pathList).mkString("/")} at ${helpers.encodeRefName(branch)} - ${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("files", repository){
<div class="head">
<div class="pull-right hide-if-blame"><div class="btn-group">
<a href="@url(repository)/find/@encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t">Find file</a>
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t">Find file</a>
</div></div>
<div class="line-age-legend">
<span>Newer</span>
@@ -29,71 +28,71 @@
</ol>
<span>Older</span>
</div>
@helper.html.branchcontrol(
@gitbucket.core.helper.html.branchcontrol(
branch,
repository,
hasWritePermission
){
@repository.branchList.map { x =>
<li><a href="@url(repository)/blob/@encodeRefName(x)/@pathList.mkString("/")">@helper.html.checkicon(x == branch) @x</a></li>
<li><a href="@helpers.url(repository)/blob/@helpers.encodeRefName(x)/@pathList.mkString("/")">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
}
}
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
@if(i == pathList.length - 1){
@section
} else {
<a href="@url(repository)/tree/@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> /
}
}
</div>
<div class="box-header">
@avatar(latestCommit, 28)
@user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
<span class="muted">@helper.html.datetimeago(latestCommit.commitTime)</span>
<a href="@url(repository)/commit/@latestCommit.id" class="commit-message">@link(latestCommit.summary, repository)</a>
@helpers.avatar(latestCommit, 28)
@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
<span class="muted">@gitbucket.core.helper.html.datetimeago(latestCommit.commitTime)</span>
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
<div class="btn-group pull-right">
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
<a class="btn btn-sm btn-default" href="@url(repository)/edit/@encodeRefName(branch)/@pathList.mkString("/")">Edit</a>
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/edit/@helpers.encodeRefName(branch)/@pathList.mkString("/")">Edit</a>
}
<a class="btn btn-sm btn-default" href="@url(repository)/raw/@latestCommit.id/@pathList.mkString("/")">Raw</a>
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/raw/@latestCommit.id/@pathList.mkString("/")">Raw</a>
@if(content.viewType == "text"){
<a class="btn btn-sm btn-default blame-action" href="@url(repository)/blame/@latestCommit.id/@pathList.mkString("/")" data-url="@url(repository)/get-blame/@latestCommit.id/@pathList.mkString("/")" data-repository="@url(repository)">Blame</a>
<a class="btn btn-sm btn-default blame-action" href="@helpers.url(repository)/blame/@latestCommit.id/@pathList.mkString("/")" data-url="@helpers.url(repository)/get-blame/@latestCommit.id/@pathList.mkString("/")" data-repository="@helpers.url(repository)">Blame</a>
}
<a class="btn btn-sm btn-default" href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")">History</a>
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/commits/@helpers.encodeRefName(branch)/@pathList.mkString("/")">History</a>
@if(hasWritePermission && repository.branchList.contains(branch)){
<a class="btn btn-sm btn-danger" href="@url(repository)/remove/@encodeRefName(branch)/@pathList.mkString("/")">Delete</a>
<a class="btn btn-sm btn-danger" href="@helpers.url(repository)/remove/@helpers.encodeRefName(branch)/@pathList.mkString("/")">Delete</a>
}
</div>
</div>
@if(content.viewType == "text"){
@defining(isRenderable(pathList.reverse.head)){ isRrenderable =>
@if(!isBlame && isRrenderable) {
@defining(helpers.isRenderable(pathList.reverse.head)){ isRenderable =>
@if(!isBlame && isRenderable) {
<div class="box-content-bottom markdown-body" style="padding-left: 20px; padding-right: 20px;">
@renderMarkup(pathList, content.content.get, branch, repository, false, false, true)
@helpers.renderMarkup(pathList, content.content.get, branch, repository, false, false, true)
</div>
} else {
<div class="box-content-bottom">
<pre class="prettyprint linenums blob @if(!isRrenderable){ no-renderable } ">@content.content.get</pre>
<pre class="prettyprint linenums blob @if(!isRenderable){ no-renderable } ">@content.content.get</pre>
</div>
}
}
}
@if(content.viewType == "image"){
<div class="box-content-bottom">
<img src="@url(repository)/raw/@encodeRefName(branch)/@pathList.mkString("/")"/>
<img src="@helpers.url(repository)/raw/@helpers.encodeRefName(branch)/@pathList.mkString("/")"/>
</div>
}
@if(content.viewType == "large" || content.viewType == "binary"){
<div class="box-content-bottom" style="text-align: center; padding-top: 20px; padding-bottom: 20px;">
<a href="@url(repository)/raw/@encodeRefName(branch)/@pathList.mkString("/")">View Raw</a><br>
<a href="@helpers.url(repository)/raw/@helpers.encodeRefName(branch)/@pathList.mkString("/")">View Raw</a><br>
<br>
(Sorry about that, but we can't show files that are this big right now)
</div>
}
}
}
<script src="@assets/vendors/jquery/jquery.ba-hashchange.js"></script>
<script src="@helpers.assets/vendors/jquery/jquery.ba-hashchange.js"></script>
<script>
$(window).load(function(){
$(window).hashchange(function(){

View File

@@ -1,10 +1,9 @@
@(branchInfo: Seq[(gitbucket.core.util.JGitUtil.BranchInfo, Option[(gitbucket.core.model.PullRequest, gitbucket.core.model.Issue)], Boolean)],
hasWritePermission: Boolean,
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("branches", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("branches", repository){
<table class="table table-bordered table-hover branches">
<thead>
<tr>
@@ -18,29 +17,29 @@
<div class="branch-action">
@branch.mergeInfo.map{ info =>
@prs.map{ case (pull, issue) =>
<a href="@url(repository)/pull/@issue.issueId" title="@issue.title">#@issue.issueId</a>
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title">#@issue.issueId</a>
@if(issue.closed) {
@if(info.isMerged){
<a href="@url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-info">Merged</a>
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-info">Merged</a>
} else {
<a href="@url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-important">Closed</a>
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-important">Closed</a>
}
} else {
<a href="@url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-success">Open</a>
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-success">Open</a>
}
}.getOrElse{
@if(context.loginAccount.isDefined){
<a href="@url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
urlEncode(parent) + ":" + encodeRefName(repository.repository.defaultBranch)
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
}.getOrElse {
encodeRefName(repository.repository.defaultBranch)
}}...@{encodeRefName(branch.name)}?expand=1" class="btn btn-success">New Pull Request</a>
helpers.encodeRefName(repository.repository.defaultBranch)
}}...@{helpers.encodeRefName(branch.name)}?expand=1" class="btn btn-success">New Pull Request</a>
} else {
<a href="@url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
urlEncode(parent) + ":" + encodeRefName(repository.repository.defaultBranch)
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
}.getOrElse {
encodeRefName(repository.repository.defaultBranch)
}}...@{encodeRefName(branch.name)}" class="btn btn-success">Compare</a>
helpers.encodeRefName(repository.repository.defaultBranch)
}}...@{helpers.encodeRefName(branch.name)}" class="btn btn-success">Compare</a>
}
}
@if(hasWritePermission){
@@ -51,7 +50,7 @@
@if(isProtected){
<a class="disabled" data-toggle="tooltip" title="You cant delete a protected branch."><i class="octicon octicon-trashcan"></i></a>
} else {
<a href="@url(repository)/delete/@encodeRefName(branch.name)" class="delete-branch" data-name="@branch.name" @if(info.isMerged){ data-toggle="tooltip" title="this branch is merged" }><i class="octicon octicon-trashcan @if(info.isMerged){warning} else {danger}"></i></a>
<a href="@helpers.url(repository)/delete/@helpers.encodeRefName(branch.name)" class="delete-branch" data-name="@branch.name" @if(info.isMerged){ data-toggle="tooltip" title="this branch is merged" }><i class="octicon octicon-trashcan @if(info.isMerged){warning} else {danger}"></i></a>
}
}
</span>
@@ -60,10 +59,10 @@
</div>
<div class="branch-details">
@if(isProtected){ <span class="octicon octicon-shield" title="This branch is protected"></span> }
<a href="@url(repository)/tree/@encodeRefName(branch.name)" class="branch-name">@branch.name</a>
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch.name)" class="branch-name">@branch.name</a>
<span class="branch-meta">
<span>Updated @helper.html.datetimeago(branch.commitTime, false)
by <span>@user(branch.committerName, branch.committerEmailAddress, "muted-link")</span>
<span>Updated @gitbucket.core.helper.html.datetimeago(branch.commitTime, false)
by <span>@helpers.user(branch.committerName, branch.committerEmailAddress, "muted-link")</span>
</span>
</span>
</div>

View File

@@ -5,17 +5,16 @@
issueId: Option[Int] = None,
hasWritePermission: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@if(loginAccount.isDefined){
@import gitbucket.core.view.helpers
@if(context.loginAccount.isDefined){
@if(!fileName.isDefined){<hr/><br/>}
<form method="POST" validate="true" style="max-width: 874px;">
@if(!fileName.isDefined){
<div class="issue-avatar-image">@avatarLink(loginAccount.get.userName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(context.loginAccount.get.userName, 48)</div>
}
<div class="panel panel-default issue-comment-box">
<div class="panel-body">
@helper.html.preview(
@gitbucket.core.helper.html.preview(
repository = repository,
content = "",
enableWikiLink = false,
@@ -23,6 +22,7 @@
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = hasWritePermission,
completionContext = "issues",
style = "height: 100px; max-height: 150px;",
elastic = true
)
@@ -30,13 +30,13 @@
@if(fileName.isDefined){
<div class="pull-right" style="margin-top: 10px;">
<input type="button" class="btn btn-default" value="Cancel"/>
<input type="submit" class="btn btn-success btn-inline-comment" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment"/>
<input type="submit" class="btn btn-success btn-inline-comment" formaction="@helpers.url(repository)/commit/@commitId/comment/new" value="Comment"/>
</div>
}
</div>
@if(!fileName.isDefined){
<div class="pull-right">
<input type="submit" class="btn btn-success" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
<input type="submit" class="btn btn-success" formaction="@helpers.url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
</div>
}
@issueId.map { issueId => <input type="hidden" name="issueId" value="@issueId"> }
@@ -53,7 +53,7 @@
param[v.name] = v.value;
});
$.ajax({
url: '@url(repository)/commit/@commitId/comment/_data/new',
url: '@helpers.url(repository)/commit/@commitId/comment/_data/new',
type: 'POST',
data: param
}).done(function(data) {

View File

@@ -7,27 +7,26 @@
diffs: Seq[gitbucket.core.util.JGitUtil.DiffInfo],
oldCommitId: Option[String],
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.util.Implicits._
@import context._
@import gitbucket.core.view.helpers._
@html.main(commit.shortMessage, Some(repository)){
@html.menu("files", repository){
@import gitbucket.core.view.helpers
@import gitbucket.core.view.helpers.RichHtmlSeq
@gitbucket.core.html.main(commit.shortMessage, Some(repository)){
@gitbucket.core.html.menu("files", repository){
<table class="table table-bordered">
<tr>
<th class="box-header">
<div class="pull-right align-right">
<a href="@url(repository)/tree/@commit.id" class="btn btn-small">Browse code</a>
<a href="@helpers.url(repository)/tree/@commit.id" class="btn btn-small">Browse code</a>
</div>
<div class="commit-log">@link(commit.summary, repository)</div>
<div class="commit-log">@helpers.link(commit.summary, repository)</div>
@if(commit.description.isDefined){
<pre class="commit-description">@link(commit.description.get, repository)</pre>
<pre class="commit-description">@helpers.link(commit.description.get, repository)</pre>
}
<div class="small" style="font-weight: normal;">
@if(branches.nonEmpty){
<span class="muted">
<i class="octicon octicon-git-branch"></i>
@branches.zipWithIndex.map { case (branch, i) =>
<a href="@url(repository)/tree/@encodeRefName(branch)" class="branch" id="branch-@i">@branch</a>
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)" class="branch" id="branch-@i">@branch</a>
}
</span>
}
@@ -35,7 +34,7 @@
<span class="muted">
<i class="octicon octicon-tag"></i>
@tags.zipWithIndex.map { case (tag, i) =>
<a href="@url(repository)/tree/@tag" class="tag" id="tag-@i">@tag</a>
<a href="@helpers.url(repository)/tree/@tag" class="tag" id="tag-@i">@tag</a>
}
</span>
}
@@ -51,7 +50,7 @@
}
@if(commit.parents.size == 1){
<span class="muted">1 parent</span>
<a href="@url(repository)/commit/@commit.parents(0)" class="commit-id">@commit.parents(0).substring(0, 7)</a>
<a href="@helpers.url(repository)/commit/@commit.parents(0)" class="commit-id">@commit.parents(0).substring(0, 7)</a>
}
<span class="muted">commit</span> @commit.id
</div>
@@ -59,7 +58,7 @@
<div>
<span class="muted">@commit.parents.size parents
@commit.parents.map { parent =>
<a href="@url(repository)/commit/@parent" class="commit-id">@parent.substring(0, 7)</a>
<a href="@helpers.url(repository)/commit/@parent" class="commit-id">@parent.substring(0, 7)</a>
}.mkHtml(" + ")
</span>
</div>
@@ -68,29 +67,29 @@
<div class="author-info">
<div class="author">
@avatar(commit, 20)
<span>@user(commit.authorName, commit.authorEmailAddress, "username strong")</span>
<span class="muted">authored @helper.html.datetimeago(commit.authorTime)</span>
@helpers.avatar(commit, 20)
<span>@helpers.user(commit.authorName, commit.authorEmailAddress, "username strong")</span>
<span class="muted">authored @gitbucket.core.helper.html.datetimeago(commit.authorTime)</span>
</div>
@if(commit.isDifferentFromAuthor) {
<div class="committer">
<span class="octicon octicon-arrow-right"></span>
<span>@user(commit.committerName, commit.committerEmailAddress, "username strong")</span>
<span class="muted"> committed @helper.html.datetimeago(commit.commitTime)</span>
<span>@helpers.user(commit.committerName, commit.committerEmailAddress, "username strong")</span>
<span class="muted"> committed @gitbucket.core.helper.html.datetimeago(commit.commitTime)</span>
</div>
}
</div>
</td>
</tr>
</table>
@helper.html.diff(diffs, repository, Some(commit.id), oldCommitId, true, None, hasWritePermission, true)
@gitbucket.core.helper.html.diff(diffs, repository, Some(commit.id), oldCommitId, true, None, hasWritePermission, true)
<label class="checkbox">
<input type="checkbox" id="show-notes"> Show line notes below
</label>
<div id="comment-list">
@issues.html.commentlist(None, comments, hasWritePermission, repository, None)
@gitbucket.core.issues.html.commentlist(None, comments, hasWritePermission, repository, None)
</div>
@commentform(commitId = commitId, hasWritePermission = hasWritePermission, repository = repository)
@gitbucket.core.repo.html.commentform(commitId = commitId, hasWritePermission = hasWritePermission, repository = repository)
}
}
<script>

View File

@@ -5,30 +5,29 @@
page: Int,
hasNext: Boolean,
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
@html.menu("files", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("files", repository){
<div class="head">
@if(pathList.isEmpty){
@helper.html.branchcontrol(
@gitbucket.core.helper.html.branchcontrol(
branch,
repository,
hasWritePermission
){
@repository.branchList.map { x =>
<li><a href="@url(repository)/commits/@encodeRefName(x)">@helper.html.checkicon(x == branch) @x</a></li>
<li><a href="@helpers.url(repository)/commits/@helpers.encodeRefName(x)">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
}
}
}
@if(pathList.nonEmpty){
<span class="muted">History for</span>
<a class="strong" href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
<a class="strong" href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
@if(i == pathList.length - 1){
<span class="strong">@section</span>
} else {
<a class="strong" href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
<a class="strong" href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
}
}
}
@@ -37,33 +36,33 @@
<table class="table table-bordered">
@commits.map { day =>
<tr>
<th rowspan="@day.size" width="100">@date(day.head.commitTime)</th>
<th rowspan="@day.size" width="100">@helpers.date(day.head.commitTime)</th>
@day.zipWithIndex.map { case (commit, i) =>
@if(i != 0){ <tr> }
<td>
<div class="pull-right text-right">
<a href="@url(repository)/commit/@commit.id" class="monospace commit-message strong"><i class="octicon octicon-diff" style="color: black;"></i>@commit.id.substring(0, 7)</a><br>
<a href="@url(repository)/tree/@commit.id" class="button-link">Browse files »</a>
<a href="@helpers.url(repository)/commit/@commit.id" class="monospace commit-message strong"><i class="octicon octicon-diff" style="color: black;"></i>@commit.id.substring(0, 7)</a><br>
<a href="@helpers.url(repository)/tree/@commit.id" class="button-link">Browse files »</a>
</div>
<div>
<div class="commit-avatar-image">@avatarLink(commit, 40)</div>
<div class="commit-avatar-image">@helpers.avatarLink(commit, 40)</div>
<div>
@link(commit.summary, repository)
@helpers.link(commit.summary, repository)
@if(commit.description.isDefined){
<a href="javascript:void(0)" onclick="$('#description-@commit.id').toggle();" class="omit">...</a>
}
<br>
@if(commit.description.isDefined){
<pre id="description-@commit.id" style="display: none;" class="commit-description">@link(commit.description.get, repository)</pre>
<pre id="description-@commit.id" style="display: none;" class="commit-description">@helpers.link(commit.description.get, repository)</pre>
}
<div>
@if(commit.isDifferentFromAuthor) {
@user(commit.authorName, commit.authorEmailAddress, "username")
<span class="muted">authored @helper.html.datetimeago(commit.authorTime)</span>
@helpers.user(commit.authorName, commit.authorEmailAddress, "username")
<span class="muted">authored @gitbucket.core.helper.html.datetimeago(commit.authorTime)</span>
<span class="octicon octicon-arrow-right" style="margin-top : -2px;"></span>
}
@user(commit.committerName, commit.committerEmailAddress, "username")
<span class="muted">committed @helper.html.datetimeago(commit.commitTime)</span>
@helpers.user(commit.committerName, commit.committerEmailAddress, "username")
<span class="muted">committed @gitbucket.core.helper.html.datetimeago(commit.commitTime)</span>
</div>
</div>
</div>

View File

@@ -3,15 +3,14 @@
pathList: List[String],
fileName: String,
content: gitbucket.core.util.JGitUtil.ContentInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"Deleting ${path} at ${fileName} - ${repository.owner}/${repository.name}", Some(repository)) {
@html.menu("files", repository){
<form method="POST" action="@url(repository)/remove" validate="true">
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"Deleting ${context.path} at ${fileName} - ${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("files", repository){
<form method="POST" action="@helpers.url(repository)/remove" validate="true">
<div class="head">
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
<a href="@url(repository)/tree/@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> /
}
@fileName
<input type="hidden" name="fileName" id="fileName" value="@fileName"/>
@@ -22,7 +21,7 @@
<th style="font-weight: normal;" class="box-header">
@fileName
<div class="pull-right align-right">
<a href="@url(repository)/blob/@branch/@{(pathList ::: List(fileName)).mkString("/")}" class="btn btn-small">View</a>
<a href="@helpers.url(repository)/blob/@branch/@{(pathList ::: List(fileName)).mkString("/")}" class="btn btn-small">View</a>
</div>
</th>
<tr>
@@ -33,7 +32,7 @@
</td>
</tr>
</table>
<div class="issue-avatar-image">@avatarLink(loginAccount.get.userName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(context.loginAccount.get.userName, 48)</div>
<div class="box issue-comment-box">
<div class="box-content">
<div>
@@ -43,7 +42,7 @@
<input type="text" name="message" style="width: 98%;"/>
</div>
<div style="text-align: right;">
<a href="@url(repository)/blob/@encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-danger">Cancel</a>
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-danger">Cancel</a>
<input type="submit" id="commit" class="btn btn-success" value="Commit changes"/>
</div>
</div>
@@ -51,8 +50,8 @@
</form>
}
}
<script type="text/javascript" src="@assets/vendors/jsdifflib/difflib.js"></script>
<link href="@assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="@helpers.assets/vendors/jsdifflib/difflib.js"></script>
<link href="@helpers.assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script>
$(function(){
diffUsingJS('oldText', 'newText', 'diffText', 1);

View File

@@ -1,7 +1,7 @@
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: gitbucket.core.controller.Context)
@import context._
@(content: String, commentId: Int,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
<span class="error-edit-content-@commentId error"></span>
@helper.html.attached(owner, repository){
@gitbucket.core.helper.html.attached(repository, "issues"){
<textarea style="height: 100px;" id="edit-content-@commentId" class="form-control">@content</textarea>
}
<div>
@@ -22,7 +22,7 @@ $(function(){
$box = $(this).closest('.commit-comment-box');
$('.update-comment-@commentId, .cancel-comment-@commentId', $box).attr('disabled', 'disabled');
$.ajax({
url: '@path/@owner/@repository/commit_comments/edit/@commentId',
url: '@context.path/@repository.owner/@repository.name/commit_comments/edit/@commentId',
type: 'POST',
data: {
content : $('#edit-content-@commentId', $box).val()
@@ -38,7 +38,7 @@ $(function(){
$(document).on('click', '.cancel-comment-@commentId', function(){
$box = $(this).closest('.box');
$('.update-comment-@commentId, .cancel-comment-@commentId', $box).attr('disabled', 'disabled');
$.get('@path/@owner/@repository/commit_comments/_data/@commentId', curriedCallback($box));
$.get('@context.path/@repository.owner/@repository.name/commit_comments/_data/@commentId', curriedCallback($box));
return false;
});
});

View File

@@ -4,19 +4,18 @@
fileName: Option[String],
content: gitbucket.core.util.JGitUtil.ContentInfo,
protectedBranch: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(if(fileName.isEmpty) "New File" else s"Editing ${fileName.get} at ${branch} - ${repository.owner}/${repository.name}", Some(repository)) {
@html.menu("files", repository){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(if(fileName.isEmpty) "New File" else s"Editing ${fileName.get} at ${branch} - ${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("files", repository){
@if(protectedBranch){
<div class="alert alert-danger">branch @branch is protected.</div>
}
<form method="POST" action="@url(repository)/@if(fileName.isEmpty){create}else{update}" validate="true">
<form method="POST" action="@helpers.url(repository)/@if(fileName.isEmpty){create}else{update}" validate="true">
<span class="error" id="error-newFileName"></span>
<div class="head">
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
<a href="@url(repository)/tree/@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> /
}
<input type="text" name="newFileName" id="newFileName" class="form-control" placeholder="Name your file..." value="@fileName"/>
<input type="hidden" name="oldFileName" id="oldFileName" value="@fileName"/>
@@ -47,7 +46,7 @@
</td>
</tr>
</table>
<div class="issue-avatar-image">@avatarLink(loginAccount.get.userName, 48)</div>
<div class="issue-avatar-image">@helpers.avatarLink(context.loginAccount.get.userName, 48)</div>
<div class="panel panel-default issue-comment-box">
<div class="panel-body">
<div>
@@ -58,9 +57,9 @@
</div>
<div style="text-align: right;">
@if(fileName.isEmpty){
<a href="@url(repository)/tree/@encodeRefName(branch)/@{pathList.mkString("/")}" class="btn btn-danger">Cancel</a>
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@{pathList.mkString("/")}" class="btn btn-danger">Cancel</a>
} else {
<a href="@url(repository)/blob/@encodeRefName(branch)/@{(pathList ++ Seq(fileName.get)).mkString("/")}" class="btn btn-danger">Cancel</a>
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName(branch)/@{(pathList ++ Seq(fileName.get)).mkString("/")}" class="btn btn-danger">Cancel</a>
}
<input type="submit" id="commit" class="btn btn-success" value="Commit changes" disabled="true"/>
<input type="hidden" id="charset" name="charset" value="@content.charset"/>
@@ -73,9 +72,9 @@
</form>
}
}
<script src="@assets/vendors/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="@assets/vendors/jsdifflib/difflib.js"></script>
<link href="@assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script src="@helpers.assets/vendors/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="@helpers.assets/vendors/jsdifflib/difflib.js"></script>
<link href="@helpers.assets/vendors/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
<script>
$(function(){
$('#editor').text($('#initial').val());
@@ -84,7 +83,7 @@ $(function(){
//editor.getSession().setUseWrapMode(false);
@if(fileName.isDefined){
editor.getSession().setMode("ace/mode/@editorType(fileName.get)");
editor.getSession().setMode("ace/mode/@helpers.editorType(fileName.get)");
}
@if(protectedBranch){
editor.setReadOnly(true);
@@ -131,10 +130,10 @@ $(function(){
$('#btn-code').removeClass('active');
$('#btn-preview').addClass('active');
@if(fileName.map(isRenderable _).getOrElse(false)) {
@if(fileName.map(helpers.isRenderable _).getOrElse(false)) {
// update preview
$('#preview').html('<img src="@assets/common/images/indicator.gif"> Previewing...');
$.post('@url(repository)/_preview', {
$('#preview').html('<img src="@helpers.assets/common/images/indicator.gif"> Previewing...');
$.post('@helpers.url(repository)/_preview', {
content : editor.getValue(),
enableWikiLink : false,
enableRefsLink : false,

View File

@@ -8,39 +8,38 @@
branchPullRequest: Option[(gitbucket.core.model.PullRequest, gitbucket.core.model.Issue)],
info: Option[Any] = None,
error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.service.RepositoryService._
@html.main(
@import gitbucket.core.view.helpers
@import gitbucket.core.service.RepositoryService
@gitbucket.core.html.main(
if(pathList.isEmpty){
if(branch == repository.repository.defaultBranch){
s"${repository.owner}/${repository.name}"
} else {
s"${repository.owner}/${repository.name} at ${encodeRefName(branch)}"
s"${repository.owner}/${repository.name} at ${helpers.encodeRefName(branch)}"
}
} else {
s"${(repository.name :: pathList).mkString("/")} at ${encodeRefName(branch)} - ${repository.owner}/${repository.name}"
s"${(repository.name :: pathList).mkString("/")} at ${helpers.encodeRefName(branch)} - ${repository.owner}/${repository.name}"
}, Some(repository)) {
@html.menu("files", repository, Some(branch), info, error){
@gitbucket.core.html.menu("files", repository, Some(branch), info, error){
<div class="head">
<div class="pull-right pc">
<div class="btn-group">
<a href="@url(repository)/find/@encodeRefName(branch)" class="btn btn-sm btn-default pc" data-hotkey="t"><i class="octicon octicon-search"></i></a>
<a href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default"><i class="octicon octicon-history"></i></a>
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default pc" 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></a>
</div>
</div>
@if(pathList.isEmpty){
@if(platform != "linux" && platform != null){
@if(context.platform != "linux" && context.platform != null){
<div class="pull-right pc" style="margin-right: 5px;">
<div class="btn-group">
<a href="@openRepoUrl(repository.httpUrl)" id="repository-clone-url" class="btn btn-sm btn-default"><i class="octicon octicon-desktop-download"></i></a>
<a href="@{url(repository)}/archive/@{encodeRefName(branch)}.zip" class="btn btn-sm btn-default"><i class="octicon octicon-cloud-download"></i> Download ZIP</a>
<a href="@RepositoryService.openRepoUrl(repository.httpUrl)" id="repository-clone-url" class="btn btn-sm btn-default"><i class="octicon octicon-desktop-download"></i></a>
<a href="@{helpers.url(repository)}/archive/@{helpers.encodeRefName(branch)}.zip" class="btn btn-sm btn-default"><i class="octicon octicon-cloud-download"></i> Download ZIP</a>
</div>
</div>
}
<div class="pull-right pc">
<div style="width: 240px; margin-right: 5px; margin-left: 5px;">
@helper.html.copy("repository-url-copy", repository.httpUrl){
@gitbucket.core.helper.html.copy("repository-url-copy", repository.httpUrl){
@if(repository.sshUrl.isDefined){
<div class="btn-group input-group-btn">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@@ -67,9 +66,9 @@
</div>
</div>
}
@helper.html.branchcontrol(branch, repository, hasWritePermission){
@gitbucket.core.helper.html.branchcontrol(branch, repository, hasWritePermission){
@repository.branchList.map { x =>
<li><a href="@url(repository)/tree/@encodeRefName(x)">@helper.html.checkicon(x == branch) @x</a></li>
<li><a href="@helpers.url(repository)/tree/@helpers.encodeRefName(x)">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
}
}
@if(pathList.isEmpty){
@@ -81,12 +80,12 @@
}
*@
} else {
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
<a href="@url(repository)/tree/@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="@url(repository)/new/@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>
<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>
</div>
<table class="table table-hover">
@*
@@ -104,19 +103,19 @@
<th colspan="4" class="latest-commit">
<div>
<div class="pull-right align-right monospace" style="line-height: 18px;">
<a href="@url(repository)/commit/@latestCommit.id" class="commit-id"><span class="muted">latest commit</span> @latestCommit.id.substring(0, 10)</a>
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-id"><span class="muted">latest commit</span> @latestCommit.id.substring(0, 10)</a>
</div>
<div class="author-info">
<div class="author">
@avatar(latestCommit, 20)
<span>@user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")</span>
<span class="muted"> authored @helper.html.datetimeago(latestCommit.authorTime)</span>
@helpers.avatar(latestCommit, 20)
<span>@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")</span>
<span class="muted"> authored @gitbucket.core.helper.html.datetimeago(latestCommit.authorTime)</span>
</div>
@if(latestCommit.isDifferentFromAuthor) {
<div class="committer">
<span class="octicon octicon-arrow-right"></span>
<span>@user(latestCommit.committerName, latestCommit.committerEmailAddress, "username strong")</span>
<span class="muted"> committed @helper.html.datetimeago(latestCommit.commitTime)</span>
<span>@helpers.user(latestCommit.committerName, latestCommit.committerEmailAddress, "username strong")</span>
<span class="muted"> committed @gitbucket.core.helper.html.datetimeago(latestCommit.commitTime)</span>
</div>
}
</div>
@@ -126,7 +125,7 @@
@if(pathList.size > 0){
<tr>
<td width="16" class="file-icon"></td>
<td><a href="@url(repository)@if(pathList.size > 1){/tree/@encodeRefName(branch)/@pathList.init.mkString("/")}">..</a></td>
<td><a href="@helpers.url(repository)@if(pathList.size > 1){/tree/@helpers.encodeRefName(branch)/@pathList.init.mkString("/")}">..</a></td>
<td></td>
<td></td>
</tr>
@@ -154,7 +153,7 @@
}</span>@file.name.split("/").toList.last
</a>
} else {
<a href="@url(repository)/tree@{(branch :: pathList).map(encodeRefName).mkString("/", "/", "/")}@{encodeRefName(file.name)}">
<a href="@helpers.url(repository)/tree@{(branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/")}@{helpers.encodeRefName(file.name)}">
<span class="simplified-path">@file.name.split("/").toList.init match {
case Nil => {}
case list => {@list.mkString("", "/", "/")}
@@ -162,20 +161,20 @@
</a>
}
} else {
<a href="@url(repository)/blob@{(branch :: pathList).map(encodeRefName).mkString("/", "/", "/")}@{encodeRefName(file.name)}">@file.name</a>
<a href="@helpers.url(repository)/blob@{(branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/")}@{helpers.encodeRefName(file.name)}">@file.name</a>
}
</td>
<td class="mute">
<a href="@url(repository)/commit/@file.commitId" class="commit-message shorten-text" title="@file.message">@link(file.message, repository)</a>
<a href="@helpers.url(repository)/commit/@file.commitId" class="commit-message shorten-text" title="@file.message">@helpers.link(file.message, repository)</a>
</td>
<td style="text-align: right;">@helper.html.datetimeago(file.time, false)</td>
<td style="text-align: right;">@gitbucket.core.helper.html.datetimeago(file.time, false)</td>
</tr>
}
</table>
@readme.map { case(filePath, content) =>
<div id="readme" class="panel panel-default">
<div class="panel-heading strong">@filePath.reverse.head</div>
<div class="panel-body markdown-body" style="padding-left: 20px; padding-right: 20px;">@renderMarkup(filePath, content, branch, repository, false, false, true)</div>
<div class="panel-body markdown-body" style="padding-left: 20px; padding-right: 20px;">@helpers.renderMarkup(filePath, content, branch, repository, false, false, true)</div>
</div>
}
}
@@ -185,14 +184,14 @@
$('#repository-url-http').click(function(){
$('#repository-url-proto').text('HTTP');
$('#repository-url').val('@repository.httpUrl');
$('#repository-clone-url').attr('href', '@openRepoUrl(repository.httpUrl)')
$('#repository-clone-url').attr('href', '@RepositoryService.openRepoUrl(repository.httpUrl)')
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
});
$('#repository-url-ssh').click(function(){
$('#repository-url-proto').text('SSH');
$('#repository-url').val('@sshUrl');
$('#repository-clone-url').attr('href', '@openRepoUrl(sshUrl)');
$('#repository-clone-url').attr('href', '@RepositoryService.openRepoUrl(sshUrl)');
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
});
}

View File

@@ -2,14 +2,13 @@
treeId: 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("files", repository, Some(branch)){
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
@gitbucket.core.html.menu("files", repository, Some(branch)){
<div>
<div class="find-input">
<span class="bold"><a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a></span>
<span class="bold"><a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a></span>
/
<input type="text" name="query" autocomplete="off" spellcheck="false" autofocus id="tree-finder-field" />
</div>
@@ -23,13 +22,13 @@
<code></code> to navigate,
<code>enter</code> to view files.
</div>
<table id="tree-finder-results" class="table table-file-list" data-url="@url(repository)/tree-list/@treeId">
<table id="tree-finder-results" class="table table-file-list" data-url="@helpers.url(repository)/tree-list/@treeId">
<tbody class="tree-browser-result-template">
<tr class="tree-browser-result">
<td class="icon"><span class="octicon octicon-chevron-right"></span></td>
<td class="icon"><i class="octicon octicon-file-text"></i></td>
<td>
<a href="@url(repository)/blob/@encodeRefName(branch)"></a>
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName(branch)"></a>
</td>
</tr>
</tbody>

View File

@@ -2,35 +2,34 @@
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("fork", repository){
@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(loginAccount.isEmpty){
<a href="@path/signin?redirect=@urlEncode(s"${path}/${repository.owner}/${repository.name}")" class="btn btn-success">Fork</a>
@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="@path/@repository.owner/@repository.name/fork" class="btn btn-success" rel="facebox">Fork</a>
<a href="@context.path/@repository.owner/@repository.name/fork" class="btn btn-success" rel="facebox">Fork</a>
}
}
</h1>
@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"/>
@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>
}
<div class="block">
@if(originRepository.isDefined){
@avatar(originRepository.get.owner, 20)
@helpers.avatar(originRepository.get.owner, 20)
<span@if(repository.owner == originRepository.get.owner){ class="highlight"}>
<a href="@url(originRepository.get.owner)">@originRepository.get.owner</a> / <a href="@path/@originRepository.get.owner/@originRepository.get.name">@originRepository.get.name</a>
<a href="@helpers.url(originRepository.get.owner)">@originRepository.get.owner</a> / <a href="@context.path/@originRepository.get.owner/@originRepository.get.name">@originRepository.get.name</a>
</span>
} else {
@avatar(repository.repository.originUserName.get, 20)
@helpers.avatar(repository.repository.originUserName.get, 20)
<span class="highlight">
@repository.repository.originUserName / @repository.repository.originRepositoryName
</span>
@@ -39,9 +38,9 @@
</div>
@members.map { case (owner, name) =>
<div class="block">
@avatar(owner, 20)
@helpers.avatar(owner, 20)
<span@if(repository.owner == owner){ class="highlight"}>
<a href="@url(owner)">@owner</a> / <a href="@path/@owner/@name">@name</a>
<a href="@helpers.url(owner)">@owner</a> / <a href="@context.path/@owner/@name">@name</a>
</span>
</div>
}
@@ -50,8 +49,8 @@
<script>
$(function(){
$('a[rel*=facebox]').facebox({
'loadingImage': '@assets/vendors/facebox/loading.gif',
'closeImage': '@assets/vendors/facebox/closelabel.png'
'loadingImage': '@helpers.assets/vendors/facebox/loading.gif',
'closeImage': '@helpers.assets/vendors/facebox/closelabel.png'
});
$(document).on("click", ".js-fork-owner-select-target", function() {
@@ -62,7 +61,7 @@ $(function(){
}
});
@if(loginAccount.isDefined){
@if(context.loginAccount.isDefined){
$(document).on("click", "a#fork-link", function(e) {
e.preventDefault();
$('#fork-form').submit();

Some files were not shown because too many files have changed in this diff Show More