fix(fastapi): hide keywords when there are none or they can't be edited

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-11 18:13:21 -08:00
parent 363afff332
commit 20f5519b99
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -33,34 +33,36 @@
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
<tr> {% if pkgbase.keywords.count() or request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %}
<th>{{ "Keywords" | tr }}:</th> <tr>
{% if request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %} <th>{{ "Keywords" | tr }}:</th>
<td> {% if request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %}
<form method="post" <td>
action="/pkgbase/{{ pkgbase.Name }}/keywords" <form method="post"
> 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.all() %}
<a class="keyword"
href="/packages/?K={{ keyword.Keyword }}&amp;SB=p"
> >
{{ keyword.Keyword }} <div>
</a> <input type="text"
{% endfor %} name="keywords"
</td> value="{{ pkgbase.keywords | join(' ', attribute='Keyword') }}"
{% endif %} />
</tr> <input type="submit" value="{{ 'Update' | tr }}"/>
</div>
</form>
</td>
{% else %}
<td>
{% for keyword in pkgbase.keywords.all() %}
<a class="keyword"
href="/packages/?K={{ keyword.Keyword }}&amp;SB=p"
>
{{ keyword.Keyword }}
</a>
{% endfor %}
</td>
{% endif %}
</tr>
{% endif %}
{% if licenses and licenses.count() and show_package_details %} {% if licenses and licenses.count() and show_package_details %}
<tr> <tr>
<th>{{ "Licenses" | tr }}:</th> <th>{{ "Licenses" | tr }}:</th>