feat: dummy country page and redirects

from search and cards.
card content wrapped in an anchor doesn't look good,
and search only working with htmx (without graceful degradatino) also
doesn't look too good

but with 'hx-boost="true"' ordinary anchor in card also preserves
header, that's nice
This commit is contained in:
efim
2023-09-23 19:17:09 +00:00
parent b776000cf0
commit 433ff827b7
2 changed files with 61 additions and 31 deletions

View File

@@ -13,6 +13,10 @@ case class Routes(countries: List[Country])(implicit
log: cask.Logger
) extends cask.Routes {
/**
* initializing thymeleaf template engine
* which finds and renders html templates by name
*/
def buildTemplateEngine(): TemplateEngine = {
val templateResolver = new ClassLoaderTemplateResolver()
templateResolver.setTemplateMode(TemplateMode.HTML)
@@ -39,6 +43,7 @@ case class Routes(countries: List[Country])(implicit
context.setVariable("regionsSet", regions)
context.setVariable("countriesList", selectedCountries.asJava)
context.setVariable("allCountriesList", countries.asJava)
context.setVariable("selectedRegion", region.getOrElse(""))
val indexPage = engine.process("index", context)
@@ -48,6 +53,11 @@ case class Routes(countries: List[Country])(implicit
)
}
@cask.get("/country")
def getCountryPage(countryName: String) = {
s"counrty $countryName was requested"
}
@cask.post("/do-thing")
def doThing(request: cask.Request) = {
request.text().reverse