mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
implement /packages/{name} as its own route
A few things added with this commit: - aurweb.packages.util - A module providing package and pkgbase helpers. - aurweb.template.register_filter - A decorator that can be used to register a filter: @register_filter("some_filter") def f(): pass Additionally, template partials have been split off a bit differently. Changes: - /packages/{name} is defined in packages/show.html. - partials/packages/package_actions.html is now partials/packages/actions.html. - partials/packages/details.html has been added. - partials/packages/comments.html has been added. - partials/packages/comment.html has been added. - models.dependency_type additions: name and id constants. - models.relation_type additions: name and id constants. - models.official_provider additions: base official url constant. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
2d3d03e01e
commit
ae3d302c47
22 changed files with 1166 additions and 254 deletions
145
templates/partials/packages/details.html
Normal file
145
templates/partials/packages/details.html
Normal file
|
@ -0,0 +1,145 @@
|
|||
<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">{{ pkgbase.packages.first().Description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ "Upstream URL" | tr }}:</th>
|
||||
<td class="wrap">
|
||||
{% set pkg = pkgbase.packages.first() %}
|
||||
{% if pkg.URL %}
|
||||
<a href="{{ pkg.URL }}">{{ pkg.URL }}</a>
|
||||
{% else %}
|
||||
{{ "None" | tr }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if pkgbase.keywords.count() %}
|
||||
<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 }}&SB=p"
|
||||
>
|
||||
{{ keyword.Keyword }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if licenses and licenses.count() and show_package_details | default(False) %}
|
||||
<tr>
|
||||
<th>{{ "Licenses" | tr }}:</th>
|
||||
<td>{{ licenses | join(', ', attribute='Name') | default('None' | tr) }} </td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if show_package_details | default(False) %}
|
||||
<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>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue