diff options
Diffstat (limited to 'backend/admin')
| -rw-r--r-- | backend/admin/handlers.go | 6 | ||||
| -rw-r--r-- | backend/admin/templates/game_edit.html | 6 | ||||
| -rw-r--r-- | backend/admin/templates/user_edit.html | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/backend/admin/handlers.go b/backend/admin/handlers.go index d9a6977..d445de8 100644 --- a/backend/admin/handlers.go +++ b/backend/admin/handlers.go @@ -126,7 +126,7 @@ func (h *AdminHandler) getGames(c echo.Context) error { for i, g := range rows { var startedAt string if !g.StartedAt.Valid { - startedAt = g.StartedAt.Time.In(jst).Format("2006-01-02T15:04:05") + startedAt = g.StartedAt.Time.In(jst).Format("2006-01-02T15:04") } games[i] = echo.Map{ "GameID": g.GameID, @@ -161,7 +161,7 @@ func (h *AdminHandler) getGameEdit(c echo.Context) error { var startedAt string if !row.StartedAt.Valid { - startedAt = row.StartedAt.Time.In(jst).Format("2006-01-02T15:04:05") + startedAt = row.StartedAt.Time.In(jst).Format("2006-01-02T15:04") } return c.Render(http.StatusOK, "game_edit", echo.Map{ @@ -214,7 +214,7 @@ func (h *AdminHandler) postGameEdit(c echo.Context) error { { startedAtRaw := c.FormValue("started_at") if startedAtRaw != "" { - startedAtTime, err := time.Parse("2006-01-02T15:04:05", startedAtRaw) + startedAtTime, err := time.Parse("2006-01-02T15:04", startedAtRaw) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, "Invalid started_at") } diff --git a/backend/admin/templates/game_edit.html b/backend/admin/templates/game_edit.html index 764b577..108ae99 100644 --- a/backend/admin/templates/game_edit.html +++ b/backend/admin/templates/game_edit.html @@ -5,7 +5,7 @@ {{ end }} {{ define "content" }} -<form> +<form method="post"> <div> <label>Game ID</label> <input type="text" name="game_id" value="{{ .Game.GameID }}" readonly required> @@ -39,11 +39,11 @@ </div> <div> <label>Started At</label> - <input type="datetime-local" name="started_at" value="{{ .Game.StartedAt }}"> + <input type="datetime-local" name="started_at" value="{{ if .Game.StartedAt }}{{ .Game.StartedAt }}{{ end }}"> </div> <div> <label>Problem ID</label> - <input type="text" name="problem_id" value="{{ .Game.ProblemID }}" disabled> + <input type="text" name="problem_id" value="{{ if .Game.ProblemID }}{{ .Game.ProblemID }}{{ end }}"> </div> <div> <button type="submit">Save</button> diff --git a/backend/admin/templates/user_edit.html b/backend/admin/templates/user_edit.html index 9089b1e..bde7c84 100644 --- a/backend/admin/templates/user_edit.html +++ b/backend/admin/templates/user_edit.html @@ -5,7 +5,7 @@ {{ end }} {{ define "content" }} -<form> +<form method="post"> <div> <label>User ID</label> <input type="text" name="user_id" value="{{ .User.UserID }}" readonly required> |
