aurweb/templates/partials/packages/details.html
Kevin Morris 4ade8b0539 routers.packages: Simplify some existence checks
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-09 23:42:54 -07:00

145 lines
5 KiB
HTML

{% set pkg = pkgbase.packages.first() %}
<table id="pkginfo">
<tr>
<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" | 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>
{% if show_package_details | default(False) %}
<tr>
<th>{{ "Package Base" | tr }}:</th>
<td class="wrap">
<a href="/pkgbase/{{ pkgbase.Name }}">
{{ pkgbase.Name }}
</a>
</td>
</tr>
<tr>
<th>{{ "Description" | tr }}:</th>
<td class="wrap">{{ pkg.Description }}</td>
</tr>
<tr>
<th>{{ "Upstream URL" | tr }}:</th>
<td class="wrap">
{% if pkg.URL %}
<a href="{{ pkg.URL }}">{{ pkg.URL }}</a>
{% else %}
{{ "None" | tr }}
{% endif %}
</td>
</tr>
{% endif %}
{% if pkgbase.keywords.scalar() %}
<tr>
<th>{{ "Keywords" | tr }}:</th>
{% if is_maintainer %}
<td>
<form method="update"
action="/pkgbase/{{ pkgbase.Name }}/keywords/"
>
<div>
<input type="text"
name="keywords"
value="{{ pkgbase.keywords | join(' ', attribute='Keyword') }}"
/>
<input type="submit" value="{{ 'Update' | tr }}"/>
</div>
</form>
</td>
{% else %}
<td>
{% for keyword in pkgbase.keywords %}
<a class="keyword"
href="/packages/?K={{ keyword.Keyword }}&amp;SB=p"
>
{{ keyword.Keyword }}
</a>
{% endfor %}
</td>
{% endif %}
</tr>
{% endif %}
{% if licenses and licenses.scalar() and show_package_details %}
<tr>
<th>{{ "Licenses" | tr }}:</th>
<td>{{ licenses | join(', ', attribute='Name') | default('None' | tr) }} </td>
</tr>
{% endif %}
{% if show_package_details %}
<tr>
<th>{{ "Conflicts" | tr }}:</th>
<td class="wrap">
{{ conflicts | join(', ', attribute='RelName') }}
</td>
</tr>
{% endif %}
<tr>
<th>{{ "Submitter" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
<a href="/account/{{ pkgbase.Submitter.Username }}">
{{ pkgbase.Submitter.Username | default("None" | tr) }}
</a>
{% else %}
{{ pkgbase.Submitter.Username | default("None" | tr) }}
{% endif %}
</td>
</tr>
<tr>
<th>{{ "Maintainer" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
<a href="/account/{{ pkgbase.Maintainer.Username }}">
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
</a>
{% else %}
{{ pkgbase.Maintainer.Username | default("None" | tr) }}
{% endif %}
</td>
</tr>
<tr>
<th>{{ "Last Packager" | tr }}:</th>
<td>
{% if request.user.is_authenticated() %}
<a href="/account/{{ pkgbase.Packager.Username }}">
{{ pkgbase.Packager.Username | default("None" | tr) }}
</a>
{% else %}
{{ pkgbase.Packager.Username | default("None" | tr) }}
{% endif %}
</td>
</tr>
<tr>
<th>{{ "Votes" | tr }}:</th>
{% if not is_maintainer %}
<td>{{ pkgbase.package_votes.count() }}</td>
{% else %}
<td>
<a href="/pkgbase/{{ pkgbase.Name }}/voters">
{{ pkgbase.package_votes.count() }}
</a>
</td>
{% endif %}
</tr>
<tr>
<th>{{ "Popularity" | tr }}:</th>
<td>{{ pkgbase.Popularity | number_format(6 if pkgbase.Popularity <= 0.2 else 2) }}</td>
</tr>
<tr>
{% set submitted = pkgbase.SubmittedTS | dt | as_timezone(timezone) %}
<th>{{ "First Submitted" | tr }}:</th>
<td>{{ "%s" | format(submitted.strftime("%Y-%m-%d %H:%M")) }}</td>
</tr>
<tr>
<th>{{ "Last Updated" | tr }}:</th>
{% set updated = pkgbase.ModifiedTS | dt | as_timezone(timezone) %}
<td>{{ "%s" | format(updated.strftime("%Y-%m-%d %H:%M")) }}</td>
</tr>
</table>
<script type="text/javascript" src="/static/js/copy.js"></script>