From 1656f4d6f0fc79c5ab00edbd2d1c0d8509644c3c Mon Sep 17 00:00:00 2001 From: Roberto Tyley Date: Tue, 1 Jun 2021 23:19:57 +0100 Subject: [PATCH] Display badge for targetType appropriate to release So if we're looking at: https://index.scala-lang.org/typelevel/cats/cats-core/2.6.1?target=_sjs1.x_3.x ...we want to see the badge with `targetType=js`, rather than the default badge that displays JVM-based artifacts. --- model/src/main/scala/ch.epfl.scala.index.model/Release.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 2bdb1f7e1..5ee0c72cc 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 @@ -230,7 +230,8 @@ object Release { def artifactHttpPath = s"/$organization/$repository/$artifact" def artifactFullHttpUrl = s"https://index.scala-lang.org$artifactHttpPath" - def badgeUrl: String = s"$artifactFullHttpUrl/latest-by-scala-version.svg" + def nonDefaultTargetType: Option[ScalaTargetType] = target.map(_.targetType).filter(_ != Jvm) + def badgeUrl: String = s"$artifactFullHttpUrl/latest-by-scala-version.svg" + nonDefaultTargetType.map(tt => s"?targetType=$tt").mkString def httpUrl = { val targetQuery = target.map(t => s"?target=${t.encode}").getOrElse("")