diff --git a/main.go b/main.go index c41728b..07433b0 100644 --- a/main.go +++ b/main.go @@ -67,20 +67,19 @@ func main() { c.AbortWithError(http.StatusBadRequest, err) return } - - countries, _ := countryService.Find() years, _ := yearService.Find() if search.Year == nil { - c.HTML(http.StatusOK, "index.gohtml", gin.H{"Years": years, "Countries": countries, "Search": search}) + c.HTML(http.StatusOK, "index.gohtml", gin.H{"Year": time.Now().Year(), "Years": years}) return } + countries, _ := countryService.Find() holidays, _ := holidayService.Find(search, holiday.Paging{PageSize: 100}) c.HTML(http.StatusOK, "results.gohtml", gin.H{"Years": years, "Countries": countries, "Search": search, "Holidays": mapHolidays(holidays).Holidays}) }) g.GET("/documentation", func(c *gin.Context) { countries, _ := countryService.Find() years, _ := yearService.Find() - c.HTML(http.StatusOK, "documentation.gohtml", gin.H{"Years": years, "Countries": countries}) + c.HTML(http.StatusOK, "documentation.gohtml", gin.H{"Year": time.Now().Year(), "Years": years, "Countries": countries}) }) log.Fatal(http.ListenAndServe(":5281", g)) } diff --git a/makefile b/makefile index 2c9b6f0..378621f 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ # scripts for building app # requires go 1.19+ and git installed -VERSION := 0.3.0 +VERSION := 0.3.1 serve: go run ./... diff --git a/templates/documentation.gohtml b/templates/documentation.gohtml index ae40e71..20b0b22 100644 --- a/templates/documentation.gohtml +++ b/templates/documentation.gohtml @@ -58,7 +58,7 @@ diff --git a/templates/index.gohtml b/templates/index.gohtml index 01ec316..5145bc9 100644 --- a/templates/index.gohtml +++ b/templates/index.gohtml @@ -22,7 +22,7 @@