diff options
author | 2024-03-22 10:01:31 +0200 | |
---|---|---|
committer | 2024-03-22 10:01:31 +0200 | |
commit | b8cb5000755b87c1694a19eed6da540695b9c704 (patch) | |
tree | a55b7bc57b7f0fdeb03c0f8c10936b345711c356 | |
parent | db connection: cleanup TruncateTable function (diff) | |
download | soko-b8cb5000755b87c1694a19eed6da540695b9c704.tar.gz soko-b8cb5000755b87c1694a19eed6da540695b9c704.tar.bz2 soko-b8cb5000755b87c1694a19eed6da540695b9c704.zip |
pull-requests: simplify component
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | pkg/app/handler/categories/show.go | 2 | ||||
-rw-r--r-- | pkg/app/handler/maintainer/show.go | 2 | ||||
-rw-r--r-- | pkg/app/handler/packages/components/pullrequests.templ | 4 | ||||
-rw-r--r-- | pkg/app/handler/packages/show.templ | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/pkg/app/handler/categories/show.go b/pkg/app/handler/categories/show.go index 4f8bc60..c116119 100644 --- a/pkg/app/handler/categories/show.go +++ b/pkg/app/handler/categories/show.go @@ -104,7 +104,7 @@ func ShowPullRequests(w http.ResponseWriter, r *http.Request) { return } renderShowPage(w, r, "Pull requests", &category, - components.PullRequests(category.PackagesInformation.PullRequests > 0, pullRequests)) + components.PullRequests(pullRequests)) } func ShowStabilizations(w http.ResponseWriter, r *http.Request) { diff --git a/pkg/app/handler/maintainer/show.go b/pkg/app/handler/maintainer/show.go index 5f05382..3f30b38 100644 --- a/pkg/app/handler/maintainer/show.go +++ b/pkg/app/handler/maintainer/show.go @@ -172,7 +172,7 @@ func ShowPullRequests(w http.ResponseWriter, r *http.Request) { return } layout.Layout(maintainer.Name, "maintainers", - show(packagesCount, &maintainer, "Pull requests", components.PullRequests(len(pullRequests) > 0, pullRequests)), + show(packagesCount, &maintainer, "Pull requests", components.PullRequests(pullRequests)), ).Render(r.Context(), w) } diff --git a/pkg/app/handler/packages/components/pullrequests.templ b/pkg/app/handler/packages/components/pullrequests.templ index dfd2d9f..0f2cc2a 100644 --- a/pkg/app/handler/packages/components/pullrequests.templ +++ b/pkg/app/handler/packages/components/pullrequests.templ @@ -12,10 +12,10 @@ func isDarkBadgeColor(color string) bool { return color == "5319e7" || color == "0052cc" || color == "b60205" } -templ PullRequests(hasPullRequests bool, pullRequests []*models.GithubPullRequest) { +templ PullRequests(pullRequests []*models.GithubPullRequest) { <div class="row"> <div class="col-md-9"> - if hasPullRequests { + if len(pullRequests) > 0 { <h3 class="mb-4">Pull Requests</h3> <ul class="list-group"> for _, pr := range pullRequests { diff --git a/pkg/app/handler/packages/show.templ b/pkg/app/handler/packages/show.templ index fd5c673..515e57a 100644 --- a/pkg/app/handler/packages/show.templ +++ b/pkg/app/handler/packages/show.templ @@ -144,7 +144,7 @@ templ show(pkg *models.Package, currentSubTab string, userPreferences models.Use case "QA report": @qaReport(pkg) case "Pull requests": - @components.PullRequests(len(pkg.PullRequests) > 0, pkg.PullRequests) + @components.PullRequests(pkg.PullRequests) case "Bugs": @components.Bugs(collectAllBugs(pkg)) case "Security": |