Skip to content

Commit b4c9830

Browse files
committed
Fix header link (for GitBucket 3.1.1)
1 parent 123bf16 commit b4c9830

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

project/build.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object MyBuild extends Build {
77

88
val Organization = "jp.sf.amateras"
99
val Name = "gitbucket-gist-plugin"
10-
val Version = "1.0"
10+
val Version = "1.1"
1111
val ScalaVersion = "2.11.2"
1212

1313
lazy val project = Project (
@@ -25,7 +25,7 @@ object MyBuild extends Build {
2525
"amateras-repo" at "http://amateras.sourceforge.jp/mvn/"
2626
),
2727
libraryDependencies ++= Seq(
28-
"gitbucket" % "gitbucket-assembly" % "3.1.0",
28+
"gitbucket" % "gitbucket-assembly" % "3.1.1",
2929
"com.typesafe.play" %% "twirl-compiler" % "1.0.2",
3030
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
3131
),

src/main/scala/Plugin.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import gitbucket.gist.controller.GistController
22
import gitbucket.core.plugin.PluginRegistry
33
import gitbucket.core.util.Version
44
import java.io.File
5+
import javax.servlet.ServletContext
56
import gitbucket.gist.util.Configurations._
67

78
class Plugin extends gitbucket.core.plugin.Plugin {
@@ -10,11 +11,13 @@ class Plugin extends gitbucket.core.plugin.Plugin {
1011
override val description: String = "Provides Gist feature on GitBucket."
1112
override val versions: List[Version] = List(Version(1, 0))
1213

13-
override def initialize(registry: PluginRegistry): Unit = {
14+
override def initialize(registry: PluginRegistry, context: ServletContext): Unit = {
1415
// Add Snippet link to the header
1516
registry.addJavaScript(".*",
16-
"""
17-
|$('a.brand').after($('<span style="float: left; margin-top: 10px;">|&nbsp;&nbsp;&nbsp;&nbsp;<a href="/gist" style="color: black;">Snippet</a></span>'));
17+
s"""
18+
|$$('a.brand').after(
19+
| $$('<span style="float: left; margin-top: 10px;">|&nbsp;&nbsp;&nbsp;&nbsp;<a href="${context.getContextPath}/gist" style="color: black;">Snippet</a></span>')
20+
|);
1821
""".stripMargin)
1922

2023
val rootdir = new File(GistRepoDir)
@@ -37,6 +40,6 @@ class Plugin extends gitbucket.core.plugin.Plugin {
3740
println("-- Gist plug-in initialized --")
3841
}
3942

40-
override def shutdown(registry: PluginRegistry): Unit = {
43+
override def shutdown(registry: PluginRegistry, context: ServletContext): Unit = {
4144
}
4245
}

0 commit comments

Comments
 (0)