diff --git a/build.sbt b/build.sbt index a777322da..d460f13a8 100644 --- a/build.sbt +++ b/build.sbt @@ -180,9 +180,7 @@ lazy val server = project "org.webjars.bower" % "select2" % "4.0.13" ), Compile / unmanagedResourceDirectories += (Assets / WebKeys.public).value, - Compile / resourceGenerators += Def.task( - Seq((Assets / WebKeys.assets).value) - ), + Compile / resourceGenerators += (Assets / WebKeys.assets).map(Seq(_)), fork := true, Compile / run / javaOptions ++= (infra / Compile / run / javaOptions).value, reStart / javaOptions ++= (infra / Compile / run / javaOptions).value, diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/ProjectHeader.scala b/modules/core/shared/src/main/scala/scaladex/core/model/ProjectHeader.scala index bfeebdeb0..345c9f3dc 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/ProjectHeader.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/ProjectHeader.scala @@ -32,14 +32,14 @@ final case class ProjectHeader( def platforms(artifactName: Artifact.Name): Seq[Platform] = artifacts.filter(_.artifactName == artifactName).map(_.platform).distinct.sorted(Platform.ordering.reverse) - def artifactsUrl: String = artifactsUrl(getDefaultArtifact(None, None), withBinaryVersion = false) + def versionsUrl: String = artifactsUrl(getDefaultArtifact(None, None), withBinaryVersion = false) - def artifactsUrl(language: Language): String = artifactsUrl(getDefaultArtifact(Some(language), None)) + def versionsUrl(language: Language): String = artifactsUrl(getDefaultArtifact(Some(language), None)) - def artifactsUrl(platform: Platform): String = artifactsUrl(getDefaultArtifact(None, Some(platform))) + def versionsUrl(platform: Platform): String = artifactsUrl(getDefaultArtifact(None, Some(platform))) private def artifactsUrl(defaultArtifact: Artifact, withBinaryVersion: Boolean = true): String = { - val preReleaseFilter = Option.when(!preferStableVersion || !defaultArtifact.version.isStable)("pre-releases=true") + val preReleaseFilter = Option.when(preferStableVersion && defaultArtifact.version.isStable)("stable-only=true") val binaryVersionFilter = Option.when(withBinaryVersion)(s"binary-versions=${defaultArtifact.binaryVersion.label}") val filters = preReleaseFilter.toSeq ++ binaryVersionFilter val queryParams = if (filters.nonEmpty) "?" + filters.mkString("&") else "" diff --git a/modules/core/shared/src/main/scala/scaladex/core/service/WebDatabase.scala b/modules/core/shared/src/main/scala/scaladex/core/service/WebDatabase.scala index 55aa3d35b..f3152942a 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/service/WebDatabase.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/service/WebDatabase.scala @@ -11,7 +11,7 @@ trait WebDatabase { def insertArtifact(artifact: Artifact): Future[Boolean] def getArtifacts(groupId: Artifact.GroupId, artifactId: String): Future[Seq[Artifact]] def getArtifacts(projectRef: Project.Reference): Future[Seq[Artifact]] - def getArtifacts(ref: Project.Reference, artifactName: Artifact.Name, preReleases: Boolean): Future[Seq[Artifact]] + def getArtifacts(ref: Project.Reference, artifactName: Artifact.Name, stableOnly: Boolean): Future[Seq[Artifact]] def getArtifacts(ref: Project.Reference, artifactName: Artifact.Name, version: SemanticVersion): Future[Seq[Artifact]] def getArtifactsByName(projectRef: Project.Reference, artifactName: Artifact.Name): Future[Seq[Artifact]] def getLatestArtifacts(ref: Project.Reference): Future[Seq[Artifact]] diff --git a/modules/core/shared/src/main/scala/scaladex/core/web/ArtifactsPageParams.scala b/modules/core/shared/src/main/scala/scaladex/core/web/ArtifactsPageParams.scala index f9b6cddd6..623d68647 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/web/ArtifactsPageParams.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/web/ArtifactsPageParams.scala @@ -4,10 +4,10 @@ import scaladex.core.model.BinaryVersion case class ArtifactsPageParams( binaryVersions: Seq[BinaryVersion], - preReleases: Boolean + stableOnly: Boolean ) { - def remove(b: BinaryVersion): ArtifactsPageParams = copy(binaryVersions = binaryVersions.filterNot(_ == b)) - def withPreReleases(preReleases: Boolean): ArtifactsPageParams = copy(preReleases = preReleases) + def binaryVersionsSummary: Option[String] = + Option.when(binaryVersions.nonEmpty)(binaryVersions.mkString(", ")) } object ArtifactsPageParams { diff --git a/modules/core/shared/src/test/scala/scaladex/core/model/SemanticVersionTests.scala b/modules/core/shared/src/test/scala/scaladex/core/model/SemanticVersionTests.scala index 8fe0b5680..b1f0bae42 100644 --- a/modules/core/shared/src/test/scala/scaladex/core/model/SemanticVersionTests.scala +++ b/modules/core/shared/src/test/scala/scaladex/core/model/SemanticVersionTests.scala @@ -41,7 +41,7 @@ class SemanticVersionTests extends AsyncFunSpec with Matchers with TableDrivenPr forAll(inputs)((lower, higher) => lower shouldBe <(higher)) } - it("should allow us to prefer releases over pre-releases") { + it("should allow us to prefer stable over pre-releases") { val versions = Seq(`7.0.0`, `7.1.0`, `7.2.0-PREVIEW.1`) versions.max shouldBe `7.2.0-PREVIEW.1` versions.max(PreferStable) shouldBe `7.1.0` diff --git a/modules/core/shared/src/test/scala/scaladex/core/test/InMemoryDatabase.scala b/modules/core/shared/src/test/scala/scaladex/core/test/InMemoryDatabase.scala index d528bcece..6e5cb63b5 100644 --- a/modules/core/shared/src/test/scala/scaladex/core/test/InMemoryDatabase.scala +++ b/modules/core/shared/src/test/scala/scaladex/core/test/InMemoryDatabase.scala @@ -160,9 +160,9 @@ class InMemoryDatabase extends SchedulerDatabase { override def getArtifacts( ref: Project.Reference, artifactName: Artifact.Name, - preReleases: Boolean + stableOnly: Boolean ): Future[Seq[Artifact]] = - // TODO: use preReleases to filter + // TODO: use stableOnly to filter Future.successful(allArtifacts.getOrElse(ref, Seq.empty).filter(_.artifactName == artifactName)) override def getProjectDependencies( ref: Project.Reference, diff --git a/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala b/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala index 111554e43..56a54d55e 100644 --- a/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala +++ b/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala @@ -206,9 +206,9 @@ class SqlDatabase(datasource: HikariDataSource, xa: doobie.Transactor[IO]) exten override def getArtifacts( ref: Project.Reference, artifactName: Artifact.Name, - preReleases: Boolean + stableOnly: Boolean ): Future[Seq[Artifact]] = - run(ArtifactTable.selectArtifactByParams(preReleases).to[Seq](ref, artifactName)) + run(ArtifactTable.selectArtifactByParams(stableOnly).to[Seq](ref, artifactName)) override def updateLatestVersion(ref: Artifact.MavenReference): Future[Unit] = { val transaction = for { diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala b/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala index caeb4a3c4..2cac7f3f3 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala @@ -85,8 +85,8 @@ object ArtifactTable { where = Seq("organization=?", "repository=?", "artifact_name=?", "version=?") ) - def selectArtifactByParams(preReleases: Boolean): Query[(Project.Reference, Artifact.Name), Artifact] = { - val preReleaseFilter = if (preReleases) "true" else "is_prerelease=false" + def selectArtifactByParams(stableOnly: Boolean): Query[(Project.Reference, Artifact.Name), Artifact] = { + val preReleaseFilter = if (stableOnly) "is_prerelease=false" else "true" Query[(Project.Reference, Artifact.Name), Artifact]( s"""|SELECT ${fields.mkString(", ")} |FROM $table diff --git a/modules/server/src/main/assets/css/main-8.scss b/modules/server/src/main/assets/css/main-8.scss index b6caa73d4..f81f61490 100644 --- a/modules/server/src/main/assets/css/main-8.scss +++ b/modules/server/src/main/assets/css/main-8.scss @@ -12,7 +12,8 @@ // 3. Vendors Extensions @import 'vendors-extensions/bootstrap', - 'vendors-extensions/bootstrap-select'; + 'vendors-extensions/bootstrap-select', + 'vendors-extensions/bootstrap-switch'; // 4. Base @import diff --git a/modules/server/src/main/assets/css/partials/_project.scss b/modules/server/src/main/assets/css/partials/_project.scss index 0e66d2d5e..313159d5a 100644 --- a/modules/server/src/main/assets/css/partials/_project.scss +++ b/modules/server/src/main/assets/css/partials/_project.scss @@ -273,12 +273,8 @@ } } } - - .artifacts { - .artifacts-filter { - margin-top: -10px; - margin-bottom: 50px; - } + + .artifacts, .versions { .center { @media (min-width: $screen-md-min) { display: flex; @@ -286,15 +282,15 @@ align-items: center; } } - .artifact-version { - font-size: 30px; - color: $brand-secondary; - &:active, - &:focus, - &:hover { - text-decoration: none; - color: $brand-primary; - } + .result-count { + margin-top: 24px; + font-size: 16px; + } + .panel { + margin-bottom: 12px + } + .panel-content { + padding: 0 0 6px 0; } .artifact-info { @media (min-width: 600px) { @@ -320,8 +316,13 @@ display: inline; } } - .filter-option-inner-inner { - color: white; + .btn-secondary { + .filter-option-inner-inner { + color: $headings-color; + } + .caret { + color: $headings-color; + } } .dropdown { margin-right: 15px; @@ -337,16 +338,66 @@ margin-right: 20px; } } - .result-count { - float: right; - font-size: 16px; + } + + .artifacts { + .artifact-name, .artifact-version { + color: $brand-secondary; + &:active, &:focus, &:hover { + text-decoration: none; + color: $brand-primary; + } + } + + .artifact-name { + font-size: 24px; + } + + .artifact-version { + color: $headings-color; + font-size: 20px; + margin-left: 12px; + } + } + + .versions { + h2 { + margin-top: 0; + margin-bottom: 24px; + color: $brand-secondary; + .bootstrap-select { + margin-left: 7px; + width: 150px; + } + .btn { + padding: 10px 10px 6px 10px; + } + .btn-default { + color: $gray-light; + } + .filter-option { + padding-right: 4px; + } + .caret { + top: 55%; + } + } + + .artifact-version { + font-size: 30px; + color: $brand-secondary; + &:active, + &:focus, + &:hover { + text-decoration: none; + color: $brand-primary; + } } } + .artifact { - h3 { + h2 { margin-top: 0; - font-size: 2em; - display: inline; color: $brand-secondary; a { color: inherit; diff --git a/modules/server/src/main/assets/css/vendors-extensions/_bootstrap-switch.scss b/modules/server/src/main/assets/css/vendors-extensions/_bootstrap-switch.scss new file mode 100644 index 000000000..80a5f08b7 --- /dev/null +++ b/modules/server/src/main/assets/css/vendors-extensions/_bootstrap-switch.scss @@ -0,0 +1,7 @@ +.bootstrap-switch { + .bootstrap-switch-label { + padding: 7px; + font-size: 16px; + line-height:1.52857; + } +} diff --git a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala index aca22b3f9..77654fedb 100644 --- a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala +++ b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala @@ -39,11 +39,47 @@ class ProjectPages(env: Env, database: SchedulerDatabase, searchEngine: SearchEn routes = get { path(projectM)(getProjectPage(_, user)) }, + get { + path(projectM / "artifacts") { ref => + artifactsParams { params => + getProjectOrRedirect(ref, user) { project => + for (header <- projectService.getProjectHeader(project)) yield { + val allArtifacts = header.toSeq.flatMap(_.artifacts) + + val binaryVersions = allArtifacts + .map(_.binaryVersion) + .distinct + .sorted(BinaryVersion.ordering.reverse) + + val groupedArtifacts = allArtifacts + .groupBy(_.artifactName) + .map { + case (name, artifacts) => + val latestVersion = artifacts.maxBy(_.version).version + val filteredArtifacts = artifacts.filter(_.version == latestVersion) + (name, latestVersion, filteredArtifacts) + } + .filter { + case (_, _, artifacts) => + params.binaryVersions + .forall(binaryVersion => artifacts.exists(_.binaryVersion == binaryVersion)) + } + .toSeq + .sortBy { case (name, version, _) => (version, name) }( + Ordering.Tuple2(SemanticVersion.ordering.reverse, Artifact.Name.ordering) + ) + val page = html.artifacts(env, user, project, header, groupedArtifacts, params, binaryVersions) + complete(page) + } + } + } + } + }, get { path(projectM / "artifacts" / artifactNameM) { (ref, artifactName) => artifactsParams { params => getProjectOrRedirect(ref, user) { project => - val artifactsF = database.getArtifacts(ref, artifactName, params.preReleases) + val artifactsF = database.getArtifacts(ref, artifactName, params.stableOnly) val headerF = projectService.getProjectHeader(project).map(_.get) for (artifacts <- artifactsF; header <- headerF) yield { val binaryVersions = artifacts @@ -113,57 +149,6 @@ class ProjectPages(env: Env, database: SchedulerDatabase, searchEngine: SearchEn } } }, - get { - path(projectM / "artifacts") { ref => - artifactsParams { params => - getProjectOrRedirect(ref, user) { project => - val headerF = projectService.getProjectHeader(project) - for { - header <- headerF - } yield { - val allArtifacts = header.toSeq.flatMap(_.artifacts) - - val binaryVersions = allArtifacts - .map(_.binaryVersion) - .distinct - .sorted(BinaryVersion.ordering.reverse) - - // Group by artifact name - val artifactsByName = allArtifacts.groupBy(_.artifactName) - - val groupedArtifacts = artifactsByName - .groupBy { - case (_, artifacts) => - artifacts.maxBy(_.version).version - } - .map { - case (latestVersion, artifactsByName) => - latestVersion -> artifactsByName - .map { - case (name, artifacts) => - name -> artifacts - .filter(_.version == latestVersion) - } - .filter { - case (_, artifacts) => - params.binaryVersions.forall(binaryVersion => - artifacts - .exists(_.binaryVersion == binaryVersion) - ) - } - } - .filter { - case (_, artifactsByName) => - artifactsByName.nonEmpty - } - - val page = html.artifacts(env, user, project, header, groupedArtifacts, params, binaryVersions) - complete(page) - } - } - } - } - }, get { path(projectM / "version-matrix") { ref => getProjectOrRedirect(ref, user) { project => @@ -264,7 +249,7 @@ class ProjectPages(env: Env, database: SchedulerDatabase, searchEngine: SearchEn private val artifactsParams: Directive1[ArtifactsPageParams] = parameters( "binary-versions".repeated, - "pre-releases".as[Boolean].withDefault(false) + "stable-only".as[Boolean].withDefault(false) ).tmap { case (rawbinaryVersions, preReleases) => val binaryVersions = rawbinaryVersions diff --git a/modules/server/src/test/scala/scaladex/server/route/BadgesTests.scala b/modules/server/src/test/scala/scaladex/server/route/BadgesTests.scala index d02f3519b..5c95e1741 100644 --- a/modules/server/src/test/scala/scaladex/server/route/BadgesTests.scala +++ b/modules/server/src/test/scala/scaladex/server/route/BadgesTests.scala @@ -80,7 +80,7 @@ class BadgesUnitTests extends AnyFunSpec with Matchers { ) shouldBe "7.3.0 (Scala 3.x, 2.13), 7.2.0 (Scala 2.12), 7.1.0 (Scala 2.11)" } - it("should prefer releases to pre-releases if both are available") { + it("should prefer stable to pre-releases if both are available") { summaryOfLatestVersions(Map(`2.13` -> Seq(`7.0.0`, `7.1.0`, `7.2.0-PREVIEW.1`))) shouldBe "7.1.0 (Scala 2.13)" } diff --git a/modules/template/src/main/scala/scaladex/view/ProjectTab.scala b/modules/template/src/main/scala/scaladex/view/ProjectTab.scala new file mode 100644 index 000000000..81072ddeb --- /dev/null +++ b/modules/template/src/main/scala/scaladex/view/ProjectTab.scala @@ -0,0 +1,11 @@ +package scaladex.view + +sealed trait ProjectTab +object ProjectTab { + object Main extends ProjectTab + object Artifacts extends ProjectTab + object Versions extends ProjectTab + object Badges extends ProjectTab + object Settings extends ProjectTab + object VersionMatrix extends ProjectTab +} diff --git a/modules/template/src/main/scala/scaladex/view/html/package.scala b/modules/template/src/main/scala/scaladex/view/html/package.scala index a43251566..ca38945fb 100644 --- a/modules/template/src/main/scala/scaladex/view/html/package.scala +++ b/modules/template/src/main/scala/scaladex/view/html/package.scala @@ -82,19 +82,19 @@ package object html { .appendQuery("languages", params.languages.map(_.label)) .appendQuery("platforms", params.platforms.map(_.label)) - def artifactsUri(ref: Project.Reference, artifactName: Artifact.Name, params: ArtifactsPageParams): Uri = + def versionsUri(ref: Project.Reference, artifactName: Artifact.Name, params: ArtifactsPageParams): Uri = Uri(s"/$ref/artifacts/$artifactName") .appendQuery("binary-versions", params.binaryVersions.map(_.label)) - .appendQuery(("pre-releases", params.preReleases.toString)) + .appendQuery(("stable-only", params.stableOnly.toString)) - def artifactsUri(ref: Project.Reference, artifactName: Artifact.Name, binaryVersion: Option[BinaryVersion]): Uri = + def versionsUri(ref: Project.Reference, artifactName: Artifact.Name, binaryVersion: Option[BinaryVersion]): Uri = Uri(s"/$ref/artifacts/$artifactName") .appendQuery("binary-versions", binaryVersion.map(_.label)) def artifactsUri(ref: Project.Reference, params: ArtifactsPageParams): Uri = Uri(s"/$ref/artifacts") .appendQuery("binary-versions", params.binaryVersions.map(_.label)) - .appendQuery(("pre-releases", params.preReleases.toString)) + .appendQuery(("stable-only", params.stableOnly.toString)) def artifactsUri(ref: Project.Reference, binaryVersion: Option[BinaryVersion]): Uri = Uri(s"/$ref/artifacts") diff --git a/modules/template/src/main/twirl/scaladex/view/main.scala.html b/modules/template/src/main/twirl/scaladex/view/main.scala.html index a648594ab..3036675ec 100644 --- a/modules/template/src/main/twirl/scaladex/view/main.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/main.scala.html @@ -176,6 +176,15 @@ $(".js-keywords-multiple").select2({tags: true}); $(".js-stackoverflowtags-multiple").select2({tags: true}); $('.edit-project input[type="checkbox"]').bootstrapSwitch(); + $('#stable-only').bootstrapSwitch({ + handleWidth: 30, + labelWidth: 78, + labelText: 'Stable Only', + onSwitchChange: function(event, state){ + console.log(event) + event.target.form.submit() + } + }); }); // Run client scalajs code (for instance, autocomplete) diff --git a/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html b/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html index 3ec0bc502..680c07522 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html @@ -4,6 +4,7 @@ @import scaladex.view.Formats @import scaladex.view.html._ @import scaladex.view.InstallTab +@import scaladex.view.ProjectTab @( env: Env, @@ -18,7 +19,7 @@ ) @main(env, title = project.repository.toString, user) {
- @headproject(env, user, project, header, "Artifacts") + @headproject(env, user, project, header, ProjectTab.Versions)
@@ -41,13 +42,13 @@
-

- @artifact.artifactName +

+ @artifact.artifactName @artifact.version @if(project.settings.deprecatedArtifacts.contains(artifact.artifactName)) { Deprecated } -

+
@info("Group ID") { @artifact.groupId } @info("Artifact ID") { @artifact.artifactId } diff --git a/modules/template/src/main/twirl/scaladex/view/project/artifacts.scala.html b/modules/template/src/main/twirl/scaladex/view/project/artifacts.scala.html index c2dcd7d29..90b659e82 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/artifacts.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/artifacts.scala.html @@ -8,6 +8,7 @@ @import scaladex.core.util.ScalaExtensions._ @import scaladex.core.util.TimeUtils @import scaladex.view.Formats +@import scaladex.view.ProjectTab @import java.time.Instant @@ -16,68 +17,63 @@ user: Option[UserState], project: Project, header: Option[ProjectHeader], - groupedArtifacts: Map[SemanticVersion, Map[Artifact.Name, Seq[Artifact]]], + artifacts: Seq[(Artifact.Name, SemanticVersion, Seq[Artifact])], params: ArtifactsPageParams, allBinaryVersions: Seq[BinaryVersion] ) @main(env, title = project.repository.toString, user) {
- @headproject(env, user, project, header, "Artifacts") + @headproject(env, user, project, header, ProjectTab.Artifacts)
-
- @artifactsfilters(params,allBinaryVersions) - @filters() -
- @groupedArtifacts.values.flatten.size @Formats.wordPlural(groupedArtifacts.values.flatten.size, "artifact") found -
+ @artifactsFilters(project.reference, params, allBinaryVersions, withStableOnly = false) +
+ Found @artifacts.size @Formats.wordPlural(artifacts.size, "artifact")
- @if(groupedArtifacts.isEmpty) { -
We can't find any artifacts for this project.
+ @if(artifacts.isEmpty) { +
We can't find any artifact for this project.
} else {
- @for((version, artifactsByName) <- groupedArtifacts.toSeq.sortBy(_._1).reverse) { -

Version @version

- @for((artifactName, artifacts) <- artifactsByName.toSeq.sortBy(_._1)) { -
-
- -
-
- - @TimeUtils.toFiniteDuration(artifacts.head.releaseDate, Instant.now()).prettyPrint - ago + @for((name, version, artifacts) <- artifacts) { +
+
+ +
+ +
+ @for( + (platform, binaryVersions) <- artifacts + .groupBy(_.platform) + .toSeq + .sortBy(_._1) + .reverse + ) { +
@platform:
+ @for(binaryVersion <- binaryVersions.map(_.binaryVersion).distinct.sorted.reverse) { + + @binaryVersion.language.label -
- @artifacts.head.licenses.map { license => - @license.shortName - } -
-
- @for( - (platform, binaryVersions) <- artifacts - .groupBy(_.platform) - .toSeq - .sortBy(_._1) - .reverse - ) { -
@platform:
- @for(binaryVersion <- binaryVersions.map(_.binaryVersion).distinct.sorted.reverse) { - - @binaryVersion.language.label - - } -
- } -
-
+ } +
+ }
- } +
+
}
} @@ -85,33 +81,3 @@
@platform:
} -@filters() = { -
- -
-} diff --git a/modules/template/src/main/twirl/scaladex/view/project/artifactsFilters.scala.html b/modules/template/src/main/twirl/scaladex/view/project/artifactsFilters.scala.html new file mode 100644 index 000000000..3cc05f513 --- /dev/null +++ b/modules/template/src/main/twirl/scaladex/view/project/artifactsFilters.scala.html @@ -0,0 +1,32 @@ +@import scaladex.core.model._ +@import scaladex.core.web.ArtifactsPageParams +@import scaladex.view.html._ + +@import java.time.Instant + +@( + ref: Project.Reference, + params: ArtifactsPageParams, + allBinaryVersions: Seq[BinaryVersion], + withStableOnly: Boolean = true +) + +
+ + @if(withStableOnly) { + + } +
diff --git a/modules/template/src/main/twirl/scaladex/view/project/artifactsfilters.scala.html b/modules/template/src/main/twirl/scaladex/view/project/artifactsfilters.scala.html deleted file mode 100644 index c2cf0f06f..000000000 --- a/modules/template/src/main/twirl/scaladex/view/project/artifactsfilters.scala.html +++ /dev/null @@ -1,32 +0,0 @@ -@import scaladex.core.model._ -@import scaladex.view.html.main -@import scaladex.view.html._ -@import scaladex.core.web.ArtifactsPageParams -@import scaladex.core.model.Language -@import scaladex.core.model.Platform -@import scala.collection.SortedMap -@import scaladex.core.util.ScalaExtensions._ -@import scaladex.core.util.TimeUtils -@import scaladex.view.Formats - -@(params: ArtifactsPageParams, allBinaryVersions: Seq[BinaryVersion]) - -
- - -
\ No newline at end of file diff --git a/modules/template/src/main/twirl/scaladex/view/project/badges.scala.html b/modules/template/src/main/twirl/scaladex/view/project/badges.scala.html index 47dc0daae..219e3e4f0 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/badges.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/badges.scala.html @@ -5,6 +5,7 @@ @import scaladex.core.model.UserState @import scaladex.core.model.SemanticVersion @import scaladex.view.html.main +@import scaladex.view.ProjectTab @import scaladex.core.model.Platform @import scala.collection.SortedSet @@ -17,7 +18,7 @@ ) @main(env, title = project.repository.value, user, extraMeta = project.twitterCard.toHeadMeta, extraMetaProperty = project.ogp.toHeadMetaProperty) {
- @headproject(env, user, project, Some(header), "Badges") + @headproject(env, user, project, Some(header), ProjectTab.Badges)
diff --git a/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html b/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html index bcdb04540..edd397ecf 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html @@ -7,6 +7,7 @@ @import scaladex.core.model.Url @import scaladex.core.model.Env @import scaladex.core.model.SemanticVersion +@import scaladex.view.ProjectTab @(env: Env, user: UserState, project: Project, header: Option[ProjectHeader], artifacts: Seq[Artifact]) @@ -14,7 +15,7 @@ @artifactNames = @{ artifacts.map(_.artifactName).distinct } @main(env, title = s"Edit ${project.repository}", Some(user)) {
- @headproject(env, Some(user), project, header, "Settings") + @headproject(env, Some(user), project, header, ProjectTab.Settings)
diff --git a/modules/template/src/main/twirl/scaladex/view/project/headproject.scala.html b/modules/template/src/main/twirl/scaladex/view/project/headproject.scala.html index b1c14f604..d1f905ba9 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/headproject.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/headproject.scala.html @@ -3,13 +3,14 @@ @import scaladex.core.model.UserState @import scaladex.core.model.Env @import scaladex.view.Formats._ +@import scaladex.view.ProjectTab @import scaladex.view.html.ensureUri -@(env: Env, user: Option[UserState], project: Project, header: Option[ProjectHeader], activeTab: String) +@(env: Env, user: Option[UserState], project: Project, header: Option[ProjectHeader], activeTab: ProjectTab) @canEdit = @{user.exists(_.canEdit(project.reference, env))} -@isActive(nameTab: String) = @{if(nameTab == activeTab) "active" else ""} +@isActive(tab: ProjectTab) = @{if(tab == activeTab) "active" else ""}
@@ -19,7 +20,7 @@

@project.repository @for(header <- header) {   @header.latestVersion.encode - } + }

@if(project.settings.contributorsWanted) { @@ -62,7 +63,7 @@

Scala versions: @for(scalaVersion <- header.latestScalaVersions.sorted.reverse) { - @scalaVersion.version + @scalaVersion.version }
} @@ -71,7 +72,7 @@

Scala.js versions: @for(platform <- header.latestScalaJsVersions.sorted.reverse) { - @platform.version + @platform.version }
} @@ -80,7 +81,7 @@

Scala Native versions: @for(platform <- header.latestScalaNativeVersions.sorted.reverse) { - @platform.version + @platform.version }
} @@ -89,7 +90,7 @@

sbt plugins: @for(platform <- header.latestSbtVersions.sorted.reverse) { - @platform.version + @platform.version }
} @@ -98,7 +99,7 @@

{Artifact, BinaryVersion, Project, SemanticVersion, UserState, Env} Mill plugins: @for(platform <- header.latestMillVersions.sorted.reverse) { - @platform.version + @platform.version }
} @@ -109,15 +110,15 @@