aboutsummaryrefslogtreecommitdiffstats
path: root/templates/package
diff options
context:
space:
mode:
Diffstat (limited to 'templates/package')
-rw-r--r--templates/package/content/cargo.tmpl62
-rw-r--r--templates/package/metadata/cargo.tmpl7
-rw-r--r--templates/package/shared/cargo.tmpl24
-rw-r--r--templates/package/view.tmpl2
4 files changed, 95 insertions, 0 deletions
diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl
new file mode 100644
index 0000000000..54c40a5b0d
--- /dev/null
+++ b/templates/package/content/cargo.tmpl
@@ -0,0 +1,62 @@
+{{if eq .PackageDescriptor.Package.Type "cargo"}}
+ <h4 class="ui top attached header">{{.locale.Tr "packages.installation"}}</h4>
+ <div class="ui attached segment">
+ <div class="ui form">
+ <div class="field">
+ <label>{{svg "octicon-code"}} {{.locale.Tr "packages.cargo.registry" | Safe}}</label>
+ <div class="markup"><pre class="code-block"><code>[registry]
+default = "gitea"
+
+[registries.gitea]
+index = "{{AppUrl}}{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"
+
+[net]
+git-fetch-with-cli = true</code></pre></div>
+ </div>
+ <div class="field">
+ <label>{{svg "octicon-terminal"}} {{.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>{{.locale.Tr "packages.cargo.documentation" | Safe}}</label>
+ </div>
+ </div>
+ </div>
+
+ {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}}
+ <h4 class="ui top attached header">{{.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 .PackageDescriptor.Metadata.Readme}}</div>{{end}}
+ {{end}}
+
+ {{if .PackageDescriptor.Metadata.Dependencies}}
+ <h4 class="ui top attached header">{{.locale.Tr "packages.dependencies"}}</h4>
+ <div class="ui attached segment">
+ <table class="ui single line very basic table">
+ <thead>
+ <tr>
+ <th class="ten wide">{{.locale.Tr "packages.dependency.id"}}</th>
+ <th class="six wide">{{.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">{{.locale.Tr "packages.keywords"}}</h4>
+ <div class="ui attached segment">
+ {{range .PackageDescriptor.Metadata.Keywords}}
+ {{.}}
+ {{end}}
+ </div>
+ {{end}}
+{{end}}
diff --git a/templates/package/metadata/cargo.tmpl b/templates/package/metadata/cargo.tmpl
new file mode 100644
index 0000000000..68232d4832
--- /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="{{$.locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.}}</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">{{.locale.Tr "packages.details.project_site"}}</a></div>{{end}}
+ {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{.locale.Tr "packages.cargo.details.repository_site"}}</a></div>{{end}}
+ {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{.locale.Tr "packages.cargo.details.documentation_site"}}</a></div>{{end}}
+ {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{$.locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "mr-3"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}}
+{{end}}
diff --git a/templates/package/shared/cargo.tmpl b/templates/package/shared/cargo.tmpl
new file mode 100644
index 0000000000..b9c2ef4d2b
--- /dev/null
+++ b/templates/package/shared/cargo.tmpl
@@ -0,0 +1,24 @@
+<h4 class="ui top attached header">
+ {{.locale.Tr "packages.owner.settings.cargo.title"}}
+</h4>
+<div class="ui attached segment">
+ <div class="ui form">
+ <div class="field">
+ <label>{{$.locale.Tr "packages.owner.settings.cargo.initialize.description"}}</label>
+ </div>
+ <form class="field" action="{{.Link}}/cargo/initialize" method="post">
+ {{.CsrfTokenHtml}}
+ <button class="ui green button">{{$.locale.Tr "packages.owner.settings.cargo.initialize"}}</button>
+ </form>
+ <div class="field">
+ <label>{{$.locale.Tr "packages.owner.settings.cargo.rebuild.description"}}</label>
+ </div>
+ <form class="field" action="{{.Link}}/cargo/rebuild" method="post">
+ {{.CsrfTokenHtml}}
+ <button class="ui green button">{{$.locale.Tr "packages.owner.settings.cargo.rebuild"}}</button>
+ </form>
+ <div class="field">
+ <label>{{.locale.Tr "packages.cargo.documentation" | Safe}}</label>
+ </div>
+ </div>
+</div>
diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl
index 4611cdb8d8..6209e6cb02 100644
--- a/templates/package/view.tmpl
+++ b/templates/package/view.tmpl
@@ -19,6 +19,7 @@
<div class="ui divider"></div>
</div>
<div class="twelve wide column">
+ {{template "package/content/cargo" .}}
{{template "package/content/composer" .}}
{{template "package/content/conan" .}}
{{template "package/content/conda" .}}
@@ -43,6 +44,7 @@
{{end}}
<div class="item">{{svg "octicon-calendar" 16 "mr-3"}} {{TimeSinceUnix .PackageDescriptor.Version.CreatedUnix $.locale}}</div>
<div class="item">{{svg "octicon-download" 16 "mr-3"}} {{.PackageDescriptor.Version.DownloadCount}}</div>
+ {{template "package/metadata/cargo" .}}
{{template "package/metadata/composer" .}}
{{template "package/metadata/conan" .}}
{{template "package/metadata/conda" .}}