From 9a27dbdc3716be63389a8b551867c09e556bdc12 Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 24 Jan 2025 01:04:57 +0000 Subject: [PATCH 1/2] fixed style of inputs on release edit page (whoops!) --- admin/static/admin.css | 4 ++-- admin/static/edit-account.css | 9 +++++---- admin/static/edit-release.css | 9 ++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/admin/static/admin.css b/admin/static/admin.css index a6e0bc2..877b5da 100644 --- a/admin/static/admin.css +++ b/admin/static/admin.css @@ -206,13 +206,13 @@ form { width: 100%; display: block; } -label { +form label { width: 100%; margin: 1rem 0 .5rem 0; display: block; color: #10101080; } -input { +form input { margin: .5rem 0; padding: .3rem .5rem; display: block; diff --git a/admin/static/edit-account.css b/admin/static/edit-account.css index 37351b2..7a4d34a 100644 --- a/admin/static/edit-account.css +++ b/admin/static/edit-account.css @@ -5,10 +5,11 @@ div.card { } label { - width: 100%; - margin: 1rem 0 .5rem 0; - display: block; - color: #10101080; + width: auto; + margin: 0; + display: flex; + align-items: center; + color: inherit; } input { width: min(20rem, calc(100% - 1rem)); diff --git a/admin/static/edit-release.css b/admin/static/edit-release.css index 63d399e..aa70e34 100644 --- a/admin/static/edit-release.css +++ b/admin/static/edit-release.css @@ -228,12 +228,14 @@ dialog div.dialog-actions { } #editcredits .credit .credit-info .credit-attribute label { + width: auto; + margin: 0; display: flex; align-items: center; } #editcredits .credit .credit-info .credit-attribute input[type="text"] { - margin-left: .25em; + margin: 0 0 0 .25em; padding: .2em .4em; flex-grow: 1; font-family: inherit; @@ -241,6 +243,9 @@ dialog div.dialog-actions { border-radius: 4px; color: inherit; } +#editcredits .credit .credit-info .credit-attribute input[type="checkbox"] { + margin: 0 .3em; +} #editcredits .credit .artist-name { font-weight: bold; @@ -369,8 +374,10 @@ dialog div.dialog-actions { #editlinks td input[type="text"] { width: calc(100% - .6em); height: 100%; + margin: 0; padding: 0 .3em; border: none; + border-radius: 0; outline: none; cursor: pointer; background: none; From 090de0554bbfd64ab68fb560e8ad1559dd9ee312 Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 24 Jan 2025 01:33:14 +0000 Subject: [PATCH 2/2] fix bug causing edit tracks component to crash --- admin/components/tracks/edittracks.html | 10 +++++----- admin/releasehttp.go | 11 ++++++++++- model/track.go | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/admin/components/tracks/edittracks.html b/admin/components/tracks/edittracks.html index 0500532..d03f80a 100644 --- a/admin/components/tracks/edittracks.html +++ b/admin/components/tracks/edittracks.html @@ -3,20 +3,20 @@

Editing: Tracks

Add -
+
    - {{range $i, $track := .Tracks}} + {{range $i, $track := .Release.Tracks}}
  • - {{$track.Add $i 1}} + {{.Add $i 1}} {{$track.Title}}

    Delete diff --git a/admin/releasehttp.go b/admin/releasehttp.go index 7d098e6..cd73e98 100644 --- a/admin/releasehttp.go +++ b/admin/releasehttp.go @@ -145,7 +145,16 @@ func serveEditLinks(release *model.Release) http.Handler { func serveEditTracks(release *model.Release) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html") - err := components["edittracks"].Execute(w, release) + + type editTracksData struct { + Release *model.Release + Add func(a int, b int) int + } + + err := components["edittracks"].Execute(w, editTracksData{ + Release: release, + Add: func(a, b int) int { return a + b }, + }) if err != nil { fmt.Printf("Error rendering edit tracks component for %s: %s\n", release.ID, err) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) diff --git a/model/track.go b/model/track.go index d44c224..ca54ddd 100644 --- a/model/track.go +++ b/model/track.go @@ -12,6 +12,8 @@ type ( Description string `json:"description"` Lyrics string `json:"lyrics" db:"lyrics"` PreviewURL string `json:"previewURL" db:"preview_url"` + + Number int } )