Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Shortening updates group titles
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Jul 28, 2023
1 parent 84d7c1c commit 2a45fd7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/arelate/gaugin

go 1.19
go 1.20

require (
github.com/arelate/southern_light v0.1.28
Expand Down
25 changes: 20 additions & 5 deletions rest/get_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ func GetUpdates(w http.ResponseWriter, r *http.Request) {
}
updates[section] = append(updates[section], id)
}
//if len(ids) > 0 {
// updates[section] = ids
//}
}

keys := make(map[string]bool)
Expand Down Expand Up @@ -118,14 +115,32 @@ func GetUpdates(w http.ResponseWriter, r *http.Request) {

gaugin_middleware.DefaultHeaders(st, w)

// section order will be based on full title ("new in ...", "updates in ...")
// so not changed after concise update titles change
sections := maps.Keys(updates)
sort.Strings(sections)

var caser = cases.Title(language.Russian)
var caser = cases.Title(language.English)

sectionTitles := make(map[string]string)
for t, _ := range updates {
sectionTitles[t] = caser.String(t)
st := t
switch t {
case "new in store":
st = "store"
case "new in account":
st = "account"
case "new in wishlist":
st = "wishlist"
case "released today":
st = "today"
case "updates in account":
st = "updates"
case "updates in news":
st = "news"
}

sectionTitles[t] = caser.String(st)
}

if err := app.RenderGroup(
Expand Down

0 comments on commit 2a45fd7

Please sign in to comment.