From 5e627d37ab08d8b78c3ba157d2d9f25208dfd1af Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Sun, 26 Feb 2023 18:11:04 +0100 Subject: [PATCH] Add sort --- Dockerfile | 11 +++++++++++ src/serra/web.go | 3 ++- templates/index.tmpl | 23 +++++++++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0a2392a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.20 + +WORKDIR /go/src/app +COPY . /go/src/app + +RUN go get -v ./... +RUN go build -ldflags "-X github.com/noqqe/serra/src/serra.Version=`git describe --tags`" -v serra.go + +# Run radsportsalat +EXPOSE 8080 +CMD [ "./serra", "web" ] diff --git a/src/serra/web.go b/src/serra/web.go index d83a909..f781485 100644 --- a/src/serra/web.go +++ b/src/serra/web.go @@ -26,6 +26,7 @@ var webCmd = &cobra.Command{ type Query struct { Name string `form:"name"` Set string `form:"set"` + Sort string `form:"sort"` } func startWeb() error { @@ -45,7 +46,7 @@ func landingPage(c *gin.Context) { var query Query if c.ShouldBind(&query) == nil { - cards := Cards("", query.Set, "", query.Name, "", "") + cards := Cards("", query.Set, query.Sort, query.Name, "", "") sets := Sets("release") c.HTML(http.StatusOK, "index.tmpl", gin.H{ "title": "Serraaaa", diff --git a/templates/index.tmpl b/templates/index.tmpl index 26caed3..38eec62 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -34,6 +34,7 @@
+
@@ -60,6 +61,21 @@
+
+
+ +
+
+ +
+
+
+
+
@@ -125,8 +141,11 @@ (RegExp(paramName + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1] ); } - var selectedVal = getParam("set"); - document.getElementById("set").value = selectedVal; + var selectedSetVal = getParam("set"); + document.getElementById("set").value = selectedSetVal; + + var selectedSortVal = getParam("sort"); + document.getElementById("sort").value = selectedSortVal;