diff --git a/13-testimonials-grid-section/src/main/resources/templates/index.html b/13-testimonials-grid-section/src/main/resources/templates/index.html index 3723d06..b0dc17c 100644 --- a/13-testimonials-grid-section/src/main/resources/templates/index.html +++ b/13-testimonials-grid-section/src/main/resources/templates/index.html @@ -34,6 +34,7 @@
+
diff --git a/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala b/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala index 37ed0fd..c6f6635 100644 --- a/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala +++ b/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala @@ -54,6 +54,22 @@ object Main { headers = Seq("Content-Type" -> "text/html;charset=UTF-8") ) } + @cask.get("/testimonial/:id") + def getTestimonial(id: Int) = { + val context = new Context() + val test = Testimonial.sameAsRequested.head + context.setVariable( + "selectedTestimonials", + List(test).asJava + ) + val result = templateEngine.process("testimonialSection", context) + println(s"will try with $test ; to get \n$result") + cask.Response( + result, + headers = Seq("Content-Type" -> "text/html;charset=UTF-8") + ) + } + @cask.staticFiles("/dist") def distFiles() = "dist" @cask.staticFiles("/public")