mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-08 04:47:08 +02:00
Compare commits
99 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48b6a590bf | ||
|
|
285ef02a17 | ||
|
|
18375c741e | ||
|
|
21030344cc | ||
|
|
a494027217 | ||
|
|
7bca01af59 | ||
|
|
acf3fa9980 | ||
|
|
c0ce0f8d19 | ||
|
|
56e7168461 | ||
|
|
c2d0d94f05 | ||
|
|
fc22cfbbdd | ||
|
|
d62adbf649 | ||
|
|
dba5539e3e | ||
|
|
f0a8b3bb17 | ||
|
|
f52e7e1bdd | ||
|
|
58ba26f21e | ||
|
|
bf7b30630c | ||
|
|
b5cac0308e | ||
|
|
373ea39048 | ||
|
|
427f5eec5f | ||
|
|
a4e9903e00 | ||
|
|
0d900a892c | ||
|
|
dc6fdaf482 | ||
|
|
b79498ed9f | ||
|
|
69e8f628df | ||
|
|
d3d8e3ce5f | ||
|
|
0499c47f4b | ||
|
|
7fd0cdd7d8 | ||
|
|
49eaf79e01 | ||
|
|
3a96c30aa8 | ||
|
|
6d550fa485 | ||
|
|
7f9d69bb51 | ||
|
|
709fab9ccc | ||
|
|
fd13a2db79 | ||
|
|
840d81f7bd | ||
|
|
5d08f4d339 | ||
|
|
ef48b2d5ef | ||
|
|
f54e4f337f | ||
|
|
743965d3b8 | ||
|
|
0e787eddfd | ||
|
|
442c0d575e | ||
|
|
485516be2e | ||
|
|
6b2fbb3bf0 | ||
|
|
e510b1c26b | ||
|
|
8d35494169 | ||
|
|
cf1504bae7 | ||
|
|
9bb4e473b9 | ||
|
|
d67afebadc | ||
|
|
417886161c | ||
|
|
1b85d511e9 | ||
|
|
45d84f63c1 | ||
|
|
fff60b2704 | ||
|
|
c9339aec9e | ||
|
|
7c98ae1341 | ||
|
|
01c2291715 | ||
|
|
2e03f081d9 | ||
|
|
0cbafdd884 | ||
|
|
d5a9c2c15d | ||
|
|
1496591244 | ||
|
|
f5acce3901 | ||
|
|
5568a0ad8e | ||
|
|
26a18287c7 | ||
|
|
b0f819b9bd | ||
|
|
ebff7baf07 | ||
|
|
cf9a55d896 | ||
|
|
72f7b659f4 | ||
|
|
87192d025b | ||
|
|
fd181b9a0c | ||
|
|
9c4cc12a02 | ||
|
|
44497b559e | ||
|
|
09c50a149b | ||
|
|
88beb68e01 | ||
|
|
0da358311b | ||
|
|
cf97b63dab | ||
|
|
4b5f22144e | ||
|
|
0d342a6863 | ||
|
|
458820a09d | ||
|
|
135c34ef0f | ||
|
|
8187c5a013 | ||
|
|
6ff48c8130 | ||
|
|
d37c70cd8d | ||
|
|
8abf357405 | ||
|
|
c93ac71634 | ||
|
|
408180f071 | ||
|
|
4e98abfe5c | ||
|
|
efbb404bd4 | ||
|
|
66f409bfad | ||
|
|
44ec64fb4b | ||
|
|
fb27bd29e8 | ||
|
|
c26ca9d463 | ||
|
|
8c36ba33f4 | ||
|
|
fe1e18b495 | ||
|
|
29e632af04 | ||
|
|
2b9daae62b | ||
|
|
8a11f85dd1 | ||
|
|
b09c72b106 | ||
|
|
43456e817a | ||
|
|
41e49423b2 | ||
|
|
3cc7bd3cdb |
2
LICENSE
2
LICENSE
@@ -187,7 +187,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2013-2016 GitBucket Team
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
34
README.md
34
README.md
@@ -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,47 @@ Support
|
||||
|
||||
Release Notes
|
||||
-------------
|
||||
### 4.2 - 2 Jul 2016
|
||||
### 4.4 - 28 Aug 2016
|
||||
- Import a SQL dump file to the database
|
||||
- `go get` support in private repositories
|
||||
- Sort milestones by due date
|
||||
- apache-sshd has been updated to 1.2.0
|
||||
|
||||
### 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 +113,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
|
||||
|
||||
64
build.sbt
64
build.sbt
@@ -1,6 +1,6 @@
|
||||
val Organization = "gitbucket"
|
||||
val Organization = "io.github.gitbucket"
|
||||
val Name = "gitbucket"
|
||||
val GitBucketVersion = "4.2.0"
|
||||
val GitBucketVersion = "4.4.0"
|
||||
val ScalatraVersion = "2.4.1"
|
||||
val JettyVersion = "9.3.9.v20160517"
|
||||
|
||||
@@ -29,11 +29,11 @@ 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",
|
||||
"org.apache.sshd" % "apache-sshd" % "1.0.0",
|
||||
"org.apache.sshd" % "apache-sshd" % "1.2.0",
|
||||
"org.apache.tika" % "tika-core" % "1.13",
|
||||
"com.typesafe.slick" %% "slick" % "2.1.0",
|
||||
"com.novell.ldap" % "jldap" % "2009-10-07",
|
||||
@@ -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")
|
||||
@@ -173,3 +170,56 @@ Keys.artifact in (Compile, executableKey) ~= {
|
||||
}
|
||||
addArtifact(Keys.artifact in (Compile, executableKey), executableKey)
|
||||
*/
|
||||
publishTo <<= version { (v: String) =>
|
||||
val nexus = "https://oss.sonatype.org/"
|
||||
if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
|
||||
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
|
||||
}
|
||||
publishMavenStyle := true
|
||||
pomIncludeRepository := { _ => false }
|
||||
artifact in Keys.`package` := Artifact(moduleName.value)
|
||||
pomExtra := (
|
||||
<url>https://github.com/gitbucket/gitbucket</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<url>https://github.com/gitbucket/gitbucket</url>
|
||||
<connection>scm:git:https://github.com/gitbucket/gitbucket.git</connection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>takezoe</id>
|
||||
<name>Naoki Takezoe</name>
|
||||
<url>https://github.com/takezoe</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>shimamoto</id>
|
||||
<name>Takako Shimamoto</name>
|
||||
<url>https://github.com/shimamoto</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>tanacasino</id>
|
||||
<name>Tomofumi Tanaka</name>
|
||||
<url>https://github.com/tanacasino</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>mrkm4ntr</id>
|
||||
<name>Shintaro Murakami</name>
|
||||
<url>https://github.com/mrkm4ntr</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>nazoking</id>
|
||||
<name>nazoking</name>
|
||||
<url>https://github.com/nazoking</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>McFoggy</id>
|
||||
<name>Matthieu Brouillard</name>
|
||||
<url>https://github.com/McFoggy</url>
|
||||
</developer>
|
||||
</developers>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
|
||||
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.0.4")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
|
||||
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.0.4")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
|
||||
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")
|
||||
addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0")
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
|
||||
|
||||
@@ -60,6 +60,8 @@ public class JettyLauncher {
|
||||
}
|
||||
|
||||
server.setHandler(context);
|
||||
server.setStopAtShutdown(true);
|
||||
server.setStopTimeout(7_000);
|
||||
server.start();
|
||||
server.join();
|
||||
}
|
||||
|
||||
@@ -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, "/*")
|
||||
|
||||
|
||||
@@ -11,5 +11,8 @@ 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"),
|
||||
new Version("4.4.0")
|
||||
)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
11
src/main/scala/gitbucket/core/api/ApiContents.scala
Normal file
11
src/main/scala/gitbucket/core/api/ApiContents.scala
Normal 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)
|
||||
}
|
||||
3
src/main/scala/gitbucket/core/api/ApiEndPoint.scala
Normal file
3
src/main/scala/gitbucket/core/api/ApiEndPoint.scala
Normal file
@@ -0,0 +1,3 @@
|
||||
package gitbucket.core.api
|
||||
|
||||
case class ApiEndPoint(rate_limit_url: ApiPath = ApiPath("/api/v3/rate_limit"))
|
||||
5
src/main/scala/gitbucket/core/api/ApiRef.scala
Normal file
5
src/main/scala/gitbucket/core/api/ApiRef.scala
Normal file
@@ -0,0 +1,5 @@
|
||||
package gitbucket.core.api
|
||||
|
||||
case class ApiObject(sha: String)
|
||||
|
||||
case class ApiRef(ref: String, `object`: ApiObject)
|
||||
@@ -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}")
|
||||
|
||||
@@ -38,7 +38,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {
|
||||
case class PersonalTokenForm(note: String)
|
||||
|
||||
val newForm = mapping(
|
||||
"userName" -> trim(label("User name" , text(required, maxlength(100), identifier, uniqueUserName))),
|
||||
"userName" -> trim(label("User name" , text(required, maxlength(100), identifier, uniqueUserName, reservedNames))),
|
||||
"password" -> trim(label("Password" , text(required, maxlength(20)))),
|
||||
"fullName" -> trim(label("Full Name" , text(required, maxlength(100)))),
|
||||
"mailAddress" -> trim(label("Mail Address" , text(required, maxlength(100), uniqueMailAddress()))),
|
||||
@@ -68,7 +68,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {
|
||||
case class EditGroupForm(groupName: String, url: Option[String], fileId: Option[String], members: String, clearImage: Boolean)
|
||||
|
||||
val newGroupForm = mapping(
|
||||
"groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName))),
|
||||
"groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName, reservedNames))),
|
||||
"url" -> trim(label("URL" ,optional(text(maxlength(200))))),
|
||||
"fileId" -> trim(label("File ID" ,optional(text()))),
|
||||
"members" -> trim(label("Members" ,text(required, members)))
|
||||
|
||||
@@ -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.getOrElse("ref", repository.repository.defaultBranch)
|
||||
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
|
||||
|
||||
@@ -244,4 +244,13 @@ trait AccountManagementControllerBase extends ControllerBase {
|
||||
.map { _ => "Mail address is already registered." }
|
||||
}
|
||||
|
||||
val allReservedNames = Set("git", "admin", "upload", "api")
|
||||
protected def reservedNames(): Constraint = new Constraint(){
|
||||
override def validate(name: String, value: String, messages: Messages): Option[String] = if(allReservedNames.contains(value)){
|
||||
Some(s"${value} is reserved")
|
||||
}else{
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,15 +79,10 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport with R
|
||||
}
|
||||
|
||||
post("/import") {
|
||||
import JDBCUtil._
|
||||
session.get(Keys.Session.LoginAccount).collect { case loginAccount: Account if loginAccount.isAdmin =>
|
||||
execute({ (file, fileId) =>
|
||||
if(file.getName.endsWith(".xml")){
|
||||
import JDBCUtil._
|
||||
val conn = request2Session(request).conn
|
||||
conn.importAsXML(file.getInputStream)
|
||||
} else {
|
||||
throw new RuntimeException("Import is available for only the XML file.")
|
||||
}
|
||||
request2Session(request).conn.importAsSQL(file.getInputStream)
|
||||
}, _ => true)
|
||||
}
|
||||
redirect("/admin/data")
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -117,15 +117,20 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
||||
/**
|
||||
* Displays the file list of the repository root and the default branch.
|
||||
*/
|
||||
get("/:owner/:repository")(referrersOnly {
|
||||
fileList(_)
|
||||
})
|
||||
get("/:owner/:repository") {
|
||||
params.get("go-get") match {
|
||||
case Some("1") => defining(request.paths){ paths =>
|
||||
getRepository(paths(0), paths(1)).map(gitbucket.core.html.goget(_))getOrElse NotFound()
|
||||
}
|
||||
case _ => referrersOnly(fileList(_))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +142,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 +158,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 +166,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 +182,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 +240,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 +258,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 +290,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 +381,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 +531,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")
|
||||
|
||||
@@ -14,7 +14,6 @@ import gitbucket.core.util.Directory._
|
||||
import gitbucket.core.util.StringUtil._
|
||||
import io.github.gitbucket.scalatra.forms._
|
||||
import org.apache.commons.io.{FileUtils, IOUtils}
|
||||
import org.apache.commons.mail.{DefaultAuthenticator, HtmlEmail}
|
||||
import org.scalatra.i18n.Messages
|
||||
|
||||
class SystemSettingsController extends SystemSettingsControllerBase
|
||||
@@ -104,7 +103,7 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
|
||||
|
||||
val newUserForm = mapping(
|
||||
"userName" -> trim(label("Username" ,text(required, maxlength(100), identifier, uniqueUserName))),
|
||||
"userName" -> trim(label("Username" ,text(required, maxlength(100), identifier, uniqueUserName, reservedNames))),
|
||||
"password" -> trim(label("Password" ,text(required, maxlength(20)))),
|
||||
"fullName" -> trim(label("Full Name" ,text(required, maxlength(100)))),
|
||||
"mailAddress" -> trim(label("Mail Address" ,text(required, maxlength(100), uniqueMailAddress()))),
|
||||
@@ -126,7 +125,7 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
)(EditUserForm.apply)
|
||||
|
||||
val newGroupForm = mapping(
|
||||
"groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName))),
|
||||
"groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName, reservedNames))),
|
||||
"url" -> trim(label("URL" ,optional(text(maxlength(200))))),
|
||||
"fileId" -> trim(label("File ID" ,optional(text()))),
|
||||
"members" -> trim(label("Members" ,text(required, members)))
|
||||
@@ -304,12 +303,7 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
|
||||
post("/admin/export")(adminOnly {
|
||||
import gitbucket.core.util.JDBCUtil._
|
||||
val session = request2Session(request)
|
||||
val file = if(params("type") == "sql"){
|
||||
session.conn.exportAsSQL(request.getParameterValues("tableNames").toSeq)
|
||||
} else {
|
||||
session.conn.exportAsXML(request.getParameterValues("tableNames").toSeq)
|
||||
}
|
||||
val file = request2Session(request).conn.exportAsSQL(request.getParameterValues("tableNames").toSeq)
|
||||
|
||||
contentType = "application/octet-stream"
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + file.getName)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,8 @@ import gitbucket.core.util.ControlUtil._
|
||||
import gitbucket.core.util.DatabaseConfig
|
||||
import gitbucket.core.util.Directory._
|
||||
import io.github.gitbucket.solidbase.Solidbase
|
||||
import io.github.gitbucket.solidbase.manager.JDBCVersionManager
|
||||
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 +42,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 +69,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 +98,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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,6 +162,8 @@ object PluginRegistry {
|
||||
*/
|
||||
def initialize(context: ServletContext, settings: SystemSettings, conn: java.sql.Connection): Unit = {
|
||||
val pluginDir = new File(PluginHome)
|
||||
val manager = new JDBCVersionManager(conn)
|
||||
|
||||
if(pluginDir.exists && pluginDir.isDirectory){
|
||||
pluginDir.listFiles(new FilenameFilter {
|
||||
override def accept(dir: File, name: String): Boolean = name.endsWith(".jar")
|
||||
@@ -192,19 +176,26 @@ object PluginRegistry {
|
||||
val solidbase = new Solidbase()
|
||||
solidbase.migrate(conn, classLoader, DatabaseConfig.liquiDriver, new Module(plugin.pluginId, plugin.versions: _*))
|
||||
|
||||
// Check version
|
||||
val databaseVersion = manager.getCurrentVersion(plugin.pluginId)
|
||||
val pluginVersion = plugin.versions.last.getVersion
|
||||
if(databaseVersion != pluginVersion){
|
||||
throw new IllegalStateException(s"Plugin version is ${pluginVersion}, but database version is ${databaseVersion}")
|
||||
}
|
||||
|
||||
// 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 {
|
||||
case e: Throwable => {
|
||||
logger.error(s"Error during plugin initialization", e)
|
||||
logger.error(s"Error during plugin initialization: ${pluginJar.getAbsolutePath}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +222,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
|
||||
)
|
||||
|
||||
@@ -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; });"""
|
||||
}
|
||||
10
src/main/scala/gitbucket/core/plugin/TextDecorator.scala
Normal file
10
src/main/scala/gitbucket/core/plugin/TextDecorator.scala
Normal 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
|
||||
|
||||
}
|
||||
@@ -186,7 +186,7 @@ trait AccountService {
|
||||
|
||||
def getGroupNames(userName: String)(implicit s: Session): List[String] = {
|
||||
List(userName) ++
|
||||
Collaborators.filter(_.collaboratorName === userName.bind).sortBy(_.userName).map(_.userName).list
|
||||
Collaborators.filter(_.collaboratorName === userName.bind).sortBy(_.userName).map(_.userName).list.distinct
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ trait MilestonesService {
|
||||
|
||||
def getMilestonesWithIssueCount(owner: String, repository: String)(implicit s: Session): List[(Milestone, Int, Int)] = {
|
||||
val counts = Issues
|
||||
.filter { t => (t.byRepository(owner, repository)) && (t.milestoneId.? isDefined) }
|
||||
.filter { t => t.byRepository(owner, repository) && (t.milestoneId.? isDefined) }
|
||||
.groupBy { t => t.milestoneId -> t.closed }
|
||||
.map { case (t1, t2) => t1._1 -> t1._2 -> t2.length }
|
||||
.toMap
|
||||
@@ -52,6 +52,6 @@ trait MilestonesService {
|
||||
}
|
||||
|
||||
def getMilestones(owner: String, repository: String)(implicit s: Session): List[Milestone] =
|
||||
Milestones.filter(_.byRepository(owner, repository)).sortBy(_.milestoneId asc).list
|
||||
Milestones.filter(_.byRepository(owner, repository)).sortBy(t => (t.dueDate.asc, t.closedDate.desc, t.milestoneId.desc)).list
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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")))
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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 => ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.apache.commons.io.FileUtils
|
||||
import org.slf4j.LoggerFactory
|
||||
import akka.actor.{Actor, Props, ActorSystem}
|
||||
import com.typesafe.akka.extension.quartz.QuartzSchedulerExtension
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
/**
|
||||
* Initialize GitBucket system.
|
||||
@@ -35,6 +36,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 +58,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 +78,19 @@ 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)
|
||||
val databaseVersion = if(currentVersion == "4.0"){
|
||||
manager.updateVersion(GitBucketCoreModule.getModuleId, "4.0.0")
|
||||
"4.0.0"
|
||||
} else currentVersion
|
||||
|
||||
val gitbucketVersion = GitBucketCoreModule.getVersions.asScala.last.getVersion
|
||||
if(databaseVersion != gitbucketVersion){
|
||||
throw new IllegalStateException(s"Initialization failed. GitBucket version is ${gitbucketVersion}, but database version is ${databaseVersion}.")
|
||||
}
|
||||
|
||||
// Load plugins
|
||||
logger.info("Initialize plugins")
|
||||
PluginRegistry.initialize(event.getServletContext, loadSystemSettings(), conn)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import ControlUtil._
|
||||
import org.eclipse.jgit.api.Git
|
||||
import Directory._
|
||||
import org.eclipse.jgit.transport.{ReceivePack, UploadPack}
|
||||
import org.apache.sshd.server.command.UnknownCommand
|
||||
import org.apache.sshd.server.scp.UnknownCommand
|
||||
import org.eclipse.jgit.errors.RepositoryNotFoundException
|
||||
|
||||
object GitCommand {
|
||||
|
||||
@@ -7,12 +7,12 @@ import gitbucket.core.service.SshKeyService
|
||||
import gitbucket.core.servlet.Database
|
||||
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator
|
||||
import org.apache.sshd.server.session.ServerSession
|
||||
import org.apache.sshd.common.session.Session
|
||||
import org.apache.sshd.common.AttributeStore
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
object PublicKeyAuthenticator {
|
||||
// put in the ServerSession here to be read by GitCommand later
|
||||
private val userNameSessionKey = new Session.AttributeKey[String]
|
||||
private val userNameSessionKey = new AttributeStore.AttributeKey[String]
|
||||
|
||||
def putUserName(serverSession:ServerSession, userName:String):Unit =
|
||||
serverSession.setAttribute(userNameSessionKey, userName)
|
||||
|
||||
21
src/main/scala/gitbucket/core/util/AuthUtil.scala
Normal file
21
src/main/scala/gitbucket/core/util/AuthUtil.scala
Normal 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 => ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -3,11 +3,8 @@ package gitbucket.core.util
|
||||
import java.io._
|
||||
import java.sql._
|
||||
import java.text.SimpleDateFormat
|
||||
import javax.xml.stream.{XMLStreamConstants, XMLInputFactory, XMLOutputFactory}
|
||||
import ControlUtil._
|
||||
import scala.StringBuilder
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.mutable
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
||||
/**
|
||||
@@ -64,65 +61,34 @@ object JDBCUtil {
|
||||
}
|
||||
}
|
||||
|
||||
def importAsXML(in: InputStream): Unit = {
|
||||
def importAsSQL(in: InputStream): Unit = {
|
||||
conn.setAutoCommit(false)
|
||||
try {
|
||||
val factory = XMLInputFactory.newInstance()
|
||||
using(factory.createXMLStreamReader(in, "UTF-8")){ reader =>
|
||||
// stateful objects
|
||||
var elementName = ""
|
||||
var insertTable = ""
|
||||
var insertColumns = Map.empty[String, (String, String)]
|
||||
using(in){ in =>
|
||||
var out = new ByteArrayOutputStream()
|
||||
|
||||
while(reader.hasNext){
|
||||
reader.next()
|
||||
var length = 0
|
||||
val bytes = new scala.Array[Byte](1024 * 8)
|
||||
var stringLiteral = false
|
||||
|
||||
reader.getEventType match {
|
||||
case XMLStreamConstants.START_ELEMENT =>
|
||||
elementName = reader.getName.getLocalPart
|
||||
if(elementName == "insert"){
|
||||
insertTable = reader.getAttributeValue(null, "table")
|
||||
} else if(elementName == "delete"){
|
||||
val tableName = reader.getAttributeValue(null, "table")
|
||||
conn.update(s"DELETE FROM ${tableName}")
|
||||
} else if(elementName == "column"){
|
||||
val columnName = reader.getAttributeValue(null, "name")
|
||||
val columnType = reader.getAttributeValue(null, "type")
|
||||
val columnValue = reader.getElementText
|
||||
insertColumns = insertColumns + (columnName -> (columnType, columnValue))
|
||||
}
|
||||
case XMLStreamConstants.END_ELEMENT =>
|
||||
// Execute insert statement
|
||||
reader.getName.getLocalPart match {
|
||||
case "insert" => {
|
||||
val sb = new StringBuilder()
|
||||
sb.append(s"INSERT INTO ${insertTable} (")
|
||||
sb.append(insertColumns.map { case (columnName, _) => columnName }.mkString(", "))
|
||||
sb.append(") VALUES (")
|
||||
sb.append(insertColumns.map { case (_, (columnType, columnValue)) =>
|
||||
if(columnType == null || columnValue == null){
|
||||
"NULL"
|
||||
} else if(columnType == "string"){
|
||||
"'" + columnValue.replace("'", "''") + "'"
|
||||
} else if(columnType == "timestamp"){
|
||||
"'" + columnValue + "'"
|
||||
} else {
|
||||
columnValue.toString
|
||||
}
|
||||
}.mkString(", "))
|
||||
sb.append(")")
|
||||
var count = 0
|
||||
|
||||
conn.update(sb.toString)
|
||||
|
||||
insertColumns = Map.empty[String, (String, String)] // Clear column information
|
||||
}
|
||||
case _ => // Nothing to do
|
||||
}
|
||||
case _ => // Nothing to do
|
||||
while({ length = in.read(bytes); length != -1 }){
|
||||
for(i <- 0 to length - 1){
|
||||
val c = bytes(i)
|
||||
if(c == '\''){
|
||||
stringLiteral = !stringLiteral
|
||||
}
|
||||
if(c == ';' && !stringLiteral){
|
||||
val sql = new String(out.toByteArray, "UTF-8")
|
||||
conn.update(sql)
|
||||
out = new ByteArrayOutputStream()
|
||||
} else {
|
||||
out.write(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conn.commit()
|
||||
|
||||
} catch {
|
||||
@@ -133,68 +99,6 @@ object JDBCUtil {
|
||||
}
|
||||
}
|
||||
|
||||
def exportAsXML(targetTables: Seq[String]): File = {
|
||||
val dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
|
||||
val file = File.createTempFile("gitbucket-export-", ".xml")
|
||||
|
||||
val factory = XMLOutputFactory.newInstance()
|
||||
using(factory.createXMLStreamWriter(new FileOutputStream(file), "UTF-8")){ writer =>
|
||||
val dbMeta = conn.getMetaData
|
||||
val allTablesInDatabase = allTablesOrderByDependencies(dbMeta)
|
||||
|
||||
writer.writeStartDocument("UTF-8", "1.0")
|
||||
writer.writeStartElement("tables")
|
||||
|
||||
println(allTablesInDatabase.mkString(", "))
|
||||
|
||||
allTablesInDatabase.reverse.foreach { tableName =>
|
||||
if (targetTables.contains(tableName)) {
|
||||
writer.writeStartElement("delete")
|
||||
writer.writeAttribute("table", tableName)
|
||||
writer.writeEndElement()
|
||||
}
|
||||
}
|
||||
|
||||
allTablesInDatabase.foreach { tableName =>
|
||||
if (targetTables.contains(tableName)) {
|
||||
select(s"SELECT * FROM ${tableName}") { rs =>
|
||||
writer.writeStartElement("insert")
|
||||
writer.writeAttribute("table", tableName)
|
||||
val rsMeta = rs.getMetaData
|
||||
(1 to rsMeta.getColumnCount).foreach { i =>
|
||||
val columnName = rsMeta.getColumnName(i)
|
||||
val (columnType, columnValue) = if(rs.getObject(columnName) == null){
|
||||
(null, null)
|
||||
} else {
|
||||
rsMeta.getColumnType(i) match {
|
||||
case Types.BOOLEAN | Types.BIT => ("boolean", rs.getBoolean(columnName))
|
||||
case Types.VARCHAR | Types.CLOB | Types.CHAR | Types.LONGVARCHAR => ("string", rs.getString(columnName))
|
||||
case Types.INTEGER => ("int", rs.getInt(columnName))
|
||||
case Types.TIMESTAMP => ("timestamp", dateFormat.format(rs.getTimestamp(columnName)))
|
||||
}
|
||||
}
|
||||
writer.writeStartElement("column")
|
||||
writer.writeAttribute("name", columnName)
|
||||
if(columnType != null){
|
||||
writer.writeAttribute("type", columnType)
|
||||
}
|
||||
if(columnValue != null){
|
||||
writer.writeCharacters(columnValue.toString)
|
||||
}
|
||||
writer.writeEndElement()
|
||||
}
|
||||
writer.writeEndElement()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.writeEndElement()
|
||||
writer.writeEndDocument()
|
||||
}
|
||||
|
||||
file
|
||||
}
|
||||
|
||||
def exportAsSQL(targetTables: Seq[String]): File = {
|
||||
val dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
|
||||
val file = File.createTempFile("gitbucket-export-", ".sql")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>')));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
@@ -15,24 +13,14 @@
|
||||
</div>
|
||||
}
|
||||
<input type="submit" class="btn btn-success pull-right" value="Export">
|
||||
<div class="radio pull-right" style="margin-right: 10px;">
|
||||
<label>
|
||||
<input type="radio" name="type" value="sql">SQL
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio pull-right" style="margin-right: 10px;">
|
||||
<label>
|
||||
<input type="radio" name="type" value="xml" checked>XML
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading strong">Import (only XML)</div>
|
||||
<div class="panel-heading strong">Import</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>
|
||||
@@ -44,10 +32,10 @@
|
||||
$(function(){
|
||||
$('#import-form').submit(function(){
|
||||
if($('#file').val() == ''){
|
||||
alert('Choose an import XML file.');
|
||||
alert('Choose an import SQL file.');
|
||||
return false;
|
||||
} else if(!$('#file').val().endsWith(".xml")){
|
||||
alert('Import is available for only the XML file.');
|
||||
} else if(!$('#file').val().endsWith(".sql")){
|
||||
alert('Import is available for only the SQL file.');
|
||||
return false;
|
||||
}
|
||||
return confirm('All existing data is deleted before importing.\nAre you sure?');
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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") {
|
||||
@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 { plugin =>
|
||||
<li><a href="#@plugin.pluginId">@plugin.pluginId:@plugin.pluginVersion</a></li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
@plugins.map {plugin =>
|
||||
@plugins.map { plugin =>
|
||||
<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">@plugin.pluginVersion</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-md-2">Name</label>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>')));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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> ・
|
||||
<a href="@context.path/@issue.userName/@issue.repositoryName">@issue.userName/@issue.repositoryName</a> ・
|
||||
@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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@(title: String)(implicit context: gitbucket.core.controller.Context)
|
||||
@main("Error"){
|
||||
@gitbucket.core.html.main("Error"){
|
||||
<h1>@title</h1>
|
||||
}
|
||||
7
src/main/twirl/gitbucket/core/goget.scala.html
Normal file
7
src/main/twirl/gitbucket/core/goget.scala.html
Normal file
@@ -0,0 +1,7 @@
|
||||
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
|
||||
</head>
|
||||
</html>
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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 & 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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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: <span class="new-branch"></span></span>
|
||||
<br><span style="padding-left: 17px;">from '@branch'</span>
|
||||
<input type="hidden" name="new">
|
||||
|
||||
@@ -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>
|
||||
<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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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">×</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>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
<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,
|
||||
|
||||
@@ -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 =>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;"> </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);
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"> </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> ・
|
||||
<a href="@context.path/@issue.userName/@issue.repositoryName">@issue.repositoryName</a> ・
|
||||
}
|
||||
@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>
|
||||
|
||||
@@ -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"/>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/edit">Edit</a>
|
||||
@if(milestone.closedDate.isDefined){
|
||||
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/open">Open</a>
|
||||
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/open">Open</a>
|
||||
} else {
|
||||
<a href="@url(repository)/issues/milestones/@milestone.milestoneId/close">Close</a>
|
||||
<a href="@helpers.url(repository)/issues/milestones/@milestone.milestoneId/close">Close</a>
|
||||
}
|
||||
<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>
|
||||
|
||||
@@ -1,56 +1,54 @@
|
||||
@(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" />
|
||||
}
|
||||
<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 +57,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 +110,7 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@PluginRegistry().getJavaScript(request.getRequestURI).map { script =>
|
||||
@PluginRegistry().getJavaScript(context.request.getRequestURI).map { script =>
|
||||
<script>
|
||||
@Html(script)
|
||||
</script>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
<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); });
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user