From dda3458e802b135bb28a6cd71c64732a8a79666c Mon Sep 17 00:00:00 2001 From: ritschwumm Date: Thu, 28 Jan 2016 12:10:32 +0100 Subject: [PATCH 01/81] adapt how_to_run.md to changes in build.sbt --- doc/how_to_run.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index 0e18a8f83..9c1506c19 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -27,7 +27,8 @@ $ sbt package To build executable war file, run -* Windows: Not available -* Linux: `./release/make-release-war.sh` +``` +$ sbt executable +``` -at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. +at the top of the source tree. It generates executable `gitbucket.war` into `target/executable`. We release this war file as release artifact. From 860fc8ef4cbe2c69e639dd2eb9d0320302d038a2 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 30 Jan 2016 02:01:04 +0900 Subject: [PATCH 02/81] (refs #1080)Fix commit count presentation when over 10000 --- src/main/twirl/gitbucket/core/menu.scala.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index cd584f14d..b77e6baac 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -116,7 +116,11 @@ - @repository.commitCount commits + @if(repository.commitCount > 10000){ + 10000+ commits + } else { + @repository.commitCount commits + } From afa79d01b13df3f7c4f1f1bac58dd5942e83280e Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 30 Jan 2016 09:51:30 +0900 Subject: [PATCH 03/81] 3.11 Release --- README.md | 8 ++++++++ build.sbt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42150b43d..3db88e798 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,14 @@ Support Release Notes -------- +### 3.11 - 30 Jan 2016 +- Upgrade Scalatra to 2.4 +- Sidebar and Footer for Wiki +- Branch protection and receive hook extension point for plug-in +- Limit recent updated repositories list +- Issue actions look-alike GitHub +- Web API for labels + ### 3.10 - 30 Dec 2015 - Move to Bootstrap3 - New URL for raw contents (`raw/master/doc/activity.md` instead of `blob/master/doc/activity.md?raw=true`) diff --git a/build.sbt b/build.sbt index 34c6f5243..1ad1c2135 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ val Organization = "gitbucket" val Name = "gitbucket" -val GitBucketVersion = "3.11.0-SNAPSHOT" +val GitBucketVersion = "3.11.0" val ScalatraVersion = "2.4.0" val JettyVersion = "9.3.6.v20151106" From 0a759f6127d26a4f39e733603532635546f8b44a Mon Sep 17 00:00:00 2001 From: Herr Ritschwumm Date: Wed, 27 Jan 2016 20:09:23 +0100 Subject: [PATCH 04/81] cleanup: don't repeat yourself, calculate effective ssh port in one place only --- .../core/controller/SystemSettingsController.scala | 2 +- .../gitbucket/core/service/SystemSettingsService.scala | 1 + src/main/scala/gitbucket/core/service/WikiService.scala | 2 +- src/main/scala/gitbucket/core/ssh/NoShell.scala | 2 +- src/main/scala/gitbucket/core/ssh/SshServerListener.scala | 2 +- src/main/twirl/gitbucket/core/menu.scala.html | 4 ++-- src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html | 6 +++--- src/main/twirl/gitbucket/core/repo/guide.scala.html | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala index 01999f6f9..1a4d1e4ff 100644 --- a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala @@ -74,7 +74,7 @@ trait SystemSettingsControllerBase extends ControllerBase { if(form.ssh && !SshServer.isActive && form.baseUrl.isDefined){ SshServer.start( - form.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), + form.sshPortOrDefault, form.baseUrl.get) } else if(!form.ssh && SshServer.isActive){ SshServer.stop() diff --git a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala index 3346bec76..be08217fc 100644 --- a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala +++ b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala @@ -136,6 +136,7 @@ object SystemSettingsService { url.substring(0, url.length - (request.getRequestURI.length - request.getContextPath.length)) } }.stripSuffix("/") + def sshPortOrDefault:Int = sshPort.getOrElse(DefaultSshPort) } case class Ldap( diff --git a/src/main/scala/gitbucket/core/service/WikiService.scala b/src/main/scala/gitbucket/core/service/WikiService.scala index 29d8e56ce..3d2f23074 100644 --- a/src/main/scala/gitbucket/core/service/WikiService.scala +++ b/src/main/scala/gitbucket/core/service/WikiService.scala @@ -41,7 +41,7 @@ object WikiService { def httpUrl(repository: RepositoryInfo) = repository.httpUrl.replaceFirst("\\.git\\Z", ".wiki.git") def sshUrl(repository: RepositoryInfo, settings: SystemSettingsService.SystemSettings, userName: String) = - repository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), userName).replaceFirst("\\.git\\Z", ".wiki.git") + repository.sshUrl(settings.sshPortOrDefault, userName).replaceFirst("\\.git\\Z", ".wiki.git") } trait WikiService { diff --git a/src/main/scala/gitbucket/core/ssh/NoShell.scala b/src/main/scala/gitbucket/core/ssh/NoShell.scala index bd30ccf45..05975c28a 100644 --- a/src/main/scala/gitbucket/core/ssh/NoShell.scala +++ b/src/main/scala/gitbucket/core/ssh/NoShell.scala @@ -15,7 +15,7 @@ class NoShell extends Factory[Command] with SystemSettingsService { override def start(env: Environment): Unit = { val user = env.getEnv.get("USER") - val port = loadSystemSettings().sshPort.getOrElse(SystemSettingsService.DefaultSshPort) + val port = loadSystemSettings().sshPortOrDefault val message = """ | Welcome to diff --git a/src/main/scala/gitbucket/core/ssh/SshServerListener.scala b/src/main/scala/gitbucket/core/ssh/SshServerListener.scala index f79ae9370..060c4dfab 100644 --- a/src/main/scala/gitbucket/core/ssh/SshServerListener.scala +++ b/src/main/scala/gitbucket/core/ssh/SshServerListener.scala @@ -60,7 +60,7 @@ class SshServerListener extends ServletContextListener with SystemSettingsServic case None => logger.error("Could not start SshServer because the baseUrl is not configured.") case Some(baseUrl) => - SshServer.start(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), baseUrl) + SshServer.start(settings.sshPortOrDefault, baseUrl) } } } diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index b77e6baac..56e889b42 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -191,8 +191,8 @@ $(function(){ $('#repository-url-ssh').click(function(){ $('#repository-url-proto').text('SSH'); - $('#repository-url').val('@repository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)'); - $('#repository-clone-url').attr('href', '@repository.sshOpenRepoUrl(context.platform, settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)'); + $('#repository-url').val('@repository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)'); + $('#repository-clone-url').attr('href', '@repository.sshOpenRepoUrl(context.platform, settings.sshPortOrDefault, loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); } diff --git a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html index ca6ed9179..903f29bcb 100644 --- a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html @@ -178,7 +178,7 @@ $(function(){ $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)', + '@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)', '@forkedRepository.httpUrl' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); @@ -186,12 +186,12 @@ $(function(){ $('#repository-url-ssh').click(function(){ // Update URL box - $('#repository-url').val('@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)'); + $('#repository-url').val('@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( '@forkedRepository.httpUrl', - '@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)' + '@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); diff --git a/src/main/twirl/gitbucket/core/repo/guide.scala.html b/src/main/twirl/gitbucket/core/repo/guide.scala.html index cdb409955..a33545f2d 100644 --- a/src/main/twirl/gitbucket/core/repo/guide.scala.html +++ b/src/main/twirl/gitbucket/core/repo/guide.scala.html @@ -13,7 +13,7 @@ via HTTP @if(settings.ssh && loginAccount.isDefined){ or - SSH + SSH }

Create a new repository on the command line

From 518f0bfc2846ae141699a960379bed735e219f50 Mon Sep 17 00:00:00 2001 From: Herr Ritschwumm Date: Wed, 27 Jan 2016 23:33:56 +0100 Subject: [PATCH 05/81] cleanup: derive baseUrl from http request outside the SettingsService --- .../gitbucket/core/service/SystemSettingsService.scala | 7 ++----- src/main/scala/gitbucket/core/util/Implicits.scala | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala index be08217fc..35bda9330 100644 --- a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala +++ b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala @@ -1,6 +1,7 @@ package gitbucket.core.service import gitbucket.core.util.{Directory, ControlUtil} +import gitbucket.core.util.Implicits._ import Directory._ import ControlUtil._ import SystemSettingsService._ @@ -131,11 +132,7 @@ object SystemSettingsService { smtp: Option[Smtp], ldapAuthentication: Boolean, ldap: Option[Ldap]){ - def baseUrl(request: HttpServletRequest): String = baseUrl.getOrElse { - defining(request.getRequestURL.toString){ url => - url.substring(0, url.length - (request.getRequestURI.length - request.getContextPath.length)) - } - }.stripSuffix("/") + def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/")) def sshPortOrDefault:Int = sshPort.getOrElse(DefaultSshPort) } diff --git a/src/main/scala/gitbucket/core/util/Implicits.scala b/src/main/scala/gitbucket/core/util/Implicits.scala index 131bd9854..a7209de94 100644 --- a/src/main/scala/gitbucket/core/util/Implicits.scala +++ b/src/main/scala/gitbucket/core/util/Implicits.scala @@ -75,6 +75,11 @@ object Implicits { def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^/git/", "/") + def baseUrl:String = { + val url = request.getRequestURL.toString + val len = url.length - (request.getRequestURI.length - request.getContextPath.length) + url.substring(0, len).stripSuffix("/") + } } implicit class RichSession(session: HttpSession){ From 86163f66ceb18936eb79e6b7e99e4235c6521a14 Mon Sep 17 00:00:00 2001 From: Herr Ritschwumm Date: Fri, 29 Jan 2016 01:34:59 +0100 Subject: [PATCH 06/81] cleanup: jgit repo info does not have to know about urls in the gui --- .../core/service/RepositoryService.scala | 45 +++++++++++++------ .../scala/gitbucket/core/util/JGitUtil.scala | 13 +++--- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 8e74642b3..8c4e49e8d 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -205,8 +205,9 @@ trait RepositoryService { self: AccountService => }.map(_.pullRequest).list new RepositoryInfo( - JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName, baseUrl), + JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName), repository, + baseUrl, issues.count(_ == false), issues.count(_ == true), getForkedCount( @@ -242,11 +243,12 @@ trait RepositoryService { self: AccountService => }.sortBy(_.lastActivityDate desc).list.map{ repository => new RepositoryInfo( if(withoutPhysicalInfo){ - new JGitUtil.RepositoryInfo(repository.userName, repository.repositoryName, baseUrl) + new JGitUtil.RepositoryInfo(repository.userName, repository.repositoryName) } else { - JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName, baseUrl) + JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName) }, repository, + baseUrl, getForkedCount( repository.originUserName.getOrElse(repository.userName), repository.originRepositoryName.getOrElse(repository.repositoryName) @@ -284,11 +286,12 @@ trait RepositoryService { self: AccountService => }.sortBy(_.lastActivityDate desc).list.map{ repository => new RepositoryInfo( if(withoutPhysicalInfo){ - new JGitUtil.RepositoryInfo(repository.userName, repository.repositoryName, baseUrl) + new JGitUtil.RepositoryInfo(repository.userName, repository.repositoryName) } else { - JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName, baseUrl) + JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName) }, repository, + baseUrl, getForkedCount( repository.originUserName.getOrElse(repository.userName), repository.originRepositoryName.getOrElse(repository.repositoryName) @@ -389,14 +392,18 @@ trait RepositoryService { self: AccountService => object RepositoryService { - case class RepositoryInfo(owner: String, name: String, httpUrl: String, repository: Repository, + object RepositoryInfo { + def httpUrl(baseUrl:String, owner:String, name:String):String = s"${baseUrl}/git/${owner}/${name}.git" + def sshUrl(baseUrl:String, owner:String, name:String)(port: Int, userName: String):String = { + val host = """^https?://(.+?)(:\d+)?/""".r.findFirstMatchIn(baseUrl).get.group(1) + s"ssh://${userName}@${host}:${port}/${owner}/${name}.git" + } + } + case class RepositoryInfo(owner: String, name: String, repository: Repository, + httpUrl: String, sshUrl:(Int, String)=>String, issueCount: Int, pullCount: Int, commitCount: Int, forkedCount: Int, branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]){ - lazy val host = """^https?://(.+?)(:\d+)?/""".r.findFirstMatchIn(httpUrl).get.group(1) - - def sshUrl(port: Int, userName: String) = s"ssh://${userName}@${host}:${port}/${owner}/${name}.git" - def sshOpenRepoUrl(platform: String, port: Int, userName: String) = openRepoUrl(platform, sshUrl(port, userName)) def httpOpenRepoUrl(platform: String) = openRepoUrl(platform, httpUrl) @@ -406,14 +413,24 @@ object RepositoryService { /** * Creates instance with issue count and pull request count. */ - def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) = - this(repo.owner, repo.name, repo.url, model, issueCount, pullCount, repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) + def this(repo: JGitUtil.RepositoryInfo, model: Repository, baseUrl:String, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) = + this( + repo.owner, repo.name, model, + RepositoryInfo.httpUrl(baseUrl, repo.owner, repo.name), + RepositoryInfo.sshUrl(baseUrl, repo.owner, repo.name), + issueCount, pullCount, + repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) /** * Creates instance without issue count and pull request count. */ - def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int, managers: Seq[String]) = - this(repo.owner, repo.name, repo.url, model, 0, 0, repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) + def this(repo: JGitUtil.RepositoryInfo, model: Repository, baseUrl:String, forkedCount: Int, managers: Seq[String]) = + this( + repo.owner, repo.name, model, + RepositoryInfo.httpUrl(baseUrl, repo.owner, repo.name), + RepositoryInfo.sshUrl(baseUrl, repo.owner, repo.name), + 0, 0, + repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) } case class RepositoryTreeNode(owner: String, name: String, children: List[RepositoryTreeNode]) diff --git a/src/main/scala/gitbucket/core/util/JGitUtil.scala b/src/main/scala/gitbucket/core/util/JGitUtil.scala index cf2325780..2a1182fae 100644 --- a/src/main/scala/gitbucket/core/util/JGitUtil.scala +++ b/src/main/scala/gitbucket/core/util/JGitUtil.scala @@ -32,14 +32,13 @@ object JGitUtil { * * @param owner the user name of the repository owner * @param name the repository name - * @param url the repository URL * @param commitCount the commit count. If the repository has over 1000 commits then this property is 1001. * @param branchList the list of branch names * @param tags the list of tags */ - case class RepositoryInfo(owner: String, name: String, url: String, commitCount: Int, branchList: List[String], tags: List[TagInfo]){ - def this(owner: String, name: String, baseUrl: String) = { - this(owner, name, s"${baseUrl}/git/${owner}/${name}.git", 0, Nil, Nil) + case class RepositoryInfo(owner: String, name: String, commitCount: Int, branchList: List[String], tags: List[TagInfo]){ + def this(owner: String, name: String) = { + this(owner, name, 0, Nil, Nil) } } @@ -174,14 +173,14 @@ object JGitUtil { /** * Returns the repository information. It contains branch names and tag names. */ - def getRepositoryInfo(owner: String, repository: String, baseUrl: String): RepositoryInfo = { + def getRepositoryInfo(owner: String, repository: String): RepositoryInfo = { using(Git.open(getRepositoryDir(owner, repository))){ git => try { // get commit count val commitCount = git.log.all.call.iterator.asScala.map(_ => 1).take(10001).sum RepositoryInfo( - owner, repository, s"${baseUrl}/git/${owner}/${repository}.git", + owner, repository, // commit count commitCount, // branches @@ -197,7 +196,7 @@ object JGitUtil { } catch { // not initialized case e: NoHeadException => RepositoryInfo( - owner, repository, s"${baseUrl}/git/${owner}/${repository}.git", 0, Nil, Nil) + owner, repository, 0, Nil, Nil) } } From e7c337630318f36b2b1122adea710e9fa53bfec0 Mon Sep 17 00:00:00 2001 From: Herr Ritschwumm Date: Fri, 29 Jan 2016 14:59:40 +0100 Subject: [PATCH 07/81] cleanup: baseUrl is not used here at all --- src/main/scala/gitbucket/core/ssh/GitCommand.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/gitbucket/core/ssh/GitCommand.scala b/src/main/scala/gitbucket/core/ssh/GitCommand.scala index 8e19255c7..423624107 100644 --- a/src/main/scala/gitbucket/core/ssh/GitCommand.scala +++ b/src/main/scala/gitbucket/core/ssh/GitCommand.scala @@ -124,7 +124,7 @@ class DefaultGitReceivePack(owner: String, repoName: String, baseUrl: String) ex } } -class PluginGitUploadPack(repoName: String, baseUrl: String, routing: GitRepositoryRouting) extends GitCommand +class PluginGitUploadPack(repoName: String, routing: GitRepositoryRouting) extends GitCommand with SystemSettingsService { override protected def runTask(user: String)(implicit session: Session): Unit = { @@ -139,7 +139,7 @@ class PluginGitUploadPack(repoName: String, baseUrl: String, routing: GitReposit } } -class PluginGitReceivePack(repoName: String, baseUrl: String, routing: GitRepositoryRouting) extends GitCommand +class PluginGitReceivePack(repoName: String, routing: GitRepositoryRouting) extends GitCommand with SystemSettingsService { override protected def runTask(user: String)(implicit session: Session): Unit = { @@ -163,8 +163,8 @@ class GitCommandFactory(baseUrl: String) extends CommandFactory { logger.debug(s"command: $command") command match { - case SimpleCommandRegex ("upload" , repoName) if(pluginRepository(repoName)) => new PluginGitUploadPack (repoName, baseUrl, routing(repoName)) - case SimpleCommandRegex ("receive", repoName) if(pluginRepository(repoName)) => new PluginGitReceivePack(repoName, baseUrl, routing(repoName)) + case SimpleCommandRegex ("upload" , repoName) if(pluginRepository(repoName)) => new PluginGitUploadPack (repoName, routing(repoName)) + case SimpleCommandRegex ("receive", repoName) if(pluginRepository(repoName)) => new PluginGitReceivePack(repoName, routing(repoName)) case DefaultCommandRegex("upload" , owner, repoName) => new DefaultGitUploadPack (owner, repoName, baseUrl) case DefaultCommandRegex("receive", owner, repoName) => new DefaultGitReceivePack(owner, repoName, baseUrl) case _ => new UnknownCommand(command) From 63369258bdd092c5d38922262df789faba58664f Mon Sep 17 00:00:00 2001 From: Herr Ritschwumm Date: Fri, 29 Jan 2016 16:02:09 +0100 Subject: [PATCH 08/81] preparation: move url generation from RepositoryInfo towards the gui --- .../core/controller/ControllerBase.scala | 5 ++- .../core/service/RepositoryService.scala | 40 ++++++++++--------- .../gitbucket/core/service/WikiService.scala | 7 ++-- .../scala/gitbucket/core/util/RepoBase.scala | 3 ++ .../gitbucket/core/util/SshAddress.scala | 3 ++ .../scala/gitbucket/core/view/Markdown.scala | 10 +++-- src/main/twirl/gitbucket/core/main.scala.html | 2 +- src/main/twirl/gitbucket/core/menu.scala.html | 14 +++---- .../core/pulls/mergeguide.scala.html | 18 ++++----- .../gitbucket/core/repo/guide.scala.html | 8 ++-- .../twirl/gitbucket/core/wiki/page.scala.html | 8 ++-- 11 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 src/main/scala/gitbucket/core/util/RepoBase.scala create mode 100644 src/main/scala/gitbucket/core/util/SshAddress.scala diff --git a/src/main/scala/gitbucket/core/controller/ControllerBase.scala b/src/main/scala/gitbucket/core/controller/ControllerBase.scala index 5d449ba13..a94c90a57 100644 --- a/src/main/scala/gitbucket/core/controller/ControllerBase.scala +++ b/src/main/scala/gitbucket/core/controller/ControllerBase.scala @@ -180,11 +180,14 @@ abstract class ControllerBase extends ScalatraFilter * Context object for the current request. */ case class Context(settings: SystemSettingsService.SystemSettings, loginAccount: Option[Account], request: HttpServletRequest){ - val path = settings.baseUrl.getOrElse(request.getContextPath) val currentPath = request.getRequestURI.substring(request.getContextPath.length) val baseUrl = settings.baseUrl(request) val host = new java.net.URL(baseUrl).getHost + val repoBase = RepoBase( + baseUrl, + if (settings.ssh) Some(SshAddress(host, settings.sshPortOrDefault)) else None + ) val platform = request.getHeader("User-Agent") match { case null => null case agent if agent.contains("Mac") => "mac" diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 8c4e49e8d..1d6834506 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -2,7 +2,7 @@ package gitbucket.core.service import gitbucket.core.model.{Collaborator, Repository, Account} import gitbucket.core.model.Profile._ -import gitbucket.core.util.JGitUtil +import gitbucket.core.util.{JGitUtil, RepoBase} import profile.simple._ trait RepositoryService { self: AccountService => @@ -392,23 +392,11 @@ trait RepositoryService { self: AccountService => object RepositoryService { - object RepositoryInfo { - def httpUrl(baseUrl:String, owner:String, name:String):String = s"${baseUrl}/git/${owner}/${name}.git" - def sshUrl(baseUrl:String, owner:String, name:String)(port: Int, userName: String):String = { - val host = """^https?://(.+?)(:\d+)?/""".r.findFirstMatchIn(baseUrl).get.group(1) - s"ssh://${userName}@${host}:${port}/${owner}/${name}.git" - } - } case class RepositoryInfo(owner: String, name: String, repository: Repository, - httpUrl: String, sshUrl:(Int, String)=>String, issueCount: Int, pullCount: Int, commitCount: Int, forkedCount: Int, - branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]){ + branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]) { - def sshOpenRepoUrl(platform: String, port: Int, userName: String) = openRepoUrl(platform, sshUrl(port, userName)) - - def httpOpenRepoUrl(platform: String) = openRepoUrl(platform, httpUrl) - - def openRepoUrl(platform: String, openUrl: String) = s"github-${platform}://openRepo/${openUrl}" + def urls(repoBase:RepoBase):RepositoryUrls = new RepositoryUrls(repoBase, owner, name) /** * Creates instance with issue count and pull request count. @@ -416,8 +404,6 @@ object RepositoryService { def this(repo: JGitUtil.RepositoryInfo, model: Repository, baseUrl:String, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) = this( repo.owner, repo.name, model, - RepositoryInfo.httpUrl(baseUrl, repo.owner, repo.name), - RepositoryInfo.sshUrl(baseUrl, repo.owner, repo.name), issueCount, pullCount, repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) @@ -427,11 +413,27 @@ object RepositoryService { def this(repo: JGitUtil.RepositoryInfo, model: Repository, baseUrl:String, forkedCount: Int, managers: Seq[String]) = this( repo.owner, repo.name, model, - RepositoryInfo.httpUrl(baseUrl, repo.owner, repo.name), - RepositoryInfo.sshUrl(baseUrl, repo.owner, repo.name), 0, 0, repo.commitCount, forkedCount, repo.branchList, repo.tags, managers) } + final class RepositoryUrls(repoBase:RepoBase, owner:String, name:String) { + def httpUrl:String = + s"${repoBase.baseUrl}/git/${owner}/${name}.git" + + // BETTER make this return an Option and use it in the gui + def sshUrl(userName: String):String = + repoBase.sshAddress.fold("")(adr => s"ssh://${userName}@${adr.host}:${adr.port}/${owner}/${name}.git") + + def sshOpenRepoUrl(platform: String, userName: String) = + openRepoUrl(platform, sshUrl(userName)) + + def httpOpenRepoUrl(platform: String) = + openRepoUrl(platform, httpUrl) + + private def openRepoUrl(platform: String, openUrl: String) = + s"github-${platform}://openRepo/${openUrl}" + } + case class RepositoryTreeNode(owner: String, name: String, children: List[RepositoryTreeNode]) } diff --git a/src/main/scala/gitbucket/core/service/WikiService.scala b/src/main/scala/gitbucket/core/service/WikiService.scala index 3d2f23074..ed898ba86 100644 --- a/src/main/scala/gitbucket/core/service/WikiService.scala +++ b/src/main/scala/gitbucket/core/service/WikiService.scala @@ -38,10 +38,11 @@ object WikiService { */ case class WikiPageHistoryInfo(name: String, committer: String, message: String, date: Date) - def httpUrl(repository: RepositoryInfo) = repository.httpUrl.replaceFirst("\\.git\\Z", ".wiki.git") + def httpUrl(repoBase:RepoBase, repository: RepositoryInfo) = + repository.urls(repoBase).httpUrl.replaceFirst("\\.git\\Z", ".wiki.git") - def sshUrl(repository: RepositoryInfo, settings: SystemSettingsService.SystemSettings, userName: String) = - repository.sshUrl(settings.sshPortOrDefault, userName).replaceFirst("\\.git\\Z", ".wiki.git") + def sshUrl(repoBase:RepoBase, repository: RepositoryInfo, userName: String) = + repository.urls(repoBase).sshUrl(userName).replaceFirst("\\.git\\Z", ".wiki.git") } trait WikiService { diff --git a/src/main/scala/gitbucket/core/util/RepoBase.scala b/src/main/scala/gitbucket/core/util/RepoBase.scala new file mode 100644 index 000000000..5a577b8e6 --- /dev/null +++ b/src/main/scala/gitbucket/core/util/RepoBase.scala @@ -0,0 +1,3 @@ +package gitbucket.core.util + +case class RepoBase(baseUrl:String, sshAddress:Option[SshAddress]) diff --git a/src/main/scala/gitbucket/core/util/SshAddress.scala b/src/main/scala/gitbucket/core/util/SshAddress.scala new file mode 100644 index 000000000..aafbcbaac --- /dev/null +++ b/src/main/scala/gitbucket/core/util/SshAddress.scala @@ -0,0 +1,3 @@ +package gitbucket.core.util + +case class SshAddress(host:String, port:Int) diff --git a/src/main/scala/gitbucket/core/view/Markdown.scala b/src/main/scala/gitbucket/core/view/Markdown.scala index 2d57d1c4a..b31eef856 100644 --- a/src/main/scala/gitbucket/core/view/Markdown.scala +++ b/src/main/scala/gitbucket/core/view/Markdown.scala @@ -60,6 +60,8 @@ object Markdown { pages: List[String]) (implicit val context: Context) extends Renderer(options) with LinkConverter with RequestCache { + private val repositoryUrls = repository.urls(context.repoBase) + override def heading(text: String, level: Int, raw: String): String = { val id = generateAnchorName(text) val out = new StringBuilder() @@ -135,7 +137,7 @@ object Markdown { (link, link) } - val url = repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/" + StringUtil.urlEncode(page) + val url = repositoryUrls.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/" + StringUtil.urlEncode(page) if(pages.contains(page)){ "" + escape(label) + "" } else { @@ -157,14 +159,14 @@ object Markdown { } else if(context.currentPath.contains("/tree/")){ val paths = context.currentPath.split("/") val branch = if(paths.length > 3) paths.drop(4).mkString("/") else repository.repository.defaultBranch - repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + url + (if(isImage) "?raw=true" else "") + repositoryUrls.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + url + (if(isImage) "?raw=true" else "") } else { val paths = context.currentPath.split("/") val branch = if(paths.length > 3) paths.last else repository.repository.defaultBranch - repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + url + (if(isImage) "?raw=true" else "") + repositoryUrls.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + url + (if(isImage) "?raw=true" else "") } } else { - repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url + repositoryUrls.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url } } diff --git a/src/main/twirl/gitbucket/core/main.scala.html b/src/main/twirl/gitbucket/core/main.scala.html index b1d597a22..2b179b4fa 100644 --- a/src/main/twirl/gitbucket/core/main.scala.html +++ b/src/main/twirl/gitbucket/core/main.scala.html @@ -37,7 +37,7 @@ @repository.map { repository => @if(!repository.repository.isPrivate){ - + } } diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 56e889b42..828769ebe 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -80,8 +80,8 @@
HTTP clone URL
- @helper.html.copy("repository-url-copy", repository.httpUrl){ - + @helper.html.copy("repository-url-copy", repository.urls(repoBase).httpUrl){ + } @if(settings.ssh && loginAccount.isDefined){
@@ -91,7 +91,7 @@ @id.map { id => @if(context.platform != "linux" && context.platform != null){ }
@@ -184,15 +184,15 @@ $(function(){ @if(settings.ssh && loginAccount.isDefined){ $('#repository-url-http').click(function(){ $('#repository-url-proto').text('HTTP'); - $('#repository-url').val('@repository.httpUrl'); - $('#repository-clone-url').attr('href', '@repository.httpOpenRepoUrl(context.platform)') + $('#repository-url').val('@repository.urls(repoBase).httpUrl'); + $('#repository-clone-url').attr('href', '@repository.urls(repoBase).httpOpenRepoUrl(context.platform)') $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); $('#repository-url-ssh').click(function(){ $('#repository-url-proto').text('SSH'); - $('#repository-url').val('@repository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)'); - $('#repository-clone-url').attr('href', '@repository.sshOpenRepoUrl(context.platform, settings.sshPortOrDefault, loginAccount.get.userName)'); + $('#repository-url').val('@repository.urls(repoBase).sshUrl(loginAccount.get.userName)'); + $('#repository-clone-url').attr('href', '@repository.urls(repoBase).sshOpenRepoUrl(context.platform, loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); } diff --git a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html index 903f29bcb..9e0b87663 100644 --- a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html @@ -100,21 +100,21 @@ you can perform a manual merge on the command line.

} - @helper.html.copy("repository-url-copy", forkedRepository.httpUrl, true){ + @helper.html.copy("repository-url-copy", forkedRepository.urls(repoBase).httpUrl, true){
@if(settings.ssh && loginAccount.isDefined){ }
- + }

Step 1: From your project repository, check out a new branch and test the changes.

@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" + - s"git pull ${forkedRepository.httpUrl} ${pullreq.requestBranch}"){ command => + s"git pull ${forkedRepository.urls(repoBase).httpUrl} ${pullreq.requestBranch}"){ command => @helper.html.copy("merge-command-copy-1", command){
@Html(command)
} @@ -174,24 +174,24 @@ $(function(){ @if(settings.ssh && loginAccount.isDefined){ $('#repository-url-http').click(function(){ // Update URL box - $('#repository-url').val('@forkedRepository.httpUrl'); + $('#repository-url').val('@forkedRepository.urls(repoBase).httpUrl'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)', - '@forkedRepository.httpUrl' + '@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)', + '@forkedRepository.urls(repoBase).httpUrl' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); $('#repository-url-ssh').click(function(){ // Update URL box - $('#repository-url').val('@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)'); + $('#repository-url').val('@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@forkedRepository.httpUrl', - '@forkedRepository.sshUrl(settings.sshPortOrDefault, loginAccount.get.userName)' + '@forkedRepository.urls(repoBase).httpUrl', + '@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); diff --git a/src/main/twirl/gitbucket/core/repo/guide.scala.html b/src/main/twirl/gitbucket/core/repo/guide.scala.html index a33545f2d..e39d37b39 100644 --- a/src/main/twirl/gitbucket/core/repo/guide.scala.html +++ b/src/main/twirl/gitbucket/core/repo/guide.scala.html @@ -10,10 +10,10 @@ } else {

Quick setup — if you've done this kind of thing before

- via HTTP + via HTTP @if(settings.ssh && loginAccount.isDefined){ or - SSH + SSH }

Create a new repository on the command line

@@ -22,12 +22,12 @@ git init git add README.md git commit -m "first commit" - git remote add origin @repository.httpUrl + git remote add origin @repository.urls(repoBase).httpUrl git push -u origin master }

Push an existing repository from the command line

@pre { - git remote add origin @repository.httpUrl + git remote add origin @repository.urls(repoBase).httpUrl git push -u origin master } @repository.map { repository => @if(!repository.repository.isPrivate){ - + } } diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 828769ebe..560d16e77 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -80,8 +80,8 @@
HTTP clone URL
- @helper.html.copy("repository-url-copy", repository.urls(repoBase).httpUrl){ - + @helper.html.copy("repository-url-copy", context.urls(repository).httpUrl){ + } @if(settings.ssh && loginAccount.isDefined){
@@ -91,7 +91,7 @@ @id.map { id => @if(context.platform != "linux" && context.platform != null){ }
@@ -184,15 +184,15 @@ $(function(){ @if(settings.ssh && loginAccount.isDefined){ $('#repository-url-http').click(function(){ $('#repository-url-proto').text('HTTP'); - $('#repository-url').val('@repository.urls(repoBase).httpUrl'); - $('#repository-clone-url').attr('href', '@repository.urls(repoBase).httpOpenRepoUrl(context.platform)') + $('#repository-url').val('@context.urls(repository).httpUrl'); + $('#repository-clone-url').attr('href', '@context.urls(repository).httpOpenRepoUrl(context.platform)') $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); $('#repository-url-ssh').click(function(){ $('#repository-url-proto').text('SSH'); - $('#repository-url').val('@repository.urls(repoBase).sshUrl(loginAccount.get.userName)'); - $('#repository-clone-url').attr('href', '@repository.urls(repoBase).sshOpenRepoUrl(context.platform, loginAccount.get.userName)'); + $('#repository-url').val('@context.urls(repository).sshUrl(loginAccount.get.userName)'); + $('#repository-clone-url').attr('href', '@context.urls(repository).sshOpenRepoUrl(context.platform, loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); } diff --git a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html index 9e0b87663..c788a7f61 100644 --- a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html @@ -100,21 +100,21 @@ you can perform a manual merge on the command line.

} - @helper.html.copy("repository-url-copy", forkedRepository.urls(repoBase).httpUrl, true){ + @helper.html.copy("repository-url-copy", context.urls(forkedRepository).httpUrl, true){
@if(settings.ssh && loginAccount.isDefined){ }
- + }

Step 1: From your project repository, check out a new branch and test the changes.

@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" + - s"git pull ${forkedRepository.urls(repoBase).httpUrl} ${pullreq.requestBranch}"){ command => + s"git pull ${context.urls(forkedRepository).httpUrl} ${pullreq.requestBranch}"){ command => @helper.html.copy("merge-command-copy-1", command){
@Html(command)
} @@ -174,24 +174,24 @@ $(function(){ @if(settings.ssh && loginAccount.isDefined){ $('#repository-url-http').click(function(){ // Update URL box - $('#repository-url').val('@forkedRepository.urls(repoBase).httpUrl'); + $('#repository-url').val('@context.urls(forkedRepository).httpUrl'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)', - '@forkedRepository.urls(repoBase).httpUrl' + '@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)', + '@context.urls(forkedRepository).httpUrl' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); $('#repository-url-ssh').click(function(){ // Update URL box - $('#repository-url').val('@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)'); + $('#repository-url').val('@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@forkedRepository.urls(repoBase).httpUrl', - '@forkedRepository.urls(repoBase).sshUrl(loginAccount.get.userName)' + '@context.urls(forkedRepository).httpUrl', + '@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); diff --git a/src/main/twirl/gitbucket/core/repo/guide.scala.html b/src/main/twirl/gitbucket/core/repo/guide.scala.html index e39d37b39..5c064b424 100644 --- a/src/main/twirl/gitbucket/core/repo/guide.scala.html +++ b/src/main/twirl/gitbucket/core/repo/guide.scala.html @@ -10,10 +10,10 @@ } else {

Quick setup — if you've done this kind of thing before

- via HTTP + via HTTP @if(settings.ssh && loginAccount.isDefined){ or - SSH + SSH }

Create a new repository on the command line

@@ -22,12 +22,12 @@ git init git add README.md git commit -m "first commit" - git remote add origin @repository.urls(repoBase).httpUrl + git remote add origin @context.urls(repository).httpUrl git push -u origin master }

Push an existing repository from the command line

@pre { - git remote add origin @repository.urls(repoBase).httpUrl + git remote add origin @context.urls(repository).httpUrl git push -u origin master } @repository.map { repository => @if(!repository.repository.isPrivate){ - + } } diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 560d16e77..465f1ff84 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -5,9 +5,9 @@ isNoGroup: Boolean = true, info: Option[Any] = None, error: Option[Any] = None)(body: Html)(implicit context: gitbucket.core.controller.Context) -@import gitbucket.core.service.SystemSettingsService @import context._ @import gitbucket.core.view.helpers._ +@import gitbucket.core.service.RepositoryService._ @sidemenu(path: String, name: String, icon: String, label: String, count: Int = 0) = {
  • @@ -80,10 +80,10 @@
    HTTP clone URL
    - @helper.html.copy("repository-url-copy", context.urls(repository).httpUrl){ - + @helper.html.copy("repository-url-copy", repository.httpUrl){ + } - @if(settings.ssh && loginAccount.isDefined){ + @if(repository.sshUrl.isDefined){
    You can clone HTTP or SSH.
    @@ -91,7 +91,7 @@ @id.map { id => @if(context.platform != "linux" && context.platform != null){ }
    @@ -181,18 +181,18 @@ $(function(){ }); } - @if(settings.ssh && loginAccount.isDefined){ + @repository.sshUrl.map { sshUrl => $('#repository-url-http').click(function(){ $('#repository-url-proto').text('HTTP'); - $('#repository-url').val('@context.urls(repository).httpUrl'); - $('#repository-clone-url').attr('href', '@context.urls(repository).httpOpenRepoUrl(context.platform)') + $('#repository-url').val('@repository.httpUrl'); + $('#repository-clone-url').attr('href', '@openRepoUrl(repository.httpUrl)') $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); $('#repository-url-ssh').click(function(){ $('#repository-url-proto').text('SSH'); - $('#repository-url').val('@context.urls(repository).sshUrl(loginAccount.get.userName)'); - $('#repository-clone-url').attr('href', '@context.urls(repository).sshOpenRepoUrl(context.platform, loginAccount.get.userName)'); + $('#repository-url').val('@sshUrl'); + $('#repository-clone-url').attr('href', '@openRepoUrl(sshUrl)'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); }); } diff --git a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html index c788a7f61..77e1f9973 100644 --- a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html @@ -100,21 +100,21 @@ you can perform a manual merge on the command line.

    } - @helper.html.copy("repository-url-copy", context.urls(forkedRepository).httpUrl, true){ + @helper.html.copy("repository-url-copy", forkedRepository.httpUrl, true){
    @if(settings.ssh && loginAccount.isDefined){ }
    - + }

    Step 1: From your project repository, check out a new branch and test the changes.

    @defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" + - s"git pull ${context.urls(forkedRepository).httpUrl} ${pullreq.requestBranch}"){ command => + s"git pull ${forkedRepository.httpUrl} ${pullreq.requestBranch}"){ command => @helper.html.copy("merge-command-copy-1", command){
    @Html(command)
    } @@ -171,27 +171,26 @@ $(function(){ $('#confirm-merge-form').show(); }); - @if(settings.ssh && loginAccount.isDefined){ + @* @if(settings.ssh && loginAccount.isDefined){ *@ + @forkedRepository.sshUrl.map { sshUrl => $('#repository-url-http').click(function(){ // Update URL box - $('#repository-url').val('@context.urls(forkedRepository).httpUrl'); + $('#repository-url').val('@forkedRepository.httpUrl'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)', - '@context.urls(forkedRepository).httpUrl' + '@sshUrl', '@forkedRepository.httpUrl' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); $('#repository-url-ssh').click(function(){ // Update URL box - $('#repository-url').val('@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)'); + $('#repository-url').val('@sshUrl'); $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); // Update command guidance $('#merge-command').text($('#merge-command').text().replace( - '@context.urls(forkedRepository).httpUrl', - '@context.urls(forkedRepository).sshUrl(loginAccount.get.userName)' + '@forkedRepository.httpUrl', '@sshUrl' )); $('#merge-command-copy-1').attr('data-clipboard-text', $('#merge-command').text()); }); diff --git a/src/main/twirl/gitbucket/core/repo/guide.scala.html b/src/main/twirl/gitbucket/core/repo/guide.scala.html index 5c064b424..b95546e78 100644 --- a/src/main/twirl/gitbucket/core/repo/guide.scala.html +++ b/src/main/twirl/gitbucket/core/repo/guide.scala.html @@ -10,10 +10,10 @@ } else {

    Quick setup — if you've done this kind of thing before

    - via HTTP - @if(settings.ssh && loginAccount.isDefined){ + via HTTP + @repository.sshUrl.map { sshUrl => or - SSH + SSH }

    Create a new repository on the command line

    @@ -22,12 +22,12 @@ git init git add README.md git commit -m "first commit" - git remote add origin @context.urls(repository).httpUrl + git remote add origin @repository.httpUrl git push -u origin master }

    Push an existing repository from the command line

    @pre { - git remote add origin @context.urls(repository).httpUrl + git remote add origin @repository.httpUrl git push -u origin master } diff --git a/src/main/twirl/gitbucket/core/repo/files.scala.html b/src/main/twirl/gitbucket/core/repo/files.scala.html index b272a3b37..0a0f18186 100644 --- a/src/main/twirl/gitbucket/core/repo/files.scala.html +++ b/src/main/twirl/gitbucket/core/repo/files.scala.html @@ -11,6 +11,7 @@ error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context) @import context._ @import gitbucket.core.view.helpers._ +@import gitbucket.core.service.RepositoryService._ @html.main( if(pathList.isEmpty){ if(branch == repository.repository.defaultBranch){ @@ -23,12 +24,32 @@ }, Some(repository)) { @html.menu("code", repository, Some(branch), pathList.isEmpty, groupNames.isEmpty, info, error){
    -
    - - @if(pathList.nonEmpty){ - - } -
    + @if(pathList.isEmpty){ +
    + @if(platform != "linux" && platform != null){ + + } + Download ZIP +
    +
    +
    + @helper.html.copy("repository-url-copy", repository.httpUrl){ + + } +
    +
    +
    +
    + Find file + @* + @if(pathList.nonEmpty){ + History + } + *@ +
    +
    + } + @branchPullRequest.map{ case (pullRequest, issue) => #@pullRequest.issueId }.getOrElse{ From 760d443f7410b37eebd89231f01723105b0ef954 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 15 Feb 2016 09:11:57 +0900 Subject: [PATCH 43/81] Tweak top margin of contents --- .../core/account/application.scala.html | 2 +- .../gitbucket/core/account/edit.scala.html | 2 +- .../gitbucket/core/account/group.scala.html | 2 +- .../gitbucket/core/account/main.scala.html | 2 +- .../gitbucket/core/account/newrepo.scala.html | 2 +- .../core/account/register.scala.html | 2 +- .../gitbucket/core/account/ssh.scala.html | 2 +- .../gitbucket/core/admin/menu.scala.html | 2 +- .../core/dashboard/issues.scala.html | 10 +- .../gitbucket/core/dashboard/pulls.scala.html | 10 +- .../twirl/gitbucket/core/index.scala.html | 136 +++++----- .../webapp/assets/common/css/gitbucket.css | 248 +----------------- 12 files changed, 93 insertions(+), 327 deletions(-) diff --git a/src/main/twirl/gitbucket/core/account/application.scala.html b/src/main/twirl/gitbucket/core/account/application.scala.html index f36e84006..2b722eed5 100644 --- a/src/main/twirl/gitbucket/core/account/application.scala.html +++ b/src/main/twirl/gitbucket/core/account/application.scala.html @@ -4,7 +4,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("Applications"){ -
    +
    @menu("application", settings.ssh) diff --git a/src/main/twirl/gitbucket/core/account/edit.scala.html b/src/main/twirl/gitbucket/core/account/edit.scala.html index ba16103df..a549edeb5 100644 --- a/src/main/twirl/gitbucket/core/account/edit.scala.html +++ b/src/main/twirl/gitbucket/core/account/edit.scala.html @@ -3,7 +3,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("Edit your profile"){ -
    +
    @menu("profile", settings.ssh) diff --git a/src/main/twirl/gitbucket/core/account/group.scala.html b/src/main/twirl/gitbucket/core/account/group.scala.html index 92a840e38..60b3d724f 100644 --- a/src/main/twirl/gitbucket/core/account/group.scala.html +++ b/src/main/twirl/gitbucket/core/account/group.scala.html @@ -2,7 +2,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main(if(account.isEmpty) "Create group" else "Edit group"){ -
    +
    diff --git a/src/main/twirl/gitbucket/core/account/main.scala.html b/src/main/twirl/gitbucket/core/account/main.scala.html index dcf5a4052..aa193d3ee 100644 --- a/src/main/twirl/gitbucket/core/account/main.scala.html +++ b/src/main/twirl/gitbucket/core/account/main.scala.html @@ -3,7 +3,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main(account.userName){ -
    +
    diff --git a/src/main/twirl/gitbucket/core/account/newrepo.scala.html b/src/main/twirl/gitbucket/core/account/newrepo.scala.html index 9233e0afb..b79605351 100644 --- a/src/main/twirl/gitbucket/core/account/newrepo.scala.html +++ b/src/main/twirl/gitbucket/core/account/newrepo.scala.html @@ -3,7 +3,7 @@ isCreateRepoOptionPublic: Boolean)(implicit context: gitbucket.core.controller.C @import context._ @import gitbucket.core.view.helpers._ @html.main("Create a New Repository"){ -
    +

    Create a new repository

    A repository contains all the files for your project, including the revision history. diff --git a/src/main/twirl/gitbucket/core/account/register.scala.html b/src/main/twirl/gitbucket/core/account/register.scala.html index 07e798a2b..94f95abeb 100644 --- a/src/main/twirl/gitbucket/core/account/register.scala.html +++ b/src/main/twirl/gitbucket/core/account/register.scala.html @@ -2,7 +2,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("Create your account"){ -

    +

    Create your account

    diff --git a/src/main/twirl/gitbucket/core/account/ssh.scala.html b/src/main/twirl/gitbucket/core/account/ssh.scala.html index fcf5bdaa9..7b1f2a029 100644 --- a/src/main/twirl/gitbucket/core/account/ssh.scala.html +++ b/src/main/twirl/gitbucket/core/account/ssh.scala.html @@ -3,7 +3,7 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("SSH Keys"){ -
    +
    @menu("ssh", settings.ssh) diff --git a/src/main/twirl/gitbucket/core/admin/menu.scala.html b/src/main/twirl/gitbucket/core/admin/menu.scala.html index df32fbd3d..dba5f63db 100644 --- a/src/main/twirl/gitbucket/core/admin/menu.scala.html +++ b/src/main/twirl/gitbucket/core/admin/menu.scala.html @@ -11,7 +11,7 @@ System Settings
  • - Plugins + Plugins
  • H2 Console diff --git a/src/main/twirl/gitbucket/core/dashboard/issues.scala.html b/src/main/twirl/gitbucket/core/dashboard/issues.scala.html index af395e570..8b3e140fc 100644 --- a/src/main/twirl/gitbucket/core/dashboard/issues.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/issues.scala.html @@ -8,9 +8,11 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("Issues"){ - @dashboard.html.tab("issues") -
    - @issuesnavi(filter, "issues", condition) - @issueslist(issues, page, openCount, closedCount, condition, filter, groups) +
    + @dashboard.html.tab("issues") +
    + @issuesnavi(filter, "issues", condition) + @issueslist(issues, page, openCount, closedCount, condition, filter, groups) +
    } diff --git a/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html b/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html index 46dba3055..23367257b 100644 --- a/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html @@ -8,9 +8,11 @@ @import context._ @import gitbucket.core.view.helpers._ @html.main("Pull Requests"){ - @dashboard.html.tab("pulls") -
    - @issuesnavi(filter, "pulls", condition) - @issueslist(issues, page, openCount, closedCount, condition, filter, groups) +
    + @dashboard.html.tab("pulls") +
    + @issuesnavi(filter, "pulls", condition) + @issueslist(issues, page, openCount, closedCount, condition, filter, groups) +
    } diff --git a/src/main/twirl/gitbucket/core/index.scala.html b/src/main/twirl/gitbucket/core/index.scala.html index 5d499dc2a..d3e6b38b6 100644 --- a/src/main/twirl/gitbucket/core/index.scala.html +++ b/src/main/twirl/gitbucket/core/index.scala.html @@ -4,79 +4,81 @@ @import context._ @import gitbucket.core.view.helpers._ @main("GitBucket"){ - @dashboard.html.tab() -
    -
    -
    -
    - activities -
    - @helper.html.activities(activities) -
    - -
    - @settings.information.map { information => -
    - - @Html(information) +
    + @dashboard.html.tab() +
    +
    +
    +
    + activities
    - } - @if(loginAccount.isEmpty){ -
    @signinform(settings)
    - } else { -
    -
    - - Your repositories @userRepositories.size + @helper.html.activities(activities) +
    + +
    + @settings.information.map { information => +
    + + @Html(information)
    - +
    diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 80573e504..f36161d04 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -58,7 +58,7 @@ h6 { margin-right: 5px; } -.head .octicon,.head .mega-octicon{ +.head .octicon, .head .mega-octicon{ color : #BBB; } @@ -70,57 +70,6 @@ blockquote p { font-size: 15px; } -/* -.nav { - margin-bottom: 12px; -} - -.table-bordered { - border-collapse: inherit; - border: none; -} - -.table-bordered > thead > tr > th, -.table-bordered > tbody > tr > th, -.table-bordered > tbody > tr > td { - border-bottom: none; -} - -.table-bordered > thead > tr:first-child > th:nth-of-type(1), -.table-bordered > tbody > tr:first-child > th:nth-of-type(1), -.table-bordered > tbody > tr:first-child > td:nth-of-type(1) { - border-top-left-radius: 4px; -} - -.table-bordered > thead > tr:first-child > th:nth-last-of-type(1), -.table-bordered > tbody > tr:first-child > th:nth-last-of-type(1), -.table-bordered > tbody > tr:first-child > td:nth-last-of-type(1) { - border-top-right-radius: 4px; -} - -.table-bordered > tbody > tr:last-child > td:nth-of-type(1) { - border-bottom-left-radius: 4px; -} - -.table-bordered > tbody > tr:last-child > td:nth-last-of-type(1) { - border-bottom-right-radius: 4px; -} - -.table-bordered > tbody > tr:last-child > td { - border-bottom: 1px solid #dddddd; -} -*/ -/* -.table-bordered > thead > tr > th, -.table-bordered > thead > tr > td { - border-bottom-width: 1px; -} -*/ -/* -.tab-content { - margin-top: 20px; -} -*/ .danger { color: #900; } @@ -167,43 +116,6 @@ pre.reset { /* ======================================================================== */ /* Global Header */ /* ======================================================================== */ -/* -div.navbar-inner { - border-radius: 0px; - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - border-top: none; - border-left: none; - border-right: none; - border-bottom: 1px solid #d4d4d4; - padding-right: 0px; -} - -div.header-menu { - line-height: 40px; -} - -div.header-menu .octicon{ - color: #333; -} - -div.header-menu input, -div.header-menu a.btn { - margin-top: 0px; - margin-bottom: 0px; -} - -/* -div.nav-collapse a.menu { - margin-right: 12px; -} - -div.nav-collapse a.btn-last, -div.nav-collapse a.menu-last { - margin-right: 30px; -} -*/ - .navbar-brand { height: unset; padding: 8px; @@ -278,6 +190,7 @@ div.pagination { */ div.body { + margin-top: 20px; margin-bottom: 40px; } @@ -413,23 +326,6 @@ div.box-content { padding: 4px; border-radius: 3px; } -/* -div > div.box-content-row:nth-of-type(1) { - border: none; -} - -div.box-content-row { - border-top: 1px solid #d8d8d8; - padding: 4px; -} -*/ -/* -div.repo-link { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -*/ li.repo-link, li.page-link { padding-top: 4px; @@ -632,18 +528,6 @@ a#show-pages-index { text-decoration: none; } -/* -ul.nav-stacked.side-menu li span.header { - border-top-right-radius: 3px; - border-top-left-radius: 3px; - border: 1px solid #d8d8d8; - display: block; - padding: 8px 15px 9px; - margin-right: 2px; - background-color: #f5f5f5; -} -*/ - ul.nav-stacked.side-menu li a:hover { background-color: transparent; } @@ -746,7 +630,6 @@ div.repository-content { padding: 0 3px; } - /****************************************************************************/ /* Activity */ /****************************************************************************/ @@ -974,73 +857,6 @@ span.simplified-path { color: #0088cc; } -/****************************************************************************/ -/* nav pulls group */ -/****************************************************************************/ - - -/* -.nav-pills-group:after { - display: table; - line-height: 0; - content: ""; -} - -.nav-pills-group:after { - clear: both; -} - -.nav-pills-group > li { - float: left; -} -*/ -/* -.nav-pills > li + li { - margin-left: 0px; -} - -.nav-pills > li > a { - padding-right: 12px; - padding-left: 12px; - line-height: 14px; - color: #666; - font-weight: bold; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} - -.nav-pills > li > a { - padding-top: 10px; - padding-bottom: 10px; - border-left : 1px solid #e5e5e5; - border-top : 1px solid #e5e5e5; - border-bottom : 1px solid #e5e5e5; -} - -.nav-pills > li:nth-of-type(1) > a { - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} - -.nav-pills > li:nth-last-of-type(1) > a { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; - border-right : 1px solid #e5e5e5; -} -*/ -/* -.nav-pills-group > .active > a, -.nav-pills-group > .active > a:hover, -.nav-pills-group > .active > a:focus { - color: #ffffff; - background-color: #0088cc; - border-color: #0088cc; -} -*/ - /****************************************************************************/ /* Issues */ /****************************************************************************/ @@ -1077,11 +893,11 @@ table.table-issues { margin-top: 12px; } -table.table-issues td .octicon-issue-opened,table.table-issues td .octicon-git-pull-request .open { +table.table-issues td .octicon-issue-opened, table.table-issues td .octicon-git-pull-request .open { color: #6CC644; } -table.table-issues td .octicon-issue-closed,table.table-issues td .octicon-git-pull-request .closed{ +table.table-issues td .octicon-issue-closed, table.table-issues td .octicon-git-pull-request .closed{ color : #BD2C00;; } @@ -1153,47 +969,6 @@ div.milestone-menu a.delete { color: #b00; } -/* -div#milestone-progress-area { - display: inline-block; -} - -div#milestone-progress-area div.milestone-progress { - width: 130px; - margin-bottom: -6px; -} - -div.milestone-progress { - position: relative; - height: 10px; - color: white; - margin-bottom: 4px; - font-weight: bold; - font-size: 12px; - text-shadow: 0px 0px 5px #444; - background-color: silver; - border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; -} - -span.milestone-progress { - position: absolute; - height: 100%; - background-color: green; - border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; -} - -div.issue-header { - padding-left: 8px; - padding-right: 8px; - padding-top: 12px; - padding-bottom: 12px; -} -*/ - div.issue-info { border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; @@ -1203,21 +978,6 @@ div.issue-info { margin-right: 0px; } -/* -div.issue-content { - padding: 13px; - background-color: #fff; -} - -div.issue-content p:first-child { - margin-top: 0; -} - -div.issue-content p:last-child { - margin-bottom: 0; -} -*/ - h4#issueTitle { font-size: large; font-weight: bold; From 5a90848c7588b6fbcaf482539f3200279e59fba2 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 15 Feb 2016 09:20:36 +0900 Subject: [PATCH 44/81] Remove unused code --- src/main/twirl/gitbucket/core/menu.scala.html | 98 +++++++------------ 1 file changed, 34 insertions(+), 64 deletions(-) diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index d41832895..2c47f6afb 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -70,71 +70,41 @@
    -@* - @if(expand){ -
    - HTTP clone URL -
    - @helper.html.copy("repository-url-copy", repository.httpUrl){ - - } - @if(repository.sshUrl.isDefined){ -
    - You can clone HTTP or SSH. -
    - } - @id.map { id => - @if(context.platform != "linux" && context.platform != null){ - - } - - - } + @if(isRepoTop){ + @repository.repository.description.map { description => +

    @detectAndRenderLinks(description)

    } -*@ -@*
    *@ - @if(isRepoTop){ - @repository.repository.description.map { description => -

    @detectAndRenderLinks(description)

    - } - - } - @body -
    -@*
    *@ + + } + @body +
    diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index f36161d04..2880ab324 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -1185,18 +1185,6 @@ a.absent { color: #c00; } -/* -div.wiki-index-header { - background-color: #f5f5f5; - color: #333333; - margin: 0; - border-top-left-radius: 3px; - border-top-right-radius: 3px; - border: 1px solid #d8d8d8; - padding: 8px 8px 8px 8px; -} -*/ - div.wiki-sidebar { background-color: white; border: 1px solid #d8d8d8; @@ -1226,18 +1214,6 @@ div.wiki-footer { color: gray; } -/* -div.wiki-index-content { - background-color: white; - border: 1px solid #d8d8d8; - padding: 0px; - border-bottom-left-radius: 3px; - border-bottom-right-radius: 3px; - margin-bottom: 20px; - border-top: none; -} -*/ - /****************************************************************************/ /* Commit */ /****************************************************************************/ From 4d39f63ef74276b12c37988899a6a88d4d5d6ca0 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 16 Feb 2016 02:36:45 +0900 Subject: [PATCH 47/81] Tweak header buttons --- .../twirl/gitbucket/core/repo/blob.scala.html | 2 +- .../gitbucket/core/repo/files.scala.html | 33 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/main/twirl/gitbucket/core/repo/blob.scala.html b/src/main/twirl/gitbucket/core/repo/blob.scala.html index ea97b8e40..bae4c53a4 100644 --- a/src/main/twirl/gitbucket/core/repo/blob.scala.html +++ b/src/main/twirl/gitbucket/core/repo/blob.scala.html @@ -11,7 +11,7 @@ @html.menu("code", repository){
    - + Find file
    Newer diff --git a/src/main/twirl/gitbucket/core/repo/files.scala.html b/src/main/twirl/gitbucket/core/repo/files.scala.html index 48b77455e..1a1397d03 100644 --- a/src/main/twirl/gitbucket/core/repo/files.scala.html +++ b/src/main/twirl/gitbucket/core/repo/files.scala.html @@ -59,30 +59,29 @@ }
    -
    -
    - New file - Find file - @* - @if(pathList.nonEmpty){ - History - } - *@ -
    -
    } +
    +
    + New file + Find file + @if(pathList.nonEmpty){ + History + } +
    +
    @helper.html.branchcontrol(branch, repository, hasWritePermission){ @repository.branchList.map { x =>
  • @helper.html.checkicon(x == branch) @x
  • } } - @branchPullRequest.map{ case (pullRequest, issue) => - View #@pullRequest.issueId - }.getOrElse { - New pull request - } - @if(pathList.nonEmpty) { + @if(pathList.isEmpty){ + @branchPullRequest.map{ case (pullRequest, issue) => + View #@pullRequest.issueId + }.getOrElse { + New pull request + } + } else { @repository.name / @pathList.zipWithIndex.map { case (section, i) => @section / From 1af561115949e6b882eb4c97248c2ebe00ebb104 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 16 Feb 2016 02:51:09 +0900 Subject: [PATCH 48/81] Mobile view improvement --- src/main/twirl/gitbucket/core/menu.scala.html | 19 +------------------ .../gitbucket/core/repo/files.scala.html | 8 ++++---- .../twirl/gitbucket/core/wiki/page.scala.html | 2 +- .../webapp/assets/common/css/gitbucket.css | 7 +++++-- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 2c47f6afb..c26bc8159 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -11,7 +11,7 @@ @menuitem(path: String, name: String, icon: String, label: String, count: Int = 0) = {
  • - @label + @label @if(count > 0){ @count } @@ -143,22 +143,5 @@ $(function(){ $('#fork-form').submit(); }); } -@* - @repository.sshUrl.map { sshUrl => - $('#repository-url-http').click(function(){ - $('#repository-url-proto').text('HTTP'); - $('#repository-url').val('@repository.httpUrl'); - $('#repository-clone-url').attr('href', '@openRepoUrl(repository.httpUrl)') - $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); - }); - - $('#repository-url-ssh').click(function(){ - $('#repository-url-proto').text('SSH'); - $('#repository-url').val('@sshUrl'); - $('#repository-clone-url').attr('href', '@openRepoUrl(sshUrl)'); - $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); - }); - } -*@ }); diff --git a/src/main/twirl/gitbucket/core/repo/files.scala.html b/src/main/twirl/gitbucket/core/repo/files.scala.html index 1a1397d03..c2b5d2ce9 100644 --- a/src/main/twirl/gitbucket/core/repo/files.scala.html +++ b/src/main/twirl/gitbucket/core/repo/files.scala.html @@ -25,13 +25,13 @@ @html.menu("code", repository, Some(branch), pathList.isEmpty, groupNames.isEmpty, info, error){
    @if(pathList.isEmpty){ -
    + -
    +
    @helper.html.copy("repository-url-copy", repository.httpUrl){ @if(repository.sshUrl.isDefined){ @@ -62,8 +62,8 @@ }
    - New file - Find file + New file + Find file @if(pathList.nonEmpty){ History } diff --git a/src/main/twirl/gitbucket/core/wiki/page.scala.html b/src/main/twirl/gitbucket/core/wiki/page.scala.html index 9bc6a8099..cf5963a29 100644 --- a/src/main/twirl/gitbucket/core/wiki/page.scala.html +++ b/src/main/twirl/gitbucket/core/wiki/page.scala.html @@ -26,7 +26,7 @@ }
  • -
    +
    @defining(15){ max =>
    diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 2880ab324..9f764ad84 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -1965,6 +1965,9 @@ div.container.blame-container{ .body>div.pull-left { width: auto !important; } + .pc { + display: none; + } /* Adjust issue search box size and position */ #search-filter-box { @@ -1985,7 +1988,7 @@ div.container.blame-container{ overflow: hidden; display: inline-block; } - +/* .nav-tabs a.btn[href$="/_edit"] { width: 24px; white-space: nowrap; @@ -1993,7 +1996,7 @@ div.container.blame-container{ padding: 4px 6px; margin: 3px 4px 0 0; } - +*/ body>div.container.body { margin: 0 -12px 40px -12px; } From 8494c682a763da7444f35f8222fc005af64a567b Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 16 Feb 2016 15:02:34 +0900 Subject: [PATCH 49/81] Fix search box style for mobile --- src/main/webapp/assets/common/css/gitbucket.css | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 9f764ad84..75c6df62c 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -1971,17 +1971,16 @@ div.container.blame-container{ /* Adjust issue search box size and position */ #search-filter-box { - width: 98% !important; - position: absolute; - left: 4px; - margin-top: 42px; + width: 100% !important; } - form#search-filter-form { float: none !important; - margin-bottom: 80px !important; + margin-bottom: 10px; + } + form#search-filter-form>div.form-group { + width: 100% !important; + margin-bottom: 10px; } - .table-issues a.button-link { width: 42px; height: 16px; From 0cf1f43deb24b6939675acb5cf10c3e5823d69f6 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 16 Feb 2016 17:34:21 +0900 Subject: [PATCH 50/81] Adjust issue / comment form --- src/main/twirl/gitbucket/core/issues/create.scala.html | 2 +- src/main/webapp/assets/common/css/gitbucket.css | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/issues/create.scala.html b/src/main/twirl/gitbucket/core/issues/create.scala.html index 6b2865d3a..39665d1ef 100644 --- a/src/main/twirl/gitbucket/core/issues/create.scala.html +++ b/src/main/twirl/gitbucket/core/issues/create.scala.html @@ -14,7 +14,7 @@
    - + @helper.html.preview( repository = repository, content = "", diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 75c6df62c..78b70d8ff 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -1969,6 +1969,15 @@ div.container.blame-container{ display: none; } + /* Adjust issue / comment form */ + #issue-title { + width: 100% !important; + } + div.attachable>textarea, + div.attachable>div.clickable { + width: 100% !important; + } + /* Adjust issue search box size and position */ #search-filter-box { width: 100% !important; From 7d7d2f488dc8736491be1895f8dc4377df5bf433 Mon Sep 17 00:00:00 2001 From: oohira Date: Mon, 15 Feb 2016 23:59:16 +0900 Subject: [PATCH 51/81] Add margin after octicon --- src/main/twirl/gitbucket/core/issues/issueinfo.scala.html | 3 ++- .../twirl/gitbucket/core/issues/milestones/list.scala.html | 3 ++- src/main/twirl/gitbucket/core/search/issues.scala.html | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html b/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html index b53f6e9a0..a4ea54274 100644 --- a/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html +++ b/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html @@ -49,7 +49,8 @@
    @milestone.dueDate.map { dueDate => @if(isPast(dueDate)){ - Due by @date(dueDate) + + Due by @date(dueDate) } else { Due by @date(dueDate) } diff --git a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html index fff7c3723..a81ed5384 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html @@ -41,7 +41,8 @@ } else { @milestone.dueDate.map { dueDate => @if(isPast(dueDate)){ - Due by @date(dueDate) + + Due by @date(dueDate) } else { Due by @date(dueDate) } diff --git a/src/main/twirl/gitbucket/core/search/issues.scala.html b/src/main/twirl/gitbucket/core/search/issues.scala.html index c7795ea36..7feb997d6 100644 --- a/src/main/twirl/gitbucket/core/search/issues.scala.html +++ b/src/main/twirl/gitbucket/core/search/issues.scala.html @@ -24,7 +24,8 @@ Opened by @issue.openedUserName @helper.html.datetimeago(issue.registeredDate) @if(issue.commentCount > 0){ -   @issue.commentCount @plural(issue.commentCount, "comment") +    + @issue.commentCount @plural(issue.commentCount, "comment") }
    From 56bb20dfd22b9dc5c816529a3346985be732f993 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Fri, 19 Feb 2016 15:48:14 +0900 Subject: [PATCH 52/81] (refs #1113)Improve printing styles --- src/main/webapp/assets/common/css/gitbucket.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 78b70d8ff..a92eed32b 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -2037,6 +2037,11 @@ div.container.blame-container{ /****************************************************************************/ /* Print */ /****************************************************************************/ -a[href]:after { - display: none; +@media print { + div.headbar { + display: none; + } + a[href]:after { + display: none; + } } From 70e0dcf99dc2cc4250b8d5fa80f362ad37109c4e Mon Sep 17 00:00:00 2001 From: lidice Date: Fri, 19 Feb 2016 19:52:57 +0900 Subject: [PATCH 53/81] (fixes #1114)Add Colorpicker options that to force hex format --- src/main/twirl/gitbucket/core/issues/labels/edit.scala.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/issues/labels/edit.scala.html b/src/main/twirl/gitbucket/core/issues/labels/edit.scala.html index bf2cf31e9..ac17a3cd2 100644 --- a/src/main/twirl/gitbucket/core/issues/labels/edit.scala.html +++ b/src/main/twirl/gitbucket/core/issues/labels/edit.scala.html @@ -11,7 +11,7 @@
    From b52e904ed18c885cffaa0f99e720ab4ac0ff990a Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 20 Feb 2016 20:52:56 +0900 Subject: [PATCH 54/81] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7234da3d..447946029 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Guideline for Issues -- If you have any question about GitBucket, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raise an issue. -- Make sure check whether there is a same question or request in the past. -- When raise a new issue, write subject in **English** at least. +- At first, See [FAQ](https://github.com/gitbucket/gitbucket/wiki/FAQ) and check issues whether there is a same question or request in the past. +- If you can't find same question and report, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raising an issue. - We can also support in Japaneses other than English at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- Write an issue in English. At least, write subject in English. - First priority of GitBucket is easy installation and reproduce GitHub behavior, so we might reject if your request is against it. From aa0bd5b34aa9ec0fa949b5b1304d3dca636b19db Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 20 Feb 2016 23:02:00 +0900 Subject: [PATCH 55/81] Update version to 3.12 --- build.sbt | 2 +- src/main/scala/gitbucket/core/servlet/AutoUpdate.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 52d37b5e1..419398d31 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ val Organization = "gitbucket" val Name = "gitbucket" -val GitBucketVersion = "3.11.0" +val GitBucketVersion = "3.12.0" val ScalatraVersion = "2.4.0" val JettyVersion = "9.3.6.v20151106" diff --git a/src/main/scala/gitbucket/core/servlet/AutoUpdate.scala b/src/main/scala/gitbucket/core/servlet/AutoUpdate.scala index 2d80bf798..8cef2e836 100644 --- a/src/main/scala/gitbucket/core/servlet/AutoUpdate.scala +++ b/src/main/scala/gitbucket/core/servlet/AutoUpdate.scala @@ -21,6 +21,7 @@ object AutoUpdate { * The history of versions. A head of this sequence is the current GitBucket version. */ val versions = Seq( + new Version(3, 12), new Version(3, 11), new Version(3, 10), new Version(3, 9), From 06fc26cd06e1ed028cdf196a6dae2c8337f99018 Mon Sep 17 00:00:00 2001 From: Matthieu Brouillard Date: Sat, 20 Feb 2016 12:02:45 +0100 Subject: [PATCH 56/81] addition of issues & PR templates --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 .github/ISSUE_TEMPLATE.md | 19 +++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 8 ++++++++ 3 files changed, 27 insertions(+) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..854e8068c --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,19 @@ +### Before submitting an issue to Gitbucket I have first: + +- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/CONTRIBUTING.md) +- [] searched for similar already existing issue +- [] read the documentation and [wiki](https://github.com/gitbucket/gitbucket/wiki) + +*(if you have performed all the above, remove the paragraph and continue describing the issue with template below)* + +## Issue +**Impacted version**: xxxx + +**Deployment mode**: *explain here how you use gitbucket : standalone app, under webcontainer (which one), with an http frontend (nginx, httpd, ...)* + +**Problem description**: +- *be as explicit has you can* +- *describe the problem and its symptoms* +- *explain how to reproduce* +- *attach whatever information that can help understanding the context (screen capture, log files)* +- *do your best to use a correct english (re-read yourself)* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..91947c642 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +### Before submitting a pull-request to Gitbucket I have first: + +- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/CONTRIBUTING.md) +- [] rebased my branch over master +- [] verified that project is compiling +- [] verified that tests are passing +- [] squashed my commits as appropriate *(keep several commits if it is relevant to understand the PR)* +- [] [marked as closed](https://help.github.com/articles/closing-issues-via-commit-messages/) all issue ID that this PR should correct From c47d50d0dfde79a3aff532000468a15eaafc70cf Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 21 Feb 2016 15:36:41 +0900 Subject: [PATCH 57/81] Fix pull request guide --- .../gitbucket/core/helper/copy.scala.html | 18 ++++++++--- .../core/pulls/mergeguide.scala.html | 31 +++++++++---------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/main/twirl/gitbucket/core/helper/copy.scala.html b/src/main/twirl/gitbucket/core/helper/copy.scala.html index 7811063fa..d0172ab0c 100644 --- a/src/main/twirl/gitbucket/core/helper/copy.scala.html +++ b/src/main/twirl/gitbucket/core/helper/copy.scala.html @@ -1,8 +1,16 @@ -@(id: String, value: String, prepend: Boolean = false)(html: Html) -
    - @html - -
    +@(id: String, value: String, style: String = "")(html: Html = Html("")) +@if(html.body.nonEmpty){ +
    + @html + + + +
    +} else { + +} } diff --git a/src/main/twirl/gitbucket/core/issues/create.scala.html b/src/main/twirl/gitbucket/core/issues/create.scala.html index 39665d1ef..97ab7ac5d 100644 --- a/src/main/twirl/gitbucket/core/issues/create.scala.html +++ b/src/main/twirl/gitbucket/core/issues/create.scala.html @@ -14,7 +14,7 @@
    - + @helper.html.preview( repository = repository, content = "", @@ -23,7 +23,7 @@ enableLineBreaks = true, enableTaskList = true, hasWritePermission = hasWritePermission, - style = "width: 680px; height: 200px; max-height: 250px;", + style = "height: 200px; max-height: 250px;", elastic = true )
    diff --git a/src/main/twirl/gitbucket/core/pulls/compare.scala.html b/src/main/twirl/gitbucket/core/pulls/compare.scala.html index 15d4015dc..36ad7eee7 100644 --- a/src/main/twirl/gitbucket/core/pulls/compare.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/compare.scala.html @@ -59,7 +59,7 @@
    - + @helper.html.preview( repository = repository, content = "", @@ -68,7 +68,7 @@ enableLineBreaks = true, enableTaskList = true, hasWritePermission = true, - style = "width: 680px; height: 200px;" + style = "height: 200px;" ) diff --git a/src/main/twirl/gitbucket/core/repo/commentform.scala.html b/src/main/twirl/gitbucket/core/repo/commentform.scala.html index 2535212d0..ef4f58eed 100644 --- a/src/main/twirl/gitbucket/core/repo/commentform.scala.html +++ b/src/main/twirl/gitbucket/core/repo/commentform.scala.html @@ -23,7 +23,7 @@ enableLineBreaks = true, enableTaskList = true, hasWritePermission = hasWritePermission, - style = "width: 635px; height: 100px; max-height: 150px;", + style = "height: 100px; max-height: 150px;", elastic = true )
    diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 2d92e75ce..3661caf42 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -1025,7 +1025,6 @@ div.commit-comment-box > div.panel-body { div.issue-comment-box textarea { - width: 650px; height: 100px; max-height: 300px; } From da2a7bf77d33cac14e7dc4d110101351481d5a6e Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 27 Feb 2016 04:48:46 +0900 Subject: [PATCH 67/81] Fix comment editing in pull request diff view --- src/main/twirl/gitbucket/core/issues/commentlist.scala.html | 2 +- src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html | 2 +- src/main/twirl/gitbucket/core/repo/editcomment.scala.html | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html index 8c6369231..9ba093552 100644 --- a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html @@ -210,7 +210,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 $content = $('.commit-commentContent-' + id, $(this).closest('.box')); + var $content = $('.commit-commentContent-' + id, $(this).closest('.commit-comment-box')); $.get(url, { diff --git a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html index c39dd4df1..50cca1767 100644 --- a/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/mergeguide.scala.html @@ -139,7 +139,7 @@ Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
    - +
    diff --git a/src/main/twirl/gitbucket/core/repo/editcomment.scala.html b/src/main/twirl/gitbucket/core/repo/editcomment.scala.html index 5e1c4cf82..62fd5c2b8 100644 --- a/src/main/twirl/gitbucket/core/repo/editcomment.scala.html +++ b/src/main/twirl/gitbucket/core/repo/editcomment.scala.html @@ -2,11 +2,11 @@ @import context._ @helper.html.attached(owner, repository){ - + }
    - +