feat: displaying country previews dynamically

This commit is contained in:
efim
2023-09-23 10:24:08 +00:00
parent 256df8d2aa
commit 153f5ef9ce
3 changed files with 16 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ final case class Country(
population: Int,
region: String,
subregion: String,
flag: String,
capital: String = "",
topLevelDomain: Option[String], // maybe optional?
currencies: List[Currency] = List.empty,

View File

@@ -5,7 +5,7 @@ import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
import org.thymeleaf.TemplateEngine
import org.thymeleaf.context.Context
import org.thymeleaf.templatemode.TemplateMode
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
case class Routes(countries: List[Country])(implicit
cc: castor.Context,
@@ -32,7 +32,7 @@ case class Routes(countries: List[Country])(implicit
val regions = countries.map(_.region).distinct.sorted.asJava
context.setVariable("regionsSet", regions)
println(s"> got $regions")
context.setVariable("countriesList", countries.asJava)
val indexPage = engine.process("index", context)
Response(