mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
With this change, we've decoupled some partials shared between `/pkgbase/{name}` and `/account/{username}/comments`. The comment actions template now resolves its package base via the `comment` instance instead of requiring `pkgbase`. We've also modified the existing package comment routes to support execution from any location using the `next` parameter. This allows us to reuse code from package comments for account comments actions. Moved the majority of comment editing javascript to its own .js file. Signed-off-by: Kevin Morris <kevr@0cost.org>
43 lines
1.5 KiB
HTML
43 lines
1.5 KiB
HTML
{% set header_cls = "comment-header" %}
|
|
{% set article_cls = "article-content" %}
|
|
{% if comment.Deleter %}
|
|
{% set header_cls = "%s %s" | format(header_cls, "comment-deleted") %}
|
|
{% set article_cls = "%s %s" | format(article_cls, "comment-deleted") %}
|
|
{% endif %}
|
|
|
|
{% if not comment.Deleter or request.user.has_credential("CRED_COMMENT_VIEW_DELETED", approved=[comment.Deleter]) %}
|
|
<h4 id="comment-{{ comment.ID }}" class="{{ header_cls }}">
|
|
{% 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
|
|
)) if request.user.is_authenticated() else
|
|
(comment.User.Username),
|
|
'<a href="#comment-%s" class="date">%s</a>' | format(
|
|
comment.ID,
|
|
commented_at.strftime("%Y-%m-%d %H:%M")
|
|
)
|
|
)
|
|
| safe
|
|
}}
|
|
{% if comment.Editor %}
|
|
{% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %}
|
|
<span class="edited">
|
|
({{ "edited on %s by %s" | tr
|
|
| format(edited_on.strftime('%Y-%m-%d %H:%M'),
|
|
'<a href="/account/%s">%s</a>' | format(
|
|
comment.Editor.Username, comment.Editor.Username))
|
|
| safe
|
|
}})
|
|
</span>
|
|
{% endif %}
|
|
|
|
{% include "partials/comment_actions.html" %}
|
|
</h4>
|
|
|
|
{% include "partials/comment_content.html" %}
|
|
{% endif %}
|