diff --git a/14-rock-paper-scissors/src/main/resources/templates/index.html b/14-rock-paper-scissors/src/main/resources/templates/index.html index f00069c..aefb2fc 100644 --- a/14-rock-paper-scissors/src/main/resources/templates/index.html +++ b/14-rock-paper-scissors/src/main/resources/templates/index.html @@ -74,8 +74,8 @@
+ +
"text/html;charset=UTF-8") - ) + val badge = Models.choiceSelectionItems.find(_.c.name == choice) + val response = badge match { + case Some(playersChoiceBadge) => + val badge = playersChoiceBadge.copy() + badge.p = Positioning.Relative + context.setVariable("playersChoiceData", badge) + val result = templateEngine.process("showdown", Set("showdown-table").asJava, context) + cask.Response( + result, + headers = Seq("Content-Type" -> "text/html;charset=UTF-8") + ) + case None => + cask.Response(s"Unknown choice: '${choice}'", 400) + } + response } @cask.staticResources("/public")