From 76ef62bb96fb8ebc75b7fcc5cb21ef76fe2c7320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borna=20Rajkovi=C4=87?= Date: Sun, 7 Jan 2024 22:01:58 +0100 Subject: [PATCH] v0.3.1 updated default year used on frontend --- main.go | 7 +++---- makefile | 2 +- templates/documentation.gohtml | 2 +- templates/index.gohtml | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) 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 @@