Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dynamic package type list #22263

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions routers/web/admin/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func Packages(ctx *context.Context) {
ctx.Data["PageIsAdminPackages"] = true
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
ctx.Data["AvailableTypes"] = packages_model.TypeList
ctx.Data["SortType"] = sort
ctx.Data["PackageDescriptors"] = pds
ctx.Data["Total"] = total
Expand Down
1 change: 1 addition & 0 deletions routers/web/repo/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func Packages(ctx *context.Context) {
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
ctx.Data["AvailableTypes"] = packages.TypeList
ctx.Data["HasPackages"] = hasPackages
if ctx.Repo != nil {
ctx.Data["CanWritePackages"] = ctx.IsUserRepoWriter([]unit.Type{unit.TypePackages}) || ctx.IsUserSiteAdmin()
Expand Down
1 change: 1 addition & 0 deletions routers/web/user/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func ListPackages(ctx *context.Context) {
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
ctx.Data["AvailableTypes"] = packages_model.TypeList
ctx.Data["HasPackages"] = hasPackages
ctx.Data["PackageDescriptors"] = pds
ctx.Data["Total"] = total
Expand Down
15 changes: 3 additions & 12 deletions templates/admin/packages/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,9 @@
<select class="ui dropdown" name="type">
<option value="">{{.locale.Tr "packages.filter.type"}}</option>
<option value="all">{{.locale.Tr "packages.filter.type.all"}}</option>
<option value="composer" {{if eq .PackageType "composer"}}selected="selected"{{end}}>Composer</option>
<option value="conan" {{if eq .PackageType "conan"}}selected="selected"{{end}}>Conan</option>
<option value="container" {{if eq .PackageType "container"}}selected="selected"{{end}}>Container</option>
<option value="generic" {{if eq .PackageType "generic"}}selected="selected"{{end}}>Generic</option>
<option value="helm" {{if eq .PackageType "helm"}}selected="selected"{{end}}>Helm</option>
<option value="maven" {{if eq .PackageType "maven"}}selected="selected"{{end}}>Maven</option>
<option value="npm" {{if eq .PackageType "npm"}}selected="selected"{{end}}>npm</option>
<option value="nuget" {{if eq .PackageType "nuget"}}selected="selected"{{end}}>NuGet</option>
<option value="pub" {{if eq .PackageType "pub"}}selected="selected"{{end}}>Pub</option>
<option value="pypi" {{if eq .PackageType "pypi"}}selected="selected"{{end}}>PyPi</option>
<option value="rubygems" {{if eq .PackageType "rubygems"}}selected="selected"{{end}}>RubyGems</option>
<option value="vagrant" {{if eq .PackageType "vagrant"}}selected="selected"{{end}}>Vagrant</option>
{{range $type := .AvailableTypes}}
<option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option>
{{end}}
</select>
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
Expand Down
15 changes: 3 additions & 12 deletions templates/package/shared/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,9 @@
<select class="ui dropdown" name="type">
<option value="">{{.locale.Tr "packages.filter.type"}}</option>
<option value="all">{{.locale.Tr "packages.filter.type.all"}}</option>
<option value="composer" {{if eq .PackageType "composer"}}selected="selected"{{end}}>Composer</option>
<option value="conan" {{if eq .PackageType "conan"}}selected="selected"{{end}}>Conan</option>
<option value="container" {{if eq .PackageType "container"}}selected="selected"{{end}}>Container</option>
<option value="generic" {{if eq .PackageType "generic"}}selected="selected"{{end}}>Generic</option>
<option value="helm" {{if eq .PackageType "helm"}}selected="selected"{{end}}>Helm</option>
<option value="maven" {{if eq .PackageType "maven"}}selected="selected"{{end}}>Maven</option>
<option value="npm" {{if eq .PackageType "npm"}}selected="selected"{{end}}>npm</option>
<option value="nuget" {{if eq .PackageType "nuget"}}selected="selected"{{end}}>NuGet</option>
<option value="pub" {{if eq .PackageType "pub"}}selected="selected"{{end}}>Pub</option>
<option value="pypi" {{if eq .PackageType "pypi"}}selected="selected"{{end}}>PyPi</option>
<option value="rubygems" {{if eq .PackageType "rubygems"}}selected="selected"{{end}}>RubyGems</option>
<option value="vagrant" {{if eq .PackageType "vagrant"}}selected="selected"{{end}}>Vagrant</option>
{{range $type := .AvailableTypes}}
<option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option>
{{end}}
</select>
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
Expand Down