feat(14): initial static section change

paper control switches "controls" to "showdown" - the fragment of
results page. yay
This commit is contained in:
efim 2023-07-01 13:05:55 +00:00
parent 726cadec19
commit 91c53429e0
4 changed files with 22 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- displays site properly based on user's device --> <!-- displays site properly based on user's device -->
<script src="public/deps/htmx.min.js"></script>
<link <link
href="../public/output.css" href="../public/output.css"
th:href="'public/output.css'" th:href="'public/output.css'"
@ -72,6 +73,9 @@
--translation: 50%; --translation: 50%;
position: absolute; position: absolute;
" "
hx-get="/select/paper"
hx-target="#controls"
hx-swap="outerHTML"
> >
<div <div
class="absolute top-1/2 left-1/2 w-3/4 h-3/4 bg-gradient-to-b from-gray-300 to-gray-100 rounded-full -translate-x-1/2 -translate-y-1/2" class="absolute top-1/2 left-1/2 w-3/4 h-3/4 bg-gradient-to-b from-gray-300 to-gray-100 rounded-full -translate-x-1/2 -translate-y-1/2"

View File

@ -56,7 +56,9 @@
</h2> </h2>
</section> </section>
<section id="showdown" class="grid grid-cols-2 w-[375px] h-[375px]"> <section id="showdown-table" class="grid grid-cols-2 w-[375px] h-[375px]"
th:fragment="showdown-table"
>
<div id="players-choice" <div id="players-choice"
class="flex relative flex-col items-center pt-10" class="flex relative flex-col items-center pt-10"
> >

View File

@ -5,6 +5,9 @@ import cask.main.Routes
import org.thymeleaf.context.Context import org.thymeleaf.context.Context
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
import org.thymeleaf.TemplateEngine import org.thymeleaf.TemplateEngine
import org.thymeleaf.Thymeleaf
import scala.jdk.CollectionConverters._
object Main { object Main {
@main def run( @main def run(
@ -56,11 +59,22 @@ object Main {
) )
} }
@cask.get("/select/:choice")
def acceptPlayerVote(choice: String) = {
val context = new Context()
val result = templateEngine.process("showdown", Set("showdown-table").asJava, context)
cask.Response(
result,
headers = Seq("Content-Type" -> "text/html;charset=UTF-8")
)
}
@cask.staticResources("/public") @cask.staticResources("/public")
def publicFiles(req: cask.Request) = { def publicFiles(req: cask.Request) = {
println(s"getting request for ${req.remainingPathSegments}") println(s"getting request for ${req.remainingPathSegments}")
"public" "public"
} }
initialize() initialize()
} }