diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
commit | 65aa53fc52ff15efe54df4147564828d535837f8 (patch) | |
tree | 31c51dad04fdcca80e6d3043c8bd49d2f1a51f83 /templates/package | |
parent | Initial commit. (diff) | |
download | forgejo-65aa53fc52ff15efe54df4147564828d535837f8.tar.xz forgejo-65aa53fc52ff15efe54df4147564828d535837f8.zip |
Adding upstream version 8.0.3.HEADupstream/8.0.3upstreamdebian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'templates/package')
52 files changed, 1609 insertions, 0 deletions
diff --git a/templates/package/content/alpine.tmpl b/templates/package/content/alpine.tmpl new file mode 100644 index 00000000..8914006f --- /dev/null +++ b/templates/package/content/alpine.tmpl @@ -0,0 +1,52 @@ +{{if eq .PackageDescriptor.Package.Type "alpine"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.alpine.registry"}}</label> + <div class="markup"><pre class="code-block"><code><origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine"></origin-url>/$branch/$repository</code></pre></div> + <p>{{ctx.Locale.Tr "packages.alpine.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.registry.key"}}</label> + <div class="markup"><pre class="code-block"><code>curl -JO <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine/key"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apk add {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Alpine" "https://forgejo.org/docs/latest/user/packages/alpine/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.alpine.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.branches"}}</h5></td> + <td>{{StringUtils.Join .Branches ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.repositories"}}</h5></td> + <td>{{StringUtils.Join .Repositories ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl new file mode 100644 index 00000000..2f14945d --- /dev/null +++ b/templates/package/content/cargo.tmpl @@ -0,0 +1,63 @@ +{{if eq .PackageDescriptor.Package.Type "cargo"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cargo.registry"}}</label> + <div class="markup"><pre class="code-block"><code>[registry] +default = "forgejo" + +[registries.forgejo] +index = "sparse+<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cargo/"></origin-url>" # Sparse index +# index = "<origin-url data-url="{{AppSubUrl}}/{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"></origin-url>" # Git + +[net] +git-fetch-with-cli = true</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cargo.install"}}</label> + <div class="markup"><pre class="code-block"><code>cargo add {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Cargo" "https://forgejo.org/docs/latest/user/packages/cargo/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Req}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/chef.tmpl b/templates/package/content/chef.tmpl new file mode 100644 index 00000000..d39164b9 --- /dev/null +++ b/templates/package/content/chef.tmpl @@ -0,0 +1,48 @@ +{{if eq .PackageDescriptor.Package.Type "chef"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.chef.registry"}}</label> + <div class="markup"><pre class="code-block"><code>knife[:supermarket_site] = '<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/chef"></origin-url>'</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.chef.install"}}</label> + <div class="markup"><pre class="code-block"><code>knife supermarket install {{.PackageDescriptor.Package.Name}} {{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Chef" "https://forgejo.org/docs/latest/user/packages/chef/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}<p>{{.PackageDescriptor.Metadata.Description}}</p>{{end}} + {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer.tmpl b/templates/package/content/composer.tmpl new file mode 100644 index 00000000..73ab3ac7 --- /dev/null +++ b/templates/package/content/composer.tmpl @@ -0,0 +1,50 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.composer.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{ + "repositories": [{ + "type": "composer", + "url": "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/composer"></origin-url>" + } + ] +}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.composer.install"}}</label> + <div class="markup"><pre class="code-block"><code>composer require {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Composer" "https://forgejo.org/docs/latest/user/packages/composer/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Comments}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Comments}}<div class="ui attached segment">{{StringUtils.Join .PackageDescriptor.Metadata.Comments " "}}</div>{{end}} + {{end}} + + {{if or .PackageDescriptor.Metadata.Require .PackageDescriptor.Metadata.RequireDev}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Require "title" (ctx.Locale.Tr "packages.composer.dependencies")}} + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RequireDev "title" (ctx.Locale.Tr "packages.composer.dependencies.development")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer_dependencies.tmpl b/templates/package/content/composer_dependencies.tmpl new file mode 100644 index 00000000..dba45750 --- /dev/null +++ b/templates/package/content/composer_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/conan.tmpl b/templates/package/content/conan.tmpl new file mode 100644 index 00000000..8ebc258e --- /dev/null +++ b/templates/package/content/conan.tmpl @@ -0,0 +1,34 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.registry"}}</label> + <div class="markup"><pre class="code-block"><code>conan remote add forgejo <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conan"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.install"}}</label> + <div class="markup"><pre class="code-block"><code>conan install --remote=forgejo {{.PackageDescriptor.Package.Name}}/{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conan" "https://forgejo.org/docs/latest/user/packages/conan/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/conda.tmpl b/templates/package/content/conda.tmpl new file mode 100644 index 00000000..5ff79445 --- /dev/null +++ b/templates/package/content/conda.tmpl @@ -0,0 +1,30 @@ +{{if eq .PackageDescriptor.Package.Type "conda"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.conda.registry"}}</label> + <div class="markup"><pre class="code-block"><code>channel_alias: <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +default_channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conda.install"}}</label> + {{$channel := .PackageDescriptor.PackageProperties.GetByName "conda.channel"}} + <div class="markup"><pre class="code-block"><code>conda install{{if $channel}} -c {{$channel}}{{end}} {{.PackageDescriptor.PackageProperties.GetByName "conda.name"}}={{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conda" "https://forgejo.org/docs/latest/user/packages/conda/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{else}}{{.PackageDescriptor.Metadata.Summary}}{{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl new file mode 100644 index 00000000..b5fdcfeb --- /dev/null +++ b/templates/package/content/container.tmpl @@ -0,0 +1,90 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.container.pull"}}</label> + {{if eq .PackageDescriptor.Metadata.Type "helm"}} + <div class="markup"><pre class="code-block"><code>helm pull oci://{{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}} --version {{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{else}} + {{$separator := ":"}} + {{if not .PackageDescriptor.Metadata.IsTagged}} + {{$separator = "@"}} + {{end}} + <div class="markup"><pre class="code-block"><code>docker pull {{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}}{{$separator}}{{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{end}} + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.container.digest"}}</label> + <div class="markup"><pre class="code-block"><code>{{range .PackageDescriptor.Files}}{{if eq .File.LowerName "manifest.json"}}{{.Properties.GetByName "container.digest"}}{{end}}{{end}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Container" "https://forgejo.org/docs/latest/user/packages/container/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Manifests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4> + <div class="ui attached segment"> + <table class="ui very basic compact table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.digest"}}</th> + <th>{{ctx.Locale.Tr "packages.container.multi_arch"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Manifests}} + <tr> + <td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{.Digest}}</a></td> + <td>{{.Platform}}</td> + <td>{{ctx.Locale.TrSize .Size}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.ImageLayers}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.layers"}}</h4> + <div class="ui attached segment tw-break-anywhere"> + <table class="ui very basic compact table"> + <tbody> + {{range .PackageDescriptor.Metadata.ImageLayers}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Labels}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.labels"}}</h4> + <div class="ui attached segment"> + <table class="ui very basic compact table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.labels.key"}}</th> + <th>{{ctx.Locale.Tr "packages.container.labels.value"}}</th> + </tr> + </thead> + <tbody> + {{range $key, $value := .PackageDescriptor.Metadata.Labels}} + <tr> + <td class="top aligned">{{$key}}</td> + <td class="tw-break-anywhere">{{$value}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/cran.tmpl b/templates/package/content/cran.tmpl new file mode 100644 index 00000000..df7a48c3 --- /dev/null +++ b/templates/package/content/cran.tmpl @@ -0,0 +1,59 @@ +{{if eq .PackageDescriptor.Package.Type "cran"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cran.registry"}}</label> + <div class="markup"><pre class="code-block"><code>options("repos" = c(getOption("repos"), c(forgejo="<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cran"></origin-url>")))</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cran.install"}}</label> + <div class="markup"><pre class="code-block"><code>install.packages("{{.PackageDescriptor.Package.Name}}")</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "CRAN" "https://forgejo.org/docs/latest/user/packages/cran/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Title}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Title}}{{else}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Imports .PackageDescriptor.Metadata.Depends .PackageDescriptor.Metadata.LinkingTo .PackageDescriptor.Metadata.Suggests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{if .PackageDescriptor.Metadata.Imports}} + <tr> + <td>Imports</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Imports ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Depends}} + <tr> + <td>Depends</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Depends ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.LinkingTo}} + <tr> + <td>LinkingTo</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.LinkingTo ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Suggests}} + <tr> + <td>Suggests</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Suggests ", "}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/debian.tmpl b/templates/package/content/debian.tmpl new file mode 100644 index 00000000..782ac1c8 --- /dev/null +++ b/templates/package/content/debian.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "debian"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.registry"}}</label> + <div class="markup"><pre class="code-block"><code>sudo curl <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian/repository.key"></origin-url> -o /etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc +echo "deb [signed-by=/etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc] <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian"></origin-url> $distribution $component" | sudo tee -a /etc/apt/sources.list.d/forgejo.list +sudo apt update</code></pre></div> + <p>{{ctx.Locale.Tr "packages.debian.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apt install {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Debian" "https://forgejo.org/docs/latest/user/packages/debian/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.debian.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.distributions"}}</h5></td> + <td>{{StringUtils.Join .Distributions ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.components"}}</h5></td> + <td>{{StringUtils.Join .Components ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/generic.tmpl b/templates/package/content/generic.tmpl new file mode 100644 index 00000000..4ebfb910 --- /dev/null +++ b/templates/package/content/generic.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "generic"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.generic.download"}}</label> + <div class="markup"><pre class="code-block"><code> +{{- range .PackageDescriptor.Files -}} +curl -OJ <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/generic/{{$.PackageDescriptor.Package.Name}}/{{$.PackageDescriptor.Version.Version}}/{{.File.Name}}"></origin-url> +{{end -}} + </code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Generic" "https://forgejo.org/docs/latest/user/packages/generic/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/go.tmpl b/templates/package/content/go.tmpl new file mode 100644 index 00000000..5e32ea7f --- /dev/null +++ b/templates/package/content/go.tmpl @@ -0,0 +1,14 @@ +{{if eq .PackageDescriptor.Package.Type "go"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.go.install"}}</label> + <div class="markup"><pre class="code-block"><code>GOPROXY=<origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/go"></origin-url> go install {{$.PackageDescriptor.Package.Name}}@{{$.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Go" "https://forgejo.org/docs/latest/user/packages/go/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/helm.tmpl b/templates/package/content/helm.tmpl new file mode 100644 index 00000000..9d855559 --- /dev/null +++ b/templates/package/content/helm.tmpl @@ -0,0 +1,57 @@ +{{if eq .PackageDescriptor.Package.Type "helm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>helm repo add {{AppDomain}} <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/helm"></origin-url> +helm repo update</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.install"}}</label> + <div class="markup"><pre class="code-block"><code>helm install {{.PackageDescriptor.Package.Name}} {{AppDomain}}/{{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Helm" "https://forgejo.org/docs/latest/user/packages/helm/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl new file mode 100644 index 00000000..7f7e3faf --- /dev/null +++ b/templates/package/content/maven.tmpl @@ -0,0 +1,75 @@ +{{if eq .PackageDescriptor.Package.Type "maven"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.registry"}}</label> + <div class="markup"><pre class="code-block"><code><repositories> + <repository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </repository> +</repositories> + +<distributionManagement> + <repository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </repository> + + <snapshotRepository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </snapshotRepository> +</distributionManagement></code></pre></div> + </div> + {{if .PackageDescriptor.Metadata}} + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.install"}}</label> + <div class="markup"><pre class="code-block"><code><dependency> + <groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId> + <artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId> + <version>{{.PackageDescriptor.Version.Version}}</version> +</dependency></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.install2"}}</label> + <div class="markup"><pre class="code-block"><code>mvn install</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.download"}}</label> + <div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url> -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Maven" "https://forgejo.org/docs/latest/user/packages/maven/"}}</label> + </div> + {{end}} + </div> + </div> + + {{if .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .PackageDescriptor.Metadata.Dependencies}} + <div class="item"> + <i class="icon">{{svg "octicon-package-dependencies" 16 ""}}</i> + <div class="content"> + <div class="header">{{.GroupID}}:{{.ArtifactID}}</div> + <div class="description text small">{{.Version}}</div> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + {{end}} +{{end}} diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl new file mode 100644 index 00000000..1ffbd199 --- /dev/null +++ b/templates/package/content/npm.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{if .PackageDescriptor.Metadata.Scope}}{{.PackageDescriptor.Metadata.Scope}}:{{end}}registry=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/npm/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.npm.install"}}</label> + <div class="markup"><pre class="code-block"><code>npm install {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.install2"}}</label> + <div class="markup"><pre class="code-block"><code>"{{.PackageDescriptor.Package.Name}}": "{{.PackageDescriptor.Version.Version}}"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "npm" "https://forgejo.org/docs/latest/user/packages/npm/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Readme}} + <div class="markup markdown"> + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}} + </div> + {{else if .PackageDescriptor.Metadata.Description}} + {{.PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Dependencies .PackageDescriptor.Metadata.DevelopmentDependencies .PackageDescriptor.Metadata.PeerDependencies .PackageDescriptor.Metadata.OptionalDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Dependencies "title" (ctx.Locale.Tr "packages.npm.dependencies")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.development")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.PeerDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.peer")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.OptionalDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.optional")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.BundleDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.npm.dependencies.bundle"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.BundleDependencies}} + {{.}} + {{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/npm_dependencies.tmpl b/templates/package/content/npm_dependencies.tmpl new file mode 100644 index 00000000..dba45750 --- /dev/null +++ b/templates/package/content/npm_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/nuget.tmpl b/templates/package/content/nuget.tmpl new file mode 100644 index 00000000..ea665c7b --- /dev/null +++ b/templates/package/content/nuget.tmpl @@ -0,0 +1,51 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.registry"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet nuget add source --name {{.PackageDescriptor.Owner.Name}} --username your_username --password your_token <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/nuget/index.json"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.install"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet add package --source {{.PackageDescriptor.Owner.Name}} --version {{.PackageDescriptor.Version.Version}} {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "NuGet" "https://forgejo.org/docs/latest/user/packages/nuget/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.ReleaseNotes .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ReleaseNotes}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.ReleaseNotes}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.nuget.dependency.framework"}}</th> + </tr> + </thead> + <tbody> + {{range $framework, $dependencies := .PackageDescriptor.Metadata.Dependencies}} + {{range $dependencies}} + <tr> + <td>{{.ID}}</td> + <td>{{.Version}}</td> + <td>{{$framework}}</td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/pub.tmpl b/templates/package/content/pub.tmpl new file mode 100644 index 00000000..8448b974 --- /dev/null +++ b/templates/package/content/pub.tmpl @@ -0,0 +1,19 @@ +{{if eq .PackageDescriptor.Package.Type "pub"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pub.install"}}</label> + <div class="markup"><pre class="code-block"><code>dart pub add {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}} --hosted-url=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pub/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Pub" "https://forgejo.org/docs/latest/user/packages/pub/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl new file mode 100644 index 00000000..6addac3f --- /dev/null +++ b/templates/package/content/pypi.tmpl @@ -0,0 +1,31 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pypi.install"}}</label> + <div class="markup"><pre class="code-block"><code>pip install --index-url <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pypi/simple/"></origin-url> {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "PyPI" "https://forgejo.org/docs/latest/user/packages/pypi/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + <p>{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}</p> + {{if .PackageDescriptor.Metadata.LongDescription}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}} + {{else if .PackageDescriptor.Metadata.Description}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.RequiresPython}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{ctx.Locale.Tr "packages.pypi.requires"}}: {{.PackageDescriptor.Metadata.RequiresPython}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rpm.tmpl b/templates/package/content/rpm.tmpl new file mode 100644 index 00000000..f5d56623 --- /dev/null +++ b/templates/package/content/rpm.tmpl @@ -0,0 +1,56 @@ +{{if eq .PackageDescriptor.Package.Type "rpm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{- if gt (len .Groups) 1 -}} +# {{ctx.Locale.Tr "packages.rpm.repository.multiple_groups"}} + +{{end -}} +# {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +dnf config-manager --add-repo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +zypper addrepo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.install"}}</label> + <div class="markup"> + <pre class="code-block"><code># {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +dnf install {{$.PackageDescriptor.Package.Name}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +zypper install {{$.PackageDescriptor.Package.Name}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RPM" "https://forgejo.org/docs/latest/user/packages/rpm/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.rpm.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.rpm.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if or .PackageDescriptor.Metadata.Summary .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Summary}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Summary}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/rubygems.tmpl b/templates/package/content/rubygems.tmpl new file mode 100644 index 00000000..009fd703 --- /dev/null +++ b/templates/package/content/rubygems.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rubygems.install"}}:</label> + <div class="markup"><pre class="code-block"><code>gem install {{.PackageDescriptor.Package.Name}} --version "{{.PackageDescriptor.Version.Version}}" --source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.rubygems.install2"}}:</label> + <div class="markup"><pre class="code-block"><code>source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>" do + gem "{{.PackageDescriptor.Package.Name}}", "{{.PackageDescriptor.Version.Version}}" +end</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RubyGems" "https://forgejo.org/docs/latest/user/packages/rubygems/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} + {{if or .PackageDescriptor.Metadata.RequiredRubyVersion .PackageDescriptor.Metadata.RequiredRubygemsVersion}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.RequiredRubyVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.ruby"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubyVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + {{if .PackageDescriptor.Metadata.RequiredRubygemsVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.rubygems"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubygemsVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + </div> + {{end}} + {{if or .PackageDescriptor.Metadata.RuntimeDependencies .PackageDescriptor.Metadata.DevelopmentDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RuntimeDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.runtime")}} + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.development")}} + </div> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rubygems_dependencies.tmpl b/templates/package/content/rubygems_dependencies.tmpl new file mode 100644 index 00000000..2c42dcea --- /dev/null +++ b/templates/package/content/rubygems_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{range $i, $v := .Version}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/swift.tmpl b/templates/package/content/swift.tmpl new file mode 100644 index 00000000..68db4448 --- /dev/null +++ b/templates/package/content/swift.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "swift"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.registry"}}</label> + <div class="markup"><pre class="code-block"><code>swift package-registry set <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/swift"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.swift.install"}}</label> + <div class="markup"><pre class="code-block"><code>dependencies: [ + .package(id: "{{.PackageDescriptor.Package.Name}}", from:"{{.PackageDescriptor.Version.Version}}") +]</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.install2"}}</label> + <div class="markup"><pre class="code-block"><code>swift package resolve</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Swift" "https://forgejo.org/docs/latest/user/packages/swift/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/vagrant.tmpl b/templates/package/content/vagrant.tmpl new file mode 100644 index 00000000..4dc3e62a --- /dev/null +++ b/templates/package/content/vagrant.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "vagrant"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.vagrant.install"}}</label> + <div class="markup"><pre class="code-block"><code>vagrant box add --box-version {{.PackageDescriptor.Version.Version}} "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/vagrant/{{.PackageDescriptor.Package.Name}}"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Vagrant" "https://forgejo.org/docs/latest/user/packages/vagrant/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} +{{end}} diff --git a/templates/package/metadata/alpine.tmpl b/templates/package/metadata/alpine.tmpl new file mode 100644 index 00000000..3e7f10f6 --- /dev/null +++ b/templates/package/metadata/alpine.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "alpine"}} + {{if .PackageDescriptor.Metadata.Maintainer}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Maintainer}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/cargo.tmpl b/templates/package/metadata/cargo.tmpl new file mode 100644 index 00000000..5ad3c20a --- /dev/null +++ b/templates/package/metadata/cargo.tmpl @@ -0,0 +1,7 @@ +{{if eq .PackageDescriptor.Package.Type "cargo"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/chef.tmpl b/templates/package/metadata/chef.tmpl new file mode 100644 index 00000000..23a9ce3e --- /dev/null +++ b/templates/package/metadata/chef.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "chef"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/composer.tmpl b/templates/package/metadata/composer.tmpl new file mode 100644 index 00000000..0f6ff9d6 --- /dev/null +++ b/templates/package/metadata/composer.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Homepage}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.Homepage}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{range .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/conan.tmpl b/templates/package/metadata/conan.tmpl new file mode 100644 index 00000000..4e05ec25 --- /dev/null +++ b/templates/package/metadata/conan.tmpl @@ -0,0 +1,6 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/conda.tmpl b/templates/package/metadata/conda.tmpl new file mode 100644 index 00000000..3628686e --- /dev/null +++ b/templates/package/metadata/conda.tmpl @@ -0,0 +1,6 @@ +{{if eq .PackageDescriptor.Package.Type "conda"}} + {{if .PackageDescriptor.Metadata.License}}<div class="item">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/container.tmpl b/templates/package/metadata/container.tmpl new file mode 100644 index 00000000..f5abb7ef --- /dev/null +++ b/templates/package/metadata/container.tmpl @@ -0,0 +1,9 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <div class="item" title="{{ctx.Locale.Tr "packages.container.details.type"}}">{{svg "octicon-package" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Type.Name}}</div> + {{if .PackageDescriptor.Metadata.Platform}}<div class="item" title="{{ctx.Locale.Tr "packages.container.details.platform"}}">{{svg "octicon-cpu" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Platform}}</div>{{end}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Licenses}}<div class="item">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Licenses}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/cran.tmpl b/templates/package/metadata/cran.tmpl new file mode 100644 index 00000000..1d5a11e1 --- /dev/null +++ b/templates/package/metadata/cran.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "cran"}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "mr-3"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.}}</div>{{end}} + {{range .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/debian.tmpl b/templates/package/metadata/debian.tmpl new file mode 100644 index 00000000..3cd845c9 --- /dev/null +++ b/templates/package/metadata/debian.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "debian"}} + {{if .PackageDescriptor.Metadata.Maintainer}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Maintainer}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/generic.tmpl b/templates/package/metadata/generic.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/package/metadata/generic.tmpl diff --git a/templates/package/metadata/helm.tmpl b/templates/package/metadata/helm.tmpl new file mode 100644 index 00000000..50ea4849 --- /dev/null +++ b/templates/package/metadata/helm.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "helm"}} + {{range .PackageDescriptor.Metadata.Maintainers}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Home}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.Home}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/maven.tmpl b/templates/package/metadata/maven.tmpl new file mode 100644 index 00000000..62573a14 --- /dev/null +++ b/templates/package/metadata/maven.tmpl @@ -0,0 +1,5 @@ +{{if and (eq .PackageDescriptor.Package.Type "maven") .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Name}}<div class="item">{{svg "octicon-note" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/npm.tmpl b/templates/package/metadata/npm.tmpl new file mode 100644 index 00000000..df37504e --- /dev/null +++ b/templates/package/metadata/npm.tmpl @@ -0,0 +1,8 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{range .PackageDescriptor.VersionProperties}} + {{if eq .Name "npm.tag"}}<div class="item" title="{{ctx.Locale.Tr "packages.npm.details.tag"}}">{{svg "octicon-versions" 16 "tw-mr-2"}} {{.Value}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/metadata/nuget.tmpl b/templates/package/metadata/nuget.tmpl new file mode 100644 index 00000000..5534577b --- /dev/null +++ b/templates/package/metadata/nuget.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + {{if .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Authors}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/pub.tmpl b/templates/package/metadata/pub.tmpl new file mode 100644 index 00000000..16f7cec3 --- /dev/null +++ b/templates/package/metadata/pub.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "pub"}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/pypi.tmpl b/templates/package/metadata/pypi.tmpl new file mode 100644 index 00000000..3d9b2139 --- /dev/null +++ b/templates/package/metadata/pypi.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/rpm.tmpl b/templates/package/metadata/rpm.tmpl new file mode 100644 index 00000000..eda8a489 --- /dev/null +++ b/templates/package/metadata/rpm.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "rpm"}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/rubygems.tmpl b/templates/package/metadata/rubygems.tmpl new file mode 100644 index 00000000..9b112876 --- /dev/null +++ b/templates/package/metadata/rubygems.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div> {{end}} + {{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/swift.tmpl b/templates/package/metadata/swift.tmpl new file mode 100644 index 00000000..fdffb6de --- /dev/null +++ b/templates/package/metadata/swift.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "swift"}} + {{if .PackageDescriptor.Metadata.Author.String}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/vagrant.tmpl b/templates/package/metadata/vagrant.tmpl new file mode 100644 index 00000000..4628a2dc --- /dev/null +++ b/templates/package/metadata/vagrant.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "vagrant"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl new file mode 100644 index 00000000..4b877347 --- /dev/null +++ b/templates/package/settings.tmpl @@ -0,0 +1,77 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository settings options{{if .ContextUser.IsOrganization}} organization{{end}}"> + {{if .ContextUser.IsOrganization}} + {{template "org/header" .}} + {{else}} + {{template "shared/user/org_profile_avatar" .}} + {{end}} + <div class="ui container"> + {{if not .ContextUser.IsOrganization}} + {{template "user/overview/header" .}} + {{end}} + {{template "base/alert" .}} + <p><a href="{{.PackageDescriptor.VersionWebLink}}">{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</a> / <strong>{{ctx.Locale.Tr "repo.settings"}}</strong></p> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.settings.link"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "packages.settings.link.description"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="link"> + <div class="field"> + <div class="ui clearable selection dropdown"> + {{$repoID := 0}} + {{if .PackageDescriptor.Repository}} + {{$repoID = .PackageDescriptor.Repository.ID}} + {{end}} + <input type="hidden" name="repo_id" value="{{$repoID}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="default text">{{ctx.Locale.Tr "packages.settings.link.select"}}</div> + <div class="menu"> + {{range .Repos}} + <div class="item" data-value="{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "packages.settings.link.button"}}</button> + </div> + </form> + </div> + <h4 class="ui top attached error header"> + {{ctx.Locale.Tr "repo.settings.danger_zone"}} + </h4> + <div class="ui attached error danger segment"> + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "packages.settings.delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "packages.settings.delete.description"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-package-modal">{{ctx.Locale.Tr "packages.settings.delete"}}</button> + </div> + <div class="ui tiny modal" id="delete-package-modal"> + <div class="header"> + {{ctx.Locale.Tr "packages.settings.delete"}} + </div> + <div class="content"> + <div class="ui warning message tw-break-anywhere"> + {{ctx.Locale.Tr "packages.settings.delete.notice" .PackageDescriptor.Package.Name .PackageDescriptor.Version.Version}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete"> + {{template "base/modal_actions_confirm" .}} + </form> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/package/shared/cargo.tmpl b/templates/package/shared/cargo.tmpl new file mode 100644 index 00000000..5b0f6396 --- /dev/null +++ b/templates/package/shared/cargo.tmpl @@ -0,0 +1,27 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.cargo.title"}} +</h4> +<div class="ui attached segment"> + <div class="ui form"> + {{if .CargoIndexExists}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cargo.rebuild.description"}}</label> + </div> + <form class="field" action="{{.Link}}/cargo/rebuild" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.cargo.rebuild"}}</button> + </form> + {{else}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cargo.initialize.description"}}</label> + </div> + <form class="field" action="{{.Link}}/cargo/initialize" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.cargo.initialize"}}</button> + </form> + {{end}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Cargo" "https://forgejo.org/docs/latest/user/packages/cargo/"}}</label> + </div> + </div> +</div> diff --git a/templates/package/shared/cleanup_rules/edit.tmpl b/templates/package/shared/cleanup_rules/edit.tmpl new file mode 100644 index 00000000..138a9079 --- /dev/null +++ b/templates/package/shared/cleanup_rules/edit.tmpl @@ -0,0 +1,73 @@ +<h4 class="ui top attached header">{{if .IsEditRule}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.edit"}}{{else}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.add"}}{{end}}</h4> +<div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input name="id" type="hidden" value="{{.CleanupRule.ID}}"> + <div class="field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "enabled"}}</label> + <input type="checkbox" name="enabled" {{if .CleanupRule.Enabled}}checked{{end}}> + </div> + </div> + <div class="{{if .IsEditRule}}disabled {{end}}field {{if .Err_Type}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.filter.type"}}</label> + <select class="ui selection dropdown" name="type"> + {{range $type := .AvailableTypes}} + <option{{if eq $.CleanupRule.Type $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + </div> + <div class="field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.pattern_full_match"}}</label> + <input type="checkbox" name="match_full_name" {{if .CleanupRule.MatchFullName}}checked{{end}}> + </div> + </div> + <div class="divider"></div> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.title"}}</p> + <div class="field {{if .Err_KeepCount}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</label> + <select class="ui selection dropdown" name="keep_count"> + <option{{if eq .CleanupRule.KeepCount 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.KeepCount 1}} selected="selected"{{end}} value="1">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}</option> + <option{{if eq .CleanupRule.KeepCount 5}} selected="selected"{{end}} value="5">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 5}}</option> + <option{{if eq .CleanupRule.KeepCount 10}} selected="selected"{{end}} value="10">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 10}}</option> + <option{{if eq .CleanupRule.KeepCount 25}} selected="selected"{{end}} value="25">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 25}}</option> + <option{{if eq .CleanupRule.KeepCount 50}} selected="selected"{{end}} value="50">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 50}}</option> + <option{{if eq .CleanupRule.KeepCount 100}} selected="selected"{{end}} value="100">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 100}}</option> + </select> + </div> + <div class="field {{if .Err_KeepPattern}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</label> + <input name="keep_pattern" type="text" value="{{.CleanupRule.KeepPattern}}"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern.container"}}</p> + </div> + <div class="divider"></div> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.title"}}</p> + <div class="field {{if .Err_RemoveDays}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</label> + <select class="ui selection dropdown" name="remove_days"> + <option{{if eq .CleanupRule.RemoveDays 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.RemoveDays 7}} selected="selected"{{end}} value="7">{{ctx.Locale.Tr "tool.days" 7}}</option> + <option{{if eq .CleanupRule.RemoveDays 14}} selected="selected"{{end}} value="14">{{ctx.Locale.Tr "tool.days" 14}}</option> + <option{{if eq .CleanupRule.RemoveDays 30}} selected="selected"{{end}} value="30">{{ctx.Locale.Tr "tool.days" 30}}</option> + <option{{if eq .CleanupRule.RemoveDays 60}} selected="selected"{{end}} value="60">{{ctx.Locale.Tr "tool.days" 60}}</option> + <option{{if eq .CleanupRule.RemoveDays 90}} selected="selected"{{end}} value="90">{{ctx.Locale.Tr "tool.days" 90}}</option> + <option{{if eq .CleanupRule.RemoveDays 180}} selected="selected"{{end}} value="180">{{ctx.Locale.Tr "tool.days" 180}}</option> + </select> + </div> + <div class="field {{if .Err_RemovePattern}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</label> + <input name="remove_pattern" type="text" value="{{.CleanupRule.RemovePattern}}"> + </div> + <div class="field"> + {{if .IsEditRule}} + <button class="ui primary button" name="action" value="save">{{ctx.Locale.Tr "save"}}</button> + <button class="ui red button" name="action" value="remove">{{ctx.Locale.Tr "remove"}}</button> + <a class="ui button" href="{{.Link}}/preview">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + {{else}} + <button class="ui primary button" name="action" value="save">{{ctx.Locale.Tr "add"}}</button> + {{end}} + </div> + </form> +</div> diff --git a/templates/package/shared/cleanup_rules/list.tmpl b/templates/package/shared/cleanup_rules/list.tmpl new file mode 100644 index 00000000..ba1683b9 --- /dev/null +++ b/templates/package/shared/cleanup_rules/list.tmpl @@ -0,0 +1,56 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.cleanuprules.title"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{.Link}}/rules/add">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.add"}}</a> + </div> +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + {{range .CleanupRules}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg .Type.SVGName 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}">{{.Type.Name}}</a> + </div> + <div class="flex-item-body"> + <p>{{if .Enabled}}{{ctx.Locale.Tr "enabled"}}{{else}}{{ctx.Locale.Tr "disabled"}}{{end}}</p> + </div> + {{if .KeepCount}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</p> {{if eq .KeepCount 1}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}{{else}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" .KeepCount}}{{end}} + </div> + {{end}} + {{if .KeepPattern}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</p> {{StringUtils.EllipsisString .KeepPattern 100}} + </div> + {{end}} + {{if .RemoveDays}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</p> {{ctx.Locale.Tr "tool.days" .RemoveDays}} + </div> + {{end}} + {{if .RemovePattern}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</p> {{StringUtils.EllipsisString .RemovePattern 100}} + </div> + {{end}} + </div> + <div class="flex-item-trailing"> + <div class="ui dropdown tiny basic button"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a> + <a class="item" href="{{$.Link}}/rules/{{.ID}}/preview">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + </div> + </div> + </div> + </div> + {{else}} + <div class="item">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.none"}}</div> + {{end}} + </div> +</div> diff --git a/templates/package/shared/cleanup_rules/preview.tmpl b/templates/package/shared/cleanup_rules/preview.tmpl new file mode 100644 index 00000000..0d9c4b0d --- /dev/null +++ b/templates/package/shared/cleanup_rules/preview.tmpl @@ -0,0 +1,34 @@ +<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview.overview" (len .VersionsToRemove)}}</p> +</div> +<div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "admin.packages.type"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.name"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.version"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.creator"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.published"}}</th> + </tr> + </thead> + <tbody> + {{range .VersionsToRemove}} + <tr> + <td>{{.Package.Type.Name}}</td> + <td>{{.Package.Name}}</td> + <td><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td> + <td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td> + <td>{{ctx.Locale.TrSize .CalculateBlobSize}}</td> + <td>{{DateTime "short" .Version.CreatedUnix}}</td> + </tr> + {{else}} + <tr> + <td colspan="6">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview.none"}}</td> + </tr> + {{end}} + </tbody> + </table> +</div> diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl new file mode 100644 index 00000000..36f8bc15 --- /dev/null +++ b/templates/package/shared/list.tmpl @@ -0,0 +1,57 @@ +{{template "base/alert" .}} +{{if .HasPackages}} +<form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Query "Placeholder" (ctx.Locale.Tr "search.package_kind")}} + <select class="ui small dropdown" name="type"> + <option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option> + <option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option> + {{range $type := .AvailableTypes}} + <option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + {{template "shared/search/button"}} + </div> +</form> +{{end}} +<div> + {{range .PackageDescriptors}} + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a href="{{.VersionWebLink}}">{{.Package.Name}}</a> + <span class="ui label">{{svg .Package.Type.SVGName 16}} {{.Package.Type.Name}}</span> + </div> + <div class="flex-item-body"> + {{$timeStr := TimeSinceUnix .Version.CreatedUnix ctx.Locale}} + {{$hasRepositoryAccess := false}} + {{if .Repository}} + {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}} + {{end}} + {{if $hasRepositoryAccess}} + {{ctx.Locale.Tr "packages.published_by_in" $timeStr .Creator.HomeLink .Creator.GetDisplayName .Repository.Link .Repository.FullName}} + {{else}} + {{ctx.Locale.Tr "packages.published_by" $timeStr .Creator.HomeLink .Creator.GetDisplayName}} + {{end}} + </div> + </div> + </div> + </div> + {{else}} + {{if not .HasPackages}} + <div class="empty-placeholder"> + {{svg "octicon-package" 48}} + <h2>{{ctx.Locale.Tr "packages.empty"}}</h2> + {{if and .Repository .CanWritePackages}} + {{$packagesUrl := URLJoin .Owner.HomeLink "-" "packages"}} + <p>{{ctx.Locale.Tr "packages.empty.repo" $packagesUrl}}</p> + {{end}} + <p>{{ctx.Locale.Tr "packages.empty.documentation" "https://forgejo.org/docs/latest/user/packages/"}}</p> + </div> + {{else}} + <p class="tw-py-4">{{ctx.Locale.Tr "packages.filter.no_result"}}</p> + {{end}} + {{end}} + {{template "base/paginate" .}} +</div> diff --git a/templates/package/shared/versionlist.tmpl b/templates/package/shared/versionlist.tmpl new file mode 100644 index 00000000..e5c568e0 --- /dev/null +++ b/templates/package/shared/versionlist.tmpl @@ -0,0 +1,37 @@ +<p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{ctx.Locale.Tr "packages.versions"}}</strong></p> +<form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Query "Placeholder" (ctx.Locale.Tr "search.package_kind")}} + <select class="ui small dropdown" name="sort"> + <option value="version_asc"{{if eq .Sort "version_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.asc"}}</option> + <option value="version_desc"{{if eq .Sort "version_desc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.desc"}}</option> + <option value="created_asc"{{if eq .Sort "created_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</option> + <option value="created_desc"{{if or (eq .Sort "") (eq .Sort "created_desc")}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</option> + </select> + {{if eq .PackageDescriptor.Package.Type "container"}} + <select class="ui small dropdown" name="tagged"> + {{$isTagged := or (eq .Tagged "") (eq .Tagged "tagged")}} + <option value="tagged"{{if $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.tagged"}}</option> + <option value="untagged"{{if not $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.untagged"}}</option> + </select> + {{end}} + {{template "shared/search/button"}} + </div> +</form> +<div> + {{range .PackageDescriptors}} + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-main"> + <a class="flex-item-title" href="{{.VersionWebLink}}">{{.Version.LowerVersion}}</a> + <div class="flex-item-body"> + {{ctx.Locale.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix ctx.Locale) .Creator.HomeLink .Creator.GetDisplayName}} + </div> + </div> + </div> + </div> + {{else}} + <p class="tw-py-4">{{ctx.Locale.Tr "packages.filter.no_result"}}</p> + {{end}} + {{template "base/paginate" .}} +</div> diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl new file mode 100644 index 00000000..1d87f4d3 --- /dev/null +++ b/templates/package/view.tmpl @@ -0,0 +1,114 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository view issue packages"> + {{template "shared/user/org_profile_avatar" .}} + <div class="ui container"> + {{template "user/overview/header" .}} + <div class="issue-title-header"> + <div class="issue-title"> + <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> + </div> + <div> + {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}} + {{if .HasRepositoryAccess}} + {{ctx.Locale.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName .PackageDescriptor.Repository.Link .PackageDescriptor.Repository.FullName}} + {{else}} + {{ctx.Locale.Tr "packages.published_by" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName}} + {{end}} + </div> + </div> + <div class="issue-content"> + <div class="issue-content-left"> + {{template "package/content/alpine" .}} + {{template "package/content/cargo" .}} + {{template "package/content/chef" .}} + {{template "package/content/composer" .}} + {{template "package/content/conan" .}} + {{template "package/content/conda" .}} + {{template "package/content/container" .}} + {{template "package/content/cran" .}} + {{template "package/content/debian" .}} + {{template "package/content/generic" .}} + {{template "package/content/go" .}} + {{template "package/content/helm" .}} + {{template "package/content/maven" .}} + {{template "package/content/npm" .}} + {{template "package/content/nuget" .}} + {{template "package/content/pub" .}} + {{template "package/content/pypi" .}} + {{template "package/content/rpm" .}} + {{template "package/content/rubygems" .}} + {{template "package/content/swift" .}} + {{template "package/content/vagrant" .}} + </div> + <div class="issue-content-right ui segment"> + <strong>{{ctx.Locale.Tr "packages.details"}}</strong> + <div class="ui relaxed list"> + <div class="item">{{svg .PackageDescriptor.Package.Type.SVGName 16 "tw-mr-2"}} {{.PackageDescriptor.Package.Type.Name}}</div> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-repo" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Repository.Link}}">{{.PackageDescriptor.Repository.FullName}}</a></div> + {{end}} + <div class="item">{{svg "octicon-calendar" 16 "tw-mr-2"}} {{TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}}</div> + <div class="item">{{svg "octicon-download" 16 "tw-mr-2"}} {{.PackageDescriptor.Version.DownloadCount}}</div> + {{template "package/metadata/alpine" .}} + {{template "package/metadata/cargo" .}} + {{template "package/metadata/chef" .}} + {{template "package/metadata/composer" .}} + {{template "package/metadata/conan" .}} + {{template "package/metadata/conda" .}} + {{template "package/metadata/container" .}} + {{template "package/metadata/cran" .}} + {{template "package/metadata/debian" .}} + {{template "package/metadata/generic" .}} + {{template "package/metadata/helm" .}} + {{template "package/metadata/maven" .}} + {{template "package/metadata/npm" .}} + {{template "package/metadata/nuget" .}} + {{template "package/metadata/pub" .}} + {{template "package/metadata/pypi" .}} + {{template "package/metadata/rpm" .}} + {{template "package/metadata/rubygems" .}} + {{template "package/metadata/swift" .}} + {{template "package/metadata/vagrant" .}} + {{if not (and (eq .PackageDescriptor.Package.Type "container") .PackageDescriptor.Metadata.Manifests)}} + <div class="item">{{svg "octicon-database" 16 "tw-mr-2"}} {{ctx.Locale.TrSize .PackageDescriptor.CalculateBlobSize}}</div> + {{end}} + </div> + {{if not (eq .PackageDescriptor.Package.Type "container")}} + <div class="divider"></div> + <strong>{{ctx.Locale.Tr "packages.assets"}} ({{len .PackageDescriptor.Files}})</strong> + <div class="ui relaxed list"> + {{range .PackageDescriptor.Files}} + <div class="item"> + <a href="{{$.Link}}/files/{{.File.ID}}">{{.File.Name}}</a> + <span class="text small file-size">{{ctx.Locale.TrSize .Blob.Size}}</span> + </div> + {{end}} + </div> + {{end}} + <div class="divider"></div> + <strong>{{ctx.Locale.Tr "packages.versions"}} ({{.TotalVersionCount}})</strong> + <a class="tw-float-right" href="{{$.PackageDescriptor.PackageWebLink}}/versions">{{ctx.Locale.Tr "packages.versions.view_all"}}</a> + <div class="ui relaxed list"> + {{range .LatestVersions}} + <div class="item tw-flex"> + <a class="tw-flex-1 gt-ellipsis" title="{{.Version}}" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a> + <span class="text small">{{DateTime "short" .CreatedUnix}}</span> + </div> + {{end}} + </div> + {{if or .CanWritePackages .HasRepositoryAccess}} + <div class="divider"></div> + <div class="ui relaxed list"> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-issue-opened" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Repository.Link}}/issues">{{ctx.Locale.Tr "repo.issues"}}</a></div> + {{end}} + {{if .CanWritePackages}} + <div class="item">{{svg "octicon-tools" 16 "tw-mr-2"}} <a href="{{.Link}}/settings">{{ctx.Locale.Tr "repo.settings"}}</a></div> + {{end}} + </div> + {{end}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} |