diff options
author | 2024-04-19 20:35:43 +0300 | |
---|---|---|
committer | 2024-04-19 20:35:43 +0300 | |
commit | 8b0934d26be37e8cfde706b7915d105f33d35959 (patch) | |
tree | 558838425a117cfbca0325d989c4552e5469905c | |
parent | cleanup empty scss (diff) | |
download | soko-8b0934d26be37e8cfde706b7915d105f33d35959.tar.gz soko-8b0934d26be37e8cfde706b7915d105f33d35959.tar.bz2 soko-8b0934d26be37e8cfde706b7915d105f33d35959.zip |
app/package: shoe EAPI badge for each version
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | pkg/app/handler/packages/overview.templ | 26 | ||||
-rw-r--r-- | pkg/app/handler/user/packages.templ | 26 | ||||
-rw-r--r-- | pkg/models/userpreferences.go | 6 | ||||
-rw-r--r-- | web/packs/src/stylesheets/packages.scss | 5 |
4 files changed, 10 insertions, 53 deletions
diff --git a/pkg/app/handler/packages/overview.templ b/pkg/app/handler/packages/overview.templ index 7bf34d2..f9e13af 100644 --- a/pkg/app/handler/packages/overview.templ +++ b/pkg/app/handler/packages/overview.templ @@ -14,9 +14,9 @@ func overviewSlotText(version *models.Version) string { return version.Slot } -templ overviewVersionRow(version *models.Version, userPreferences *models.UserPreferences) { +templ overviewVersionRow(version *models.Version, keywords []string) { <tr> - <td class="kk-version "> + <td class="kk-version"> <strong> <a class="kk-ebuild-link" @@ -25,7 +25,7 @@ templ overviewVersionRow(version *models.Version, userPreferences *models.UserPr { version.Version } </a> </strong> - <span class="kk-slot"> : { overviewSlotText(version) }</span> + <span class="kk-slot" title={ "SLOT=\"" + overviewSlotText(version) + "\"" }> : { overviewSlotText(version) }</span> if len(version.Restricts) > 0 { <span class="badge badge-danger kk-restrict-label" @@ -34,17 +34,10 @@ templ overviewVersionRow(version *models.Version, userPreferences *models.UserPr { utils.FormatRestricts(version.Restricts) } </span> } - if userPreferences.Packages.Overview.EAPI == "inline" { - <span style="background-color: white;border:1px solid grey;color: grey;" class="badge badge-danger kk-restrict-label" title="The following features are restricted:">EAPI { version.EAPI }</span> - } + <span class="badge badge-light kk-eapi-label">EAPI { version.EAPI }</span> </td> - if userPreferences.Packages.Overview.EAPI == "column" { - <td class="text-center"> - { version.EAPI } - </td> - } for _, arch := range models.ArchesToShow { - if keywords := strings.Fields(version.Keywords); slices.Contains(keywords, "~"+arch) { + if slices.Contains(keywords, "~"+arch) { if len(version.Masks) > 0 { <td class="kk-keyword kk-keyword-masked" title={ version.Version + " is masked (testing) on " + arch }> <svg height="16" class="octicon octicon-diff-modified" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-mask" xlink:href="#svg-ver-mask"></use></svg> @@ -87,7 +80,7 @@ templ overviewVersionRow(version *models.Version, userPreferences *models.UserPr </tr> } -templ overviewVersions(pkg *models.Package, userPreferences *models.UserPreferences) { +templ overviewVersions(pkg *models.Package) { <h3 class="mb-2">Available Versions</h3> <div class="card mb-4 rounded"> <svg style="display: none" version="1.1"> @@ -111,9 +104,6 @@ templ overviewVersions(pkg *models.Package, userPreferences *models.UserPreferen <thead class="border-0"> <tr class="border-0"> <th class="kk-version border-left-0 border-top-0">Version</th> - if userPreferences.Packages.Overview.EAPI == "column" { - <th class="kk-keyword-header kk-keyword border-left-0 border-top-0">EAPI</th> - } for _, arch := range models.ArchesToShow { <th class="kk-keyword-header kk-keyword border-left-0 border-top-0">{ arch }</th> } @@ -121,7 +111,7 @@ templ overviewVersions(pkg *models.Package, userPreferences *models.UserPreferen </thead> <tbody> for _, version := range pkg.Versions { - @overviewVersionRow(version, userPreferences) + @overviewVersionRow(version, strings.Fields(version.Keywords)) } </tbody> </table> @@ -143,7 +133,7 @@ templ overview(pkg *models.Package, userPreferences *models.UserPreferences) { </div> } } - @overviewVersions(pkg, userPreferences) + @overviewVersions(pkg) if mask := getMask(pkg.Versions); mask != nil { <h3 class="pt-3 mb-2">Masks</h3> <div class="card kk-mask mb-3"> diff --git a/pkg/app/handler/user/packages.templ b/pkg/app/handler/user/packages.templ index 0bf4cbd..c9d8459 100644 --- a/pkg/app/handler/user/packages.templ +++ b/pkg/app/handler/user/packages.templ @@ -51,26 +51,6 @@ templ packages(preferences models.PackagesPreferences) { </div> </div> </div> - <h4 class="mt-4 mb-1">EAPI version</h4> - <div class="card"> - <div class="card-body"> - Show - <select class="form-control form-control-sm ml-2" style="max-width: 100px;display: inline;" name="overview-eapi" id="overview-eapi"> - <option - value="none" - selected?={ preferences.Overview.EAPI == "none" } - >none</option> - <option - value="column" - selected?={ preferences.Overview.EAPI == "column" } - >in column</option> - <option - value="inline" - selected?={ preferences.Overview.EAPI == "inline" } - >inline</option> - </select> - </div> - </div> <div class="row"> <div class="col-12 mt-4"> <button type="submit" class="float-right btn btn-sm btn-primary">Save</button> @@ -98,12 +78,6 @@ func EditPackagesPreferences(w http.ResponseWriter, r *http.Request) { userPreferences.Packages.Overview.Layout = overviewLayout } - // EAPI - showEAPI := r.Form.Get("overview-eapi") - if showEAPI == "none" || showEAPI == "column" || showEAPI == "inline" { - userPreferences.Packages.Overview.EAPI = showEAPI - } - // // Store cookie // diff --git a/pkg/models/userpreferences.go b/pkg/models/userpreferences.go index 91d95ee..ba22a46 100644 --- a/pkg/models/userpreferences.go +++ b/pkg/models/userpreferences.go @@ -18,7 +18,6 @@ type PackagesPreferences struct { type PackagesOverviewPreferences struct { Layout string - EAPI string } type MaintainersPreferences struct { @@ -39,7 +38,6 @@ func GetDefaultUserPreferences() UserPreferences { userPreferences.General.LandingPageLayout = "classic" userPreferences.Packages.Overview.Layout = "minimal" - userPreferences.Packages.Overview.EAPI = "none" userPreferences.Maintainers.IncludeProjectPackages = false userPreferences.Maintainers.ExcludedProjects = []string{} @@ -57,8 +55,4 @@ func (u *UserPreferences) Sanitize() { if !(u.Packages.Overview.Layout == "minimal" || u.Packages.Overview.Layout == "full") { u.Packages.Overview.Layout = defaultUserPreferences.Packages.Overview.Layout } - - if !(u.Packages.Overview.EAPI == "none" || u.Packages.Overview.EAPI == "column" || u.Packages.Overview.EAPI == "inline") { - u.Packages.Overview.EAPI = defaultUserPreferences.Packages.Overview.EAPI - } } diff --git a/web/packs/src/stylesheets/packages.scss b/web/packs/src/stylesheets/packages.scss index 133e2e7..69b3e77 100644 --- a/web/packs/src/stylesheets/packages.scss +++ b/web/packs/src/stylesheets/packages.scss @@ -148,8 +148,7 @@ } .kk-versions-table { - .kk-restrict-label, - .kk-properties-label { + .kk-restrict-label, .kk-eapi-label { float: right; @media screen and (max-width: 767px) { @@ -328,4 +327,4 @@ ul.timeline > li:before { width: 10px; height: 10px; z-index: 400; -}
\ No newline at end of file +} |