mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
1e1c0c3fe5
commit
2d3d03e01e
5 changed files with 155 additions and 75 deletions
|
@ -28,6 +28,8 @@ async def package_base(request: Request, package: str):
|
|||
context["packages_count"] = package.packages.count()
|
||||
context["keywords"] = package.keywords.all()
|
||||
context["comments"] = package.comments.all()
|
||||
context["is_maintainer"] = request.user.is_authenticated() \
|
||||
and request.user.Username == package.Maintainer.Username
|
||||
|
||||
return render_template(request, "pkgbase.html", context)
|
||||
|
||||
|
|
|
@ -14,18 +14,23 @@
|
|||
<input type="hidden" name="ID" value="{{ pkgbase_id }}"/>
|
||||
</div>
|
||||
<p>
|
||||
Git commit identifiers referencing commits in the AUR package
|
||||
repository and URLs are converted to links automatically.
|
||||
<a href="https://daringfireball.net/projects/markdown/syntax">
|
||||
Markdown syntax
|
||||
</a>
|
||||
is partially supported.
|
||||
{{
|
||||
"Git commit identifiers referencing commits in the AUR package"
|
||||
" repository and URLs are converted to links automatically."
|
||||
| tr
|
||||
}}
|
||||
{{
|
||||
"%sMarkdown Syntax%s is partially supported."
|
||||
| tr
|
||||
| format('<a href="https://daringfireball.net/projects/markdown/syntax">', '</a>')
|
||||
| safe
|
||||
}}
|
||||
</p>
|
||||
<p>
|
||||
<textarea id="id_comment" name="comment" cols="80" rows="10"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Add Comment"/>
|
||||
<input type="submit" value="{{ 'Add Comment' | tr }}"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
@ -34,22 +39,35 @@
|
|||
<div class="comments package-comments">
|
||||
<div class="comments-header">
|
||||
<h3>
|
||||
<span class="text">Latest Comments</span>
|
||||
<span class="text">{{ "Latest Comments" | tr }}</span>
|
||||
<span class="arrow"></span>
|
||||
</h3>
|
||||
</div>
|
||||
{% for comment in comments %}
|
||||
<h4 id="comment-{{ comment.ID }}" class="comment-header">
|
||||
{% set commentTimestamp = comment.CommentTS | dt | as_timezone(timezone) %}
|
||||
<a href="/account/{{ comment.User.Username }}" title="View account information for {{ comment.User.Username }}">{{ comment.User.Username }}</a>
|
||||
commented on <a href="#comment-{{ comment.ID }}" class="date">{{ "%s" | tr | format(commentTimestamp.strftime("%Y-%m-%d %H:%M")) }}</a>
|
||||
{% if request.user.is_authenticated() and pkgbase.Maintainer.Username == request.user.Username %}
|
||||
{% set commented_at = comment.CommentTS | dt | as_timezone(timezone) %}
|
||||
{% set view_account_info = 'View account information for %s' | tr | format(comment.User.Username) %}
|
||||
{{
|
||||
"%s commented on %s" | tr | format(
|
||||
'<a href="/account/%s" title="%s">%s</a>' | format(
|
||||
comment.User.Username,
|
||||
view_account_info,
|
||||
comment.User.Username
|
||||
),
|
||||
'<a href="#comment-%s" class="date">%s</a>' | format(
|
||||
comment.ID,
|
||||
commented_at.strftime("%Y-%m-%d %H:%M")
|
||||
)
|
||||
)
|
||||
| safe
|
||||
}}
|
||||
{% if is_maintainer %}
|
||||
<form class="delete-comment-form" method="post" action="/pkgbase/{{ pkgname }}/">
|
||||
<fieldset style="display:inline;">
|
||||
<input type="hidden" name="action" value="do_DeleteComment" />
|
||||
<input type="hidden" name="comment_id" value="{{ comment.ID }}"/>
|
||||
<input type="hidden" name="return_to" value="/pkgbase/{{ pkgname }}/"/>
|
||||
<input type="image" class="delete-comment" src="/images/x.min.svg" width="11" height="11" alt="Delete comment" title="Delete comment" name="submit" value="1" />
|
||||
<input type="image" class="delete-comment" src="/images/x.min.svg" width="11" height="11" alt="{{ 'Delete comment' | tr }}" title="{{ 'Delete comment' | tr }}" name="submit" value="1" />
|
||||
</fieldset>
|
||||
</form>
|
||||
<a href="/pkgbase/{{ pkgname }}/edit-comment/?comment_id={{ comment.ID }}" class="edit-comment" title="Edit comment"><img src="/images/pencil.min.svg" alt="Edit comment" width="11" height="11"></a>
|
||||
|
@ -60,13 +78,13 @@
|
|||
<input type="hidden" name="comment_id" value="{{ comment.ID }}"/>
|
||||
<input type="hidden" name="package_base" value="{{ pkgbase_id }}"/>
|
||||
<input type="hidden" name="return_to" value="/pkgbase/{{ pkgname }}/"/>
|
||||
<input type="image" class="pin-comment" src="/images/pin.min.svg" width="11" height="11" alt="Pin comment" title="Pin comment" name="submit" value="1"/>
|
||||
<input type="image" class="pin-comment" src="/images/pin.min.svg" width="11" height="11" alt="{{ 'Pin comment' | tr }}" title="{{ 'Pin comment' | tr }}" name="submit" value="1"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
</h4>
|
||||
<div id="comment-{{ comment.ID }}-content" class="article-content">
|
||||
<div>
|
||||
<p>{{ comment.Comments }}</p>
|
||||
<p>{{ comment.RenderedComment | safe }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -3,31 +3,85 @@
|
|||
-->
|
||||
<div id="detailslinks" class="listing">
|
||||
<div id="actionlist">
|
||||
<h4>Package Actions</h4>
|
||||
<h4>{{ "Package Actions" | tr }}</h4>
|
||||
<ul class="small">
|
||||
<li>
|
||||
<a href="/cgit/aur.git/tree/PKGBUILD?h={{ pkgname }}">View PKGBUILD</a> /
|
||||
<a href="/cgit/aur.git/log/?h={{ pkgname }}">View Changes</a>
|
||||
<a href="/cgit/aur.git/tree/PKGBUILD?h={{ pkgname }}">
|
||||
{{ "View PKGBUILD" | tr }}
|
||||
</a>
|
||||
/
|
||||
<a href="/cgit/aur.git/log/?h={{ pkgname }}">
|
||||
{{ "View Changes" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/cgit/aur.git/snapshot/{{ pkgname }}.tar.gz">
|
||||
{{ "Download snapshot" | tr }}
|
||||
</a>
|
||||
<li>
|
||||
<a href="https://wiki.archlinux.org/title/Special:Search?search={{ pkgname }}">
|
||||
{{ "Search wiki" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
<li><a href="/cgit/aur.git/snapshot/{{ pkgname }}.tar.gz">Download snapshot</a>
|
||||
<li><a href="https://wiki.archlinux.org/title/Special:Search?search={{ pkgname }}">Search wiki</a></li>
|
||||
<li><span class="flagged"></span></li>
|
||||
<li><a href="/pkgbase/{{ pkgname }}/flag/">Flag package out-of-date</a></li>
|
||||
<li>
|
||||
<form action="/pkgbase/{{ pkgname }}/vote/" method="post"><input type="submit" class="button text-button" name="do_Vote" value="Vote for this package"/></form>
|
||||
<a href="/pkgbase/{{ pkgname }}/flag/">
|
||||
{{ "Flag package out-of-date" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<form action="/pkgbase/{{ pkgname }}/unnotify/" method="post"><input type="submit" class="button text-button" name="do_UnNotify" value="Disable notifications"/>
|
||||
<form action="/pkgbase/{{ pkgname }}/vote/" method="post">
|
||||
<input type="submit"
|
||||
class="button text-button"
|
||||
name="do_Vote"
|
||||
value="{{ 'Vote for this package' | tr }}" />
|
||||
</form>
|
||||
</li>
|
||||
<li><a href="/pkgbase/{{ pkgname }}/comaintainers/">Manage Co-Maintainers</a></li>
|
||||
<li><span class="flagged"></span></li>
|
||||
<li><a href="/pkgbase/{{ pkgname }}/request/">Submit Request</a></li>
|
||||
<li><a href="/pkgbase/{{ pkgname }}/delete/">Delete Package</a></li>
|
||||
<li><a href="/pkgbase/{{ pkgname }}/merge/">Merge Package</a></li>
|
||||
<li>
|
||||
<form action="/pkgbase/{{ pkgname }}/disown/" method="post"><input type="submit" class="button text-button" name="do_Disown" value="Disown Package"/></form>
|
||||
<form action="/pkgbase/{{ pkgname }}/unnotify/" method="post">
|
||||
<input type="submit"
|
||||
class="button text-button"
|
||||
name="do_UnNotify"
|
||||
value="{{ 'Disable notifications' | tr }}"
|
||||
/>
|
||||
</form>
|
||||
</li>
|
||||
{% if is_maintainer %}
|
||||
<li>
|
||||
<a href="/pkgbase/{{ pkgname }}/comaintainers/">
|
||||
{{ "Manage Co-Maintainers" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li><span class="flagged"></span></li>
|
||||
{% if request.user.is_authenticated() %}
|
||||
<li>
|
||||
<a href="/pkgbase/{{ pkgname }}/request/">
|
||||
{{ "Submit Request" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_maintainer %}
|
||||
<li>
|
||||
<a href="/pkgbase/{{ pkgname }}/delete/">
|
||||
{{ "Delete Package" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/pkgbase/{{ pkgname }}/merge/">
|
||||
{{ "Merge Package" | tr }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<form action="/pkgbase/{{ pkgname }}/disown/" method="post">
|
||||
<input type="submit"
|
||||
class="button text-button"
|
||||
name="do_Disown"
|
||||
value="{{ 'Disown Package' | tr }}"
|
||||
/>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,55 +4,55 @@
|
|||
<p><input type='hidden' name='O' value='0'/></p>
|
||||
|
||||
<fieldset>
|
||||
<legend>Enter search criteria</legend>
|
||||
<legend>{{ "Enter search criteria" | tr }}</legend>
|
||||
<div>
|
||||
<label for="id_method">Search by</label>
|
||||
<label for="id_method">{{ "Search by" | tr }}</label>
|
||||
<select name='SeB'>
|
||||
<option value="nd">Name, Description</option>
|
||||
<option value="n">Name Only</option>
|
||||
<option value="b">Package Base</option>
|
||||
<option value="N">Exact Name</option>
|
||||
<option value="B">Exact Package Base</option>
|
||||
<option value="k">Keywords</option>
|
||||
<option value="m">Maintainer</option>
|
||||
<option value="c">Co-maintainer</option>
|
||||
<option value="M">Maintainer, Co-maintainer</option>
|
||||
<option value="s">Submitter</option>
|
||||
<option value="nd">{{ "Name, Description" | tr }}</option>
|
||||
<option value="n">{{ "Name Only" | tr }}</option>
|
||||
<option value="b">{{ "Package Base" | tr }}</option>
|
||||
<option value="N">{{ "Exact Name" | tr }}</option>
|
||||
<option value="B">{{ "Exact Package Base" | tr }}</option>
|
||||
<option value="k">{{ "Keywords" | tr }}</option>
|
||||
<option value="m">{{ "Maintainer" | tr }}</option>
|
||||
<option value="c">{{ "Co-maintainer" | tr }}</option>
|
||||
<option value="M">{{ "Maintainer, Co-maintainer" | tr }}</option>
|
||||
<option value="s">{{ "Submitter" | tr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_q">Keywords</label>
|
||||
<label for="id_q">{{ "Keywords" | tr }}</label>
|
||||
<input type='text' name='K' size='30' value="" maxlength='35'/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_out_of_date">Out of Date</label>
|
||||
<label for="id_out_of_date">{{ "Out of Date" | tr }}</label>
|
||||
<select name='outdated'>
|
||||
<option value=''>All</option>
|
||||
<option value='on'>Flagged</option>
|
||||
<option value='off'>Not Flagged</option>
|
||||
<option value=''>{{ "All" | tr }}</option>
|
||||
<option value='on'>{{ "Flagged" | tr }}</option>
|
||||
<option value='off'>{{ "Not Flagged" | tr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_sort_by">Sort by</label>
|
||||
<label for="id_sort_by">{{ "Sort by" | tr }}</label>
|
||||
<select name='SB'>
|
||||
<option value='n'>Name</option>
|
||||
<option value='v'>Votes</option>
|
||||
<option value='p'>Popularity</option>
|
||||
<option value='w'>Voted</option>
|
||||
<option value='o'>Notify</option>
|
||||
<option value='m'>Maintainer</option>
|
||||
<option value='l'>Last modified</option>
|
||||
<option value='n'>{{ "Name" | tr }}</option>
|
||||
<option value='v'>{{ "Votes" | tr }}</option>
|
||||
<option value='p'>{{ "Popularity" | tr }}</option>
|
||||
<option value='w'>{{ "Voted" | tr }}</option>
|
||||
<option value='o'>{{ "Notify" | tr }}</option>
|
||||
<option value='m'>{{ "Maintainer" | tr }}</option>
|
||||
<option value='l'>{{ "Last modified" | tr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_order_by">Sort order</label>
|
||||
<label for="id_order_by">{{ "Sort order" | tr }}</label>
|
||||
<select name='SO'>
|
||||
<option value='a'>Ascending</option>
|
||||
<option value='d'>Descending</option>
|
||||
<option value='a'>{{ "Ascending" | tr }}</option>
|
||||
<option value='d'>{{ "Descending" | tr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_per_page">Per page</label>
|
||||
<label for="id_per_page">{{ "Per page" | tr }}</label>
|
||||
<select name='PP'>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
|
@ -61,8 +61,8 @@
|
|||
</div>
|
||||
<div>
|
||||
<label> </label>
|
||||
<input type='submit' class='button' name='do_Search' value='Go'/>
|
||||
<input type='submit' class='button' name='do_Orphans' value='Orphans'/>
|
||||
<input type='submit' class='button' name='do_Search' value='{{ "Go" | tr }}'/>
|
||||
<input type='submit' class='button' name='do_Orphans' value='{{ "Orphans" | tr }}'/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue