Skip to content

Commit

Permalink
Fix 'Edit Results' button.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed May 16, 2024
1 parent 689a3bf commit a092655
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion templates/edit_match_result.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<div id="blueScore"></div>
<div class="row">
<div class="text-center col-lg-12">
<a href="/match_review"><button type="button" class="btn btn-secondary">Cancel</button></a>
<a href="{{if .IsCurrentMatch}}/match_play{{else}}/match_review{{end}}"><button type="button"
class="btn btn-secondary">Cancel</button></a>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/match_play.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
onclick="$('#confirmDiscardResults').modal('show');" disabled>
Discard Results
</button>
<a href="/match_review/current/edit" role="button" class="btn btn-secondary btn-match-play ms-1 disabled"
disabled>
<button type="button" id="editResults" class="btn btn-secondary btn-match-play ms-1"
onclick="window.location = '/match_review/current/edit';" disabled>
Edit Results
</a>
</button>
</div>
<div class="card card-body bg-body-tertiary mt-3">
<div class="row">
Expand Down
5 changes: 3 additions & 2 deletions web/match_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (web *Web) matchReviewEditGetHandler(w http.ResponseWriter, r *http.Request
return
}

match, matchResult, _, err := web.getMatchResultFromRequest(r)
match, matchResult, isCurrent, err := web.getMatchResultFromRequest(r)
if err != nil {
handleWebErr(w, err)
return
Expand All @@ -96,8 +96,9 @@ func (web *Web) matchReviewEditGetHandler(w http.ResponseWriter, r *http.Request
*model.EventSettings
Match *model.Match
MatchResultJson string
IsCurrentMatch bool
Rules map[int]*game.Rule
}{web.arena.EventSettings, match, string(matchResultJson), game.GetAllRules()}
}{web.arena.EventSettings, match, string(matchResultJson), isCurrent, game.GetAllRules()}
err = template.ExecuteTemplate(w, "base", data)
if err != nil {
handleWebErr(w, err)
Expand Down

0 comments on commit a092655

Please sign in to comment.