diff --git a/.g8/form/app/controllers/$model__Camel$Controller.scala b/.g8/form/app/controllers/$model__Camel$Controller.scala
deleted file mode 100644
index 92a5f1d..0000000
--- a/.g8/form/app/controllers/$model__Camel$Controller.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-package controllers
-
-import javax.inject._
-import play.api.mvc._
-
-import play.api.data._
-import play.api.data.Forms._
-
-case class $model;format="Camel"$Data(name: String, age: Int)
-object $model;format="Camel"$Data {
- def unapply(data: $model;format="Camel"$Data): Option[(String, Int)] = Some((data.name, data.age))
-}
-
-// NOTE: Add the following to conf/routes to enable compilation of this class:
-/*
-GET /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Get()
-POST /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Post()
-*/
-
-/**
- * $model;format="Camel"$ form controller for Play Scala
- */
-class $model;format="Camel"$Controller @Inject()(mcc: MessagesControllerComponents) extends MessagesAbstractController(mcc) {
-
- val $model;format="camel"$Form = Form(
- mapping(
- "name" -> text,
- "age" -> number
- )($model;format="Camel"$Data.apply)($model;format="Camel"$Data.unapply)
- )
-
- def $model;format="camel"$Get() = Action { implicit request: MessagesRequest[AnyContent] =>
- Ok(views.html.$model;format="camel"$.form($model;format="camel"$Form))
- }
-
- def $model;format="camel"$Post() = Action { implicit request: MessagesRequest[AnyContent] =>
- $model;format="camel"$Form.bindFromRequest().fold(
- formWithErrors => {
- // binding failure, you retrieve the form containing errors:
- BadRequest(views.html.$model;format="camel"$.form(formWithErrors))
- },
- $model;format="camel"$Data => {
- /* binding success, you get the actual value. */
- /* flashing uses a short lived cookie */
- Redirect(routes.$model;format="Camel"$Controller.$model;format="camel"$Get()).flashing("success" -> ("Successful " + $model;format="camel"$Data.toString))
- }
- )
- }
-}
diff --git a/.g8/form/app/views/$model__camel$/form.scala.html b/.g8/form/app/views/$model__camel$/form.scala.html
deleted file mode 100644
index 14674ba..0000000
--- a/.g8/form/app/views/$model__camel$/form.scala.html
+++ /dev/null
@@ -1,12 +0,0 @@
-@($model;format="camel"$Form: Form[$model;format="Camel"$Data])(implicit request: MessagesRequestHeader)
-
-
$model;format="camel"$ form
-
-@request.flash.get("success").getOrElse("")
-
-@helper.form(action = routes.$model;format="Camel"$Controller.$model;format="camel"$Post()) {
- @helper.CSRF.formField
- @helper.inputText($model;format="camel"$Form("name"))
- @helper.inputText($model;format="camel"$Form("age"))
-
-}
diff --git a/.g8/form/conf/routes b/.g8/form/conf/routes
deleted file mode 100644
index 8bbbe14..0000000
--- a/.g8/form/conf/routes
+++ /dev/null
@@ -1,12 +0,0 @@
-# Routes
-# This file defines all application routes (Higher priority routes first)
-# https://www.playframework.com/documentation/latest/ScalaRouting
-# ~~~~
-
-# An example controller showing a sample home page
-GET / controllers.HomeController.index()
-GET /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Get()
-POST /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Post()
-
-# Map static resources from the /public folder to the /assets URL path
-GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
diff --git a/.g8/form/default.properties b/.g8/form/default.properties
deleted file mode 100644
index 32090f3..0000000
--- a/.g8/form/default.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-description = Generates a Controller with form handling
-model = user
diff --git a/.g8/form/test/controllers/$model__Camel$ControllerSpec.scala b/.g8/form/test/controllers/$model__Camel$ControllerSpec.scala
deleted file mode 100644
index d251743..0000000
--- a/.g8/form/test/controllers/$model__Camel$ControllerSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-package controllers
-
-import play.api.mvc._
-import play.api.i18n._
-import org.scalatestplus.play._
-import org.scalatestplus.play.guice.GuiceOneAppPerTest
-import play.api.http.FileMimeTypes
-import play.api.test._
-import play.api.test.Helpers._
-import play.api.test.CSRFTokenHelper._
-
-import scala.concurrent.ExecutionContext
-
-/**
- * $model;format="Camel"$ form controller specs
- */
-class $model;format="Camel"$ControllerSpec extends PlaySpec with GuiceOneAppPerTest with Injecting {
-
- // Provide stubs for components based off Helpers.stubControllerComponents()
- class StubComponents(cc:ControllerComponents = stubControllerComponents()) extends MessagesControllerComponents {
- override val parsers: PlayBodyParsers = cc.parsers
- override val messagesApi: MessagesApi = cc.messagesApi
- override val langs: Langs = cc.langs
- override val fileMimeTypes: FileMimeTypes = cc.fileMimeTypes
- override val executionContext: ExecutionContext = cc.executionContext
- override val actionBuilder: ActionBuilder[Request, AnyContent] = cc.actionBuilder
- override val messagesActionBuilder: MessagesActionBuilder = new DefaultMessagesActionBuilderImpl(parsers.default, messagesApi)(executionContext)
- }
-
- "$model;format="Camel"$Controller GET" should {
-
- "render the index page from a new instance of controller" in {
- val controller = new $model;format="Camel"$Controller(new StubComponents())
- val request = FakeRequest().withCSRFToken
- val home = controller.$model;format="camel"$Get().apply(request)
-
- status(home) mustBe OK
- contentType(home) mustBe Some("text/html")
- }
-
- "render the index page from the application" in {
- val controller = inject[$model;format="Camel"$Controller]
- val request = FakeRequest().withCSRFToken
- val home = controller.$model;format="camel"$Get().apply(request)
-
- status(home) mustBe OK
- contentType(home) mustBe Some("text/html")
- }
-
- "render the index page from the router" in {
- val request = CSRFTokenHelper.addCSRFToken(FakeRequest(GET, "/$model;format="camel"$"))
- val home = route(app, request).get
-
- status(home) mustBe OK
- contentType(home) mustBe Some("text/html")
- }
- }
-
- "$model;format="Camel"$Controller POST" should {
- "process form" in {
- val request = {
- FakeRequest(POST, "/$model;format="camel"$")
- .withFormUrlEncodedBody("name" -> "play", "age" -> "4")
- }
- val home = route(app, request).get
-
- status(home) mustBe SEE_OTHER
- }
- }
-
-}
diff --git a/.gitignore b/.gitignore
index c1ae50f..a4261dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,3 +135,5 @@ target
/.settings
/RUNNING_PID
/knockoutwhist/
+/knockoutwhist-web/.g8/
+/knockoutwhist-web/.bsp/
diff --git a/build.sbt b/build.sbt
index 8b31bd1..b1946c4 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,50 +1,46 @@
-name := """KnockOutWhist-Web"""
-organization := "com.example"
+ThisBuild / scalaVersion := "3.5.1"
-version := "1.0-SNAPSHOT"
-
-lazy val root = (project in file(".")).enablePlugins(PlayScala).settings(
- Compile / unmanagedSourceDirectories += baseDirectory.value / "knockoutwhist",
- Test / unmanagedSourceDirectories += baseDirectory.value / "knockoutwhist"
+lazy val commonSettings = Seq(
+ libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.18",
+ libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test",
+ libraryDependencies += "io.github.mkpaz" % "atlantafx-base" % "2.0.1",
+ libraryDependencies += "org.scalafx" %% "scalafx" % "22.0.0-R33",
+ libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.3.0",
+ libraryDependencies += "org.playframework" %% "play-json" % "3.1.0-M1",
+ libraryDependencies ++= {
+ // Determine OS version of JavaFX binaries
+ lazy val osName = System.getProperty("os.name") match {
+ case n if n.startsWith("Linux") => "linux"
+ case n if n.startsWith("Mac") => "mac"
+ case n if n.startsWith("Windows") => "win"
+ case _ => throw new Exception("Unknown platform!")
+ }
+ Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
+ .map(m => "org.openjfx" % s"javafx-$m" % "21" classifier osName)
+ },
+ libraryDependencies += guice,
+ Test / testOptions += Tests.Filter(_.equals("de.knockoutwhist.TestSequence")),
+ coverageEnabled := true,
+ coverageFailOnMinimum := true,
+ coverageMinimumStmtTotal := 85,
+ coverageMinimumBranchTotal := 100
)
+lazy val knockoutwhist = project.in(file("knockoutwhist"))
+ .settings(
+ commonSettings
+ )
-scalaVersion := "3.5.1"
-
-libraryDependencies += guice
-libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
-
-libraryDependencies ++= Seq(
- guice,
- "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test,
-)
-
-libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.18"
-libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test"
-libraryDependencies +="io.github.mkpaz" % "atlantafx-base" % "2.0.1"
-libraryDependencies += "org.scalafx" %% "scalafx" % "22.0.0-R33"
-
-libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.3.0"
-libraryDependencies += "org.playframework" %% "play-json" % "3.1.0-M1"
-
-libraryDependencies ++= {
- // Determine OS version of JavaFX binaries
- lazy val osName = System.getProperty("os.name") match {
- case n if n.startsWith("Linux") => "linux"
- case n if n.startsWith("Mac") => "mac"
- case n if n.startsWith("Windows") => "win"
- case _ => throw new Exception("Unknown platform!")
- }
- Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
- .map(m => "org.openjfx" % s"javafx-$m" % "21" classifier osName)
-}
-
-libraryDependencies += "net.codingwell" %% "scala-guice" % "7.0.0"
-
-Test / testOptions += Tests.Filter(_.equals("de.knockoutwhist.TestSequence"))
-
-coverageEnabled := true
-coverageFailOnMinimum := true
-coverageMinimumStmtTotal := 85
-coverageMinimumBranchTotal := 100
+lazy val knockoutwhistWeb = project.in(file("knockoutwhist-web"))
+ .enablePlugins(PlayScala)
+ .dependsOn(knockoutwhist % "compile->compile;test->test")
+ .settings(
+ commonSettings,
+ libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
+ )
+lazy val root = (project in file("."))
+ .aggregate(knockoutwhist, knockoutwhistWeb)
+ .settings(
+ name := "KnockOutWhistRoot"
+ )
diff --git a/knockoutwhist b/knockoutwhist
new file mode 120000
index 0000000..22713e0
--- /dev/null
+++ b/knockoutwhist
@@ -0,0 +1 @@
+/home/janis/Workspaces/IntelliJ/knockoutwhist
\ No newline at end of file
diff --git a/app/controllers/HomeController.scala b/knockoutwhist-web/app/controllers/HomeController.scala
similarity index 84%
rename from app/controllers/HomeController.scala
rename to knockoutwhist-web/app/controllers/HomeController.scala
index 48e5745..1bed9e2 100644
--- a/app/controllers/HomeController.scala
+++ b/knockoutwhist-web/app/controllers/HomeController.scala
@@ -3,6 +3,7 @@ package controllers
import javax.inject._
import play.api._
import play.api.mvc._
+import de.knockoutwhist.KnockOutWhist
/**
* This controller creates an `Action` to handle HTTP requests to the
@@ -11,8 +12,6 @@ import play.api.mvc._
@Singleton
class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
-
-
/**
* Create an Action to render an HTML page.
*
@@ -21,6 +20,6 @@ class HomeController @Inject()(val controllerComponents: ControllerComponents) e
* a path of `/`.
*/
def index() = Action { implicit request: Request[AnyContent] =>
- Ok(views.html.index())
+ Ok(views.html.main.render("KnockoutWhist", views.html.index.render()))
}
}
diff --git a/app/views/index.scala.html b/knockoutwhist-web/app/views/index.scala.html
similarity index 92%
rename from app/views/index.scala.html
rename to knockoutwhist-web/app/views/index.scala.html
index f84cd2c..68d37fb 100644
--- a/app/views/index.scala.html
+++ b/knockoutwhist-web/app/views/index.scala.html
@@ -1,6 +1,5 @@
@()
@main("Welcome to Play") {
-
Welcome to Play!
}
diff --git a/app/views/main.scala.html b/knockoutwhist-web/app/views/main.scala.html
similarity index 100%
rename from app/views/main.scala.html
rename to knockoutwhist-web/app/views/main.scala.html
diff --git a/conf/application.conf b/knockoutwhist-web/conf/application.conf
similarity index 100%
rename from conf/application.conf
rename to knockoutwhist-web/conf/application.conf
diff --git a/conf/logback.xml b/knockoutwhist-web/conf/logback.xml
similarity index 100%
rename from conf/logback.xml
rename to knockoutwhist-web/conf/logback.xml
diff --git a/conf/messages b/knockoutwhist-web/conf/messages
similarity index 100%
rename from conf/messages
rename to knockoutwhist-web/conf/messages
diff --git a/conf/routes b/knockoutwhist-web/conf/routes
similarity index 100%
rename from conf/routes
rename to knockoutwhist-web/conf/routes
diff --git a/public/images/favicon.png b/knockoutwhist-web/public/images/favicon.png
similarity index 100%
rename from public/images/favicon.png
rename to knockoutwhist-web/public/images/favicon.png
diff --git a/public/javascripts/main.js b/knockoutwhist-web/public/javascripts/main.js
similarity index 100%
rename from public/javascripts/main.js
rename to knockoutwhist-web/public/javascripts/main.js
diff --git a/public/stylesheets/main.css b/knockoutwhist-web/public/stylesheets/main.css
similarity index 100%
rename from public/stylesheets/main.css
rename to knockoutwhist-web/public/stylesheets/main.css
diff --git a/test/controllers/HomeControllerSpec.scala b/knockoutwhist-web/test/controllers/HomeControllerSpec.scala
similarity index 100%
rename from test/controllers/HomeControllerSpec.scala
rename to knockoutwhist-web/test/controllers/HomeControllerSpec.scala