Skip to content

Commit

Permalink
Suche nach aktuell nicht verfügbaren spielen
Browse files Browse the repository at this point in the history
  • Loading branch information
kubegu committed Jul 4, 2024
1 parent ec71b18 commit 6ffb02c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ type MediaByBranch struct {
func gameSearchHandler(respWriter http.ResponseWriter, request *http.Request) {
title := strings.ToLower(request.PostFormValue("title"))
platform := strings.ToLower(request.PostFormValue("platform"))
showNotAvailable := strings.ToLower(request.PostFormValue("showNotAvailable")) == "true"

client := libClient.Client{}
games := client.FindGames(title, platform)
if !showNotAvailable {
games = filterAvailable(games)
}
renderMediaResults(games, respWriter)
}

Expand Down
7 changes: 6 additions & 1 deletion web/static/games.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<div class="p-2">
<input type="text" class="form-control" id="title" name="title" placeholder="Titel des Spiels">
</div>
<!-- TODO: insert option für platform-->
<div class="p-2">
<select id="platformSelect" name="platform" class="form-select" style="width:auto;">
<option>Switch</option>
Expand All @@ -21,6 +20,12 @@
<div class="p-2">
<button type="submit" class="btn btn-primary">Los</button>
</div>
<div class="form-check">
<input class="form-check-input form-control mx-1" id="showNotAvailable" name="showNotAvailable" type="checkbox" value="true">
<label class="form-check-label" for="showNotAvailable">
Nicht ausleihbare anzeigen
</label>
</div>
</form>
<div class="d-flex justify-content-center htmx-indicator" id="spinner">
<div class="spinner-border" role="status"></div>
Expand Down

0 comments on commit 6ffb02c

Please sign in to comment.