templates: Translate pkgbase.html and partials

+ Include the `is_maintainer` context key.
+ Use `is_maintainer` in more locations.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-07-14 14:08:14 -07:00
parent 1e1c0c3fe5
commit 2d3d03e01e
5 changed files with 155 additions and 75 deletions

View file

@ -3,7 +3,7 @@
{% block pageContent %}
{% include "partials/packages/search.html" %}
<div id="pkgdetails" class="box">
<h2>Package Base Details: {{ pkgbase.Name }}</h2>
<h2>Package Details: {{ pkgbase.Name }}</h2>
{% set result = pkgbase %}
{% set pkgname = "result.Name" %}
@ -11,17 +11,17 @@
<table id="pkginfo">
<tr>
<th>Git Clone URL: </th>
<th>{{ "Git Clone URL" | tr }}:</th>
<td>
<a class="copy" href="{{ git_clone_uri_anon | format(pkgbase.Name) }}">{{ git_clone_uri_anon | format(pkgbase.Name) }}</a> (read-only, click to copy)
{% if request.user.is_authenticated() and pkgbase.Maintainer.Username == request.user.Username %}
<br /> <a class="copy" href="{{ git_clone_uri_priv | format(pkgbase.Name) }}">{{ git_clone_uri_priv | format(pkgbase.Name) }}</a> (click to copy)
<a class="copy" href="{{ git_clone_uri_anon | format(pkgbase.Name) }}">{{ git_clone_uri_anon | format(pkgbase.Name) }}</a> ({{ "read-only" | tr }}, {{ "click to copy" | tr }})
{% if is_maintainer %}
<br /> <a class="copy" href="{{ git_clone_uri_priv | format(pkgbase.Name) }}">{{ git_clone_uri_priv | format(pkgbase.Name) }}</a> ({{ "click to copy" | tr }})
{% endif %}
</td>
</tr>
<tr>
<th>Keywords: </th>
{% if request.user.is_authenticated() and pkgbase.Maintainer.Username == request.user.Username %}
<th>{{ "Keywords" | tr }}:</th>
{% if is_maintainer %}
<td>
<form method="post" action="/pkgbase/{{ pkgbase.Name }}/">
<div>
@ -40,32 +40,32 @@
{% endif %}
</tr>
<tr>
<th>Submitter: </th>
<th>{{ "Submitter" | tr }}:</th>
<td>{{ pkgbase.Submitter.Username | default("None") }}</td>
</tr>
<tr>
<th>Maintainer: </th>
<th>{{ "Maintainer" | tr }}:</th>
<td>{{ pkgbase.Maintainer.Username | default("None") }}</td>
</tr>
<tr>
<th>Last Packager: </th>
<th>{{ "Last Packager" | tr }}:</th>
<td>{{ pkgbase.Packager.Username | default("None") }}</td>
</tr>
<tr>
<th>Votes: </th>
<th>{{ "Votes" | tr }}:</th>
<td>{{ pkgbase.NumVotes }}</td>
</tr>
<tr>
<th>Popularity: </th>
<th>{{ "Popularity" | tr }}:</th>
<td>{{ '%0.2f' % pkgbase.Popularity | float }}</td>
</tr>
<tr>
{% set submitted = pkgbase.SubmittedTS | dt | as_timezone(timezone) %}
<th>First Submitted: </th>
<th>{{ "First Submitted" | tr }}:</th>
<td>{{ "%s" | tr | format(submitted.strftime("%Y-%m-%d %H:%M")) }}</td>
</tr>
<tr>
<th>Last Updated: </th>
<th>{{ "Last Updated" | tr }}:</th>
{% set updated = pkgbase.ModifiedTS | dt | as_timezone(timezone) %}
<td>{{ "%s" | tr | format(updated.strftime("%Y-%m-%d %H:%M")) }}</td>
</tr>
@ -73,10 +73,16 @@
<div id="metadata">
<div id="pkgs" class="listing">
<!-- This needs to be replaced with the real implementation. -->
<h3>Packages ({{ packages_count }})</h3>
<ul>
{% for result in packages %}
<li><a href="/packages/{{ result.Name }}/" title="View packages details for {{ result.Name }}">{{ result.Name }}</a></li>
<li>
<a href="/packages/{{ result.Name }}/"
title="{{ 'View packages details for' | tr }} {{ result.Name }}">
{{ result.Name }}
</a>
</li>
{% endfor %}
</ul>
</div>