parent
6bd0c9e37c
commit
76ef62bb96
7
main.go
7
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))
|
||||
}
|
||||
|
|
2
makefile
2
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 ./...
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<label for="dsy-year">Godina</label>
|
||||
<select id="dsy-year" name="year">
|
||||
{{range $entry := .Years}}
|
||||
<option value="{{$entry}}">{{$entry}}</option>
|
||||
<option {{if eq $.Year $entry}}selected{{end}} value="{{$entry}}">{{$entry}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</section>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<label for="year">Za godinu:</label>
|
||||
<select id="year" name="year">
|
||||
{{range $entry := .Years}}
|
||||
<option {{if intpeq $.Search.Year $entry}}selected{{end}} value="{{$entry}}">{{$entry}}</option>
|
||||
<option {{if eq $.Year $entry}}selected{{end}} value="{{$entry}}">{{$entry}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue