diff --git a/README.MD b/README.MD index e97169ddd..9ddac971a 100644 --- a/README.MD +++ b/README.MD @@ -53,14 +53,14 @@ read the [developer guide](/CONTRIBUTING.md) You can add this badge to the README.MD of your own GitHub projects to show the versions of Scala they support: -[![Scala version Badge](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg) +[![cats-core Scala version support](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg)](https://index.scala-lang.org/typelevel/cats/cats-core) ...the badge above only summarises latest JVM artifacts, if you'd like a badge for Scala JS or Scala Native, add a `targetType=...` query-string parameter: -[![Scala version Badge](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg?targetType=js) +[![cats-core Scala version support](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg?targetType=js)](https://index.scala-lang.org/typelevel/cats/cats-core) -[![Scala version Badge](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg?targetType=native) +[![cats-core Scala version support](https://index.scala-lang.org/typelevel/cats/cats-core/latest-by-scala-version.svg?targetType=native)](https://index.scala-lang.org/typelevel/cats/cats-core) ### Smaller, shorter badges diff --git a/model/src/main/scala/ch.epfl.scala.index.model/Release.scala b/model/src/main/scala/ch.epfl.scala.index.model/Release.scala index 6085696a0..b571dd06f 100644 --- a/model/src/main/scala/ch.epfl.scala.index.model/Release.scala +++ b/model/src/main/scala/ch.epfl.scala.index.model/Release.scala @@ -227,10 +227,19 @@ object Release { def projectReference = Project.Reference(organization, repository) def name = s"$organization/$artifact" + + def artifactHttpPath = s"/$organization/$repository/$artifact" + def artifactFullHttpUrl = s"https://index.scala-lang.org$artifactHttpPath" + private def nonDefaultTargetType = { + target.map(_.targetType).filter(_ != Jvm) + } + def badgeUrl: String = + s"$artifactFullHttpUrl/latest-by-scala-version.svg" + + nonDefaultTargetType.map("?targetType=" + _).mkString def httpUrl = { val targetQuery = target.map(t => s"?target=${t.encode}").getOrElse("") - s"/$organization/$repository/$artifact/$version$targetQuery" + s"$artifactHttpPath/$version$targetQuery" } def isScalaLib: Boolean = { diff --git a/server/src/main/assets/css/partials/_main.scss b/server/src/main/assets/css/partials/_main.scss index b6a04ab73..b788f679c 100755 --- a/server/src/main/assets/css/partials/_main.scss +++ b/server/src/main/assets/css/partials/_main.scss @@ -14,6 +14,10 @@ main { flex: 1; } +.copyable-incantation { + user-select: all; +} + .banner { background: #0c353c; text-align: center; @@ -493,6 +497,11 @@ main { margin-bottom: ($line-height-computed / 1.5); } .install { + .btn-copy { + position: absolute; + top: 50px; + right: 6px; + } .nav-tabs > li:not(.active) > a { color: white; } @@ -587,11 +596,6 @@ main { .tab-pane { height: 85px; } - .btn-copy { - position: absolute; - top: 50px; - right: 6px; - } } .head-project { @@ -676,6 +680,58 @@ main { } } +.badge-showcase { + .overlay { + position: fixed; + z-index: 10; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.7); + transition: opacity 500ms; + visibility: hidden; + opacity: 0; + } + .overlay:target { + visibility: visible; + opacity: 1; + } + + .popup { + margin: 70px auto; + padding: 20px; + background: #fff; + border-radius: 5px; + width: 60%; + position: relative; + transition: all 5s ease-in-out; + } + + .popup h2 { + margin-top: 0; + color: #333; + font-family: Tahoma, Arial, sans-serif; + } + .popup .close { + position: absolute; + top: 20px; + right: 30px; + transition: all 200ms; + font-size: 30px; + font-weight: bold; + text-decoration: none; + color: #333; + } + .popup .close:hover { + color: #06D85F; + } + .popup .content { + max-height: 30%; + overflow: auto; + } +} + .documentation-link { ul { padding-left: 0; diff --git a/template/src/main/twirl/ch.epfl.scala.index.views/project/badges.scala.html b/template/src/main/twirl/ch.epfl.scala.index.views/project/badges.scala.html new file mode 100644 index 000000000..4c15884f4 --- /dev/null +++ b/template/src/main/twirl/ch.epfl.scala.index.views/project/badges.scala.html @@ -0,0 +1,30 @@ +@import ch.epfl.scala.index.model.Release +@(release: Release) +
+

Markdown Badge

+
+ + + +
+
+ +
+ +
\ No newline at end of file diff --git a/template/src/main/twirl/ch.epfl.scala.index.views/project/headproject.scala.html b/template/src/main/twirl/ch.epfl.scala.index.views/project/headproject.scala.html index be5b677af..6c33e9b5e 100644 --- a/template/src/main/twirl/ch.epfl.scala.index.views/project/headproject.scala.html +++ b/template/src/main/twirl/ch.epfl.scala.index.views/project/headproject.scala.html @@ -52,6 +52,7 @@

GitHub } + @for(github <- project.github) { @if(!github.topics.isEmpty) { diff --git a/template/src/main/twirl/ch.epfl.scala.index.views/project/install.scala.html b/template/src/main/twirl/ch.epfl.scala.index.views/project/install.scala.html index 2d18fc9b0..fca8a6d9e 100644 --- a/template/src/main/twirl/ch.epfl.scala.index.views/project/install.scala.html +++ b/template/src/main/twirl/ch.epfl.scala.index.views/project/install.scala.html @@ -26,32 +26,32 @@
-
@release.sbtInstall
+
@release.sbtInstall
- Ammonite REPL -
@release.ammInstall
+ Ammonite REPL +
@release.ammInstall
@if(cliArtifacts.contains(release.reference.artifact)) {
- Coursier -
./coursier launch @release.maven.groupId:@release.maven.artifactId:@release.maven.version
+ Coursier +
cs launch @release.maven.groupId:@release.maven.artifactId:@release.maven.version
}
-
@release.mavenInstall
+
@release.mavenInstall
-
@release.gradleInstall
+
@release.gradleInstall
- Mill build tool -
@release.millInstall
+ Mill build tool +
@release.millInstall
diff --git a/template/src/main/twirl/ch.epfl.scala.index.views/project/project.scala.html b/template/src/main/twirl/ch.epfl.scala.index.views/project/project.scala.html index 6f7410cd6..858dcd6c8 100644 --- a/template/src/main/twirl/ch.epfl.scala.index.views/project/project.scala.html +++ b/template/src/main/twirl/ch.epfl.scala.index.views/project/project.scala.html @@ -31,6 +31,7 @@

[DEPRECATED]

} @documentation(release, project) + @badges(release) @install(release, project.cliArtifacts) @release.scastieURL.map(url => scastie(url)) @project.github.map(gh => statistic(gh, project.githubRepo, project.releaseCount, allDeps.reverseDependencies.size))