diff --git a/16-countries-page-from-api/src/main/resources/templates/index.html b/16-countries-page-from-api/src/main/resources/templates/index.html index cf46810..66b19ed 100644 --- a/16-countries-page-from-api/src/main/resources/templates/index.html +++ b/16-countries-page-from-api/src/main/resources/templates/index.html @@ -50,30 +50,38 @@ -
+
flag of Germany
-

Germany

+

Germany

Population:
-
81,771,900
+
81,771,900
Region:
-
Europe
+
Europe
Capital:
-
Berlin
+
Berlin
diff --git a/16-countries-page-from-api/src/main/scala/example/Country.scala b/16-countries-page-from-api/src/main/scala/example/Country.scala index 91267ea..4d59c28 100644 --- a/16-countries-page-from-api/src/main/scala/example/Country.scala +++ b/16-countries-page-from-api/src/main/scala/example/Country.scala @@ -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, diff --git a/16-countries-page-from-api/src/main/scala/example/Routes.scala b/16-countries-page-from-api/src/main/scala/example/Routes.scala index 61b533f..7cc1880 100644 --- a/16-countries-page-from-api/src/main/scala/example/Routes.scala +++ b/16-countries-page-from-api/src/main/scala/example/Routes.scala @@ -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(