You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
9.9 KiB
163 lines
9.9 KiB
{% set ctx = comment_reply_context|default(null) %} |
|
{% if ctx and ctx.can_publish|default(false) and ctx.rows|default([])|length > 0 %} |
|
{% for row in ctx.rows %} |
|
{% if row.mode|default('') == 'article' %} |
|
<div class="comment-reply comment-reply--article card"> |
|
<div class="card-body"> |
|
<h3 class="comment-reply__heading">Reply to this article</h3> |
|
<form |
|
class="comment-reply__form" |
|
data-controller="comment-reply" |
|
data-action="submit->comment-reply#publish" |
|
data-comment-reply-publish-url-value="{{ path('comment_reply_publish')|e('html_attr') }}" |
|
data-comment-reply-csrf-value="{{ csrf_token('comment_reply')|e('html_attr') }}" |
|
data-comment-reply-expected-coordinate-value="{{ ctx.coordinate|e('html_attr') }}" |
|
data-comment-reply-article-event-id-value="{{ ctx.article_event_id|default('')|e('html_attr') }}" |
|
data-comment-reply-fragment-url-value="{{ ctx.fragment_url|default('')|e('html_attr') }}" |
|
data-comment-reply-refresh-after-value="1" |
|
data-comment-reply-blurb-label-value="{{ row.blurbLabel|default('Article')|e('html_attr') }}" |
|
data-comment-reply-expected-tags-value='{{ row.expectedTags|default([])|json_encode|e('html_attr') }}' |
|
data-comment-reply-parent-kind-value="{{ row.parentKind|default(0) }}" |
|
data-comment-reply-parent-id-value="{{ row.parentId|default('')|e('html_attr') }}" |
|
data-comment-reply-author-pubkey-value="{{ row.authorPubkey|default('')|e('html_attr') }}" |
|
> |
|
<div class="comment-reply__body"> |
|
<label class="visually-hidden" for="comment-reply-article-body">Your reply</label> |
|
<textarea |
|
class="form-control" |
|
id="comment-reply-article-body" |
|
name="body" |
|
rows="4" |
|
required |
|
minlength="1" |
|
placeholder="Write a Nostr comment (kind 1111). A quoted parent line is added automatically." |
|
></textarea> |
|
</div> |
|
<div class="comment-reply__actions"> |
|
<button class="btn btn-primary" type="submit">Sign & publish</button> |
|
</div> |
|
<p class="comment-reply__hint text-subtle" data-comment-reply-target="hint" aria-live="polite"></p> |
|
</form> |
|
</div> |
|
</div> |
|
{% endif %} |
|
{% endfor %} |
|
{% endif %} |
|
|
|
<div class="comments"> |
|
{% for item in list %} |
|
{% set cid = item.id|default('') %} |
|
{% set cpk = item.pubkey|default('') %} |
|
{% set cts = item.created_at|default(null) %} |
|
<div class="card comment"> |
|
<div class="metadata"> |
|
<p> |
|
{% if item.kind is defined and item.kind == 1 %} |
|
<span class="ui-badge ui-badge--neutral" title="Legacy text-note reply (pre–NIP-22)">kind 1</span> |
|
{% elseif item.kind is defined and item.kind == 1111 %} |
|
<span class="ui-badge ui-badge--secondary" title="NIP-22 comment">1111</span> |
|
{% endif %} |
|
{% if cpk != '' %}<twig:Molecules:UserFromNpub ident="{{ cpk }}" />{% else %}<span class="text-subtle">Unknown</span>{% endif %} |
|
</p> |
|
<small>{% if cts is not null and cts != '' %}{{ cts|date('F j Y') }}{% endif %}</small> |
|
</div> |
|
<div class="card-body"> |
|
<twig:Atoms:Content content="{{ item.content|default('') }}" /> |
|
</div> |
|
{% if cid != '' and commentLinks[cid] is defined and commentLinks[cid]|length > 0 %} |
|
<div class="card-footer nostr-previews mt-3"> |
|
<div class="preview-container"> |
|
{% for link in commentLinks[cid] %} |
|
<div> |
|
<twig:Molecules:NostrPreview preview="{{ link }}" /> |
|
</div> |
|
{% endfor %} |
|
</div> |
|
</div> |
|
{% endif %} |
|
{% if ctx and ctx.can_publish|default(false) and item.kind|default(0) == 1111 %} |
|
{% for row in ctx.rows|default([]) %} |
|
{% if row.mode|default('') == 'comment' and row.parentId|default('') == cid %} |
|
<div class="comment-reply comment-reply--nested"> |
|
<form |
|
class="comment-reply__form" |
|
data-controller="comment-reply" |
|
data-action="submit->comment-reply#publish" |
|
data-comment-reply-publish-url-value="{{ path('comment_reply_publish')|e('html_attr') }}" |
|
data-comment-reply-csrf-value="{{ csrf_token('comment_reply')|e('html_attr') }}" |
|
data-comment-reply-expected-coordinate-value="{{ ctx.coordinate|e('html_attr') }}" |
|
data-comment-reply-article-event-id-value="{{ ctx.article_event_id|default('')|e('html_attr') }}" |
|
data-comment-reply-fragment-url-value="{{ ctx.fragment_url|default('')|e('html_attr') }}" |
|
data-comment-reply-refresh-after-value="1" |
|
data-comment-reply-blurb-label-value="{{ row.blurbLabel|default('Comment')|e('html_attr') }}" |
|
data-comment-reply-expected-tags-value='{{ row.expectedTags|default([])|json_encode|e('html_attr') }}' |
|
data-comment-reply-parent-kind-value="{{ row.parentKind|default(0) }}" |
|
data-comment-reply-parent-id-value="{{ row.parentId|default('')|e('html_attr') }}" |
|
data-comment-reply-author-pubkey-value="{{ row.authorPubkey|default('')|e('html_attr') }}" |
|
> |
|
<div class="comment-reply__head text-subtle">Reply to this note</div> |
|
<div class="comment-reply__body"> |
|
<label class="visually-hidden" for="comment-reply-{{ cid }}">Your reply</label> |
|
<textarea |
|
class="form-control" |
|
id="comment-reply-{{ cid }}" |
|
name="body" |
|
rows="3" |
|
required |
|
minlength="1" |
|
placeholder="Sign with your Nostr extension (kind 1111)…" |
|
></textarea> |
|
</div> |
|
<div class="comment-reply__actions"> |
|
<button class="btn btn-primary" type="submit">Sign & publish</button> |
|
</div> |
|
<p class="comment-reply__hint text-subtle" data-comment-reply-target="hint" aria-live="polite"></p> |
|
</form> |
|
</div> |
|
{% endif %} |
|
{% endfor %} |
|
{% endif %} |
|
</div> |
|
{% endfor %} |
|
</div> |
|
|
|
{% if quotes is defined and quotes|length > 0 %} |
|
<div class="comments-quotes"> |
|
<h3 class="comments-quotes__title">Quotes and references</h3> |
|
<p class="text-subtle comments-quotes__lede">Other notes that cite this article in a <code>q</code> tag (NIP-18) or reference its address in <code>a</code> / <code>A</code> (e.g. generic reposts, highlights).</p> |
|
{% for item in quotes %} |
|
{% set cid = item.id|default('') %} |
|
{% set cpk = item.pubkey|default('') %} |
|
{% set cts = item.created_at|default(null) %} |
|
<div class="card comment comment--quote"> |
|
<div class="metadata"> |
|
<p> |
|
<span class="ui-badge ui-badge--neutral">kind {{ item.kind|default('?') }}</span> |
|
{% if cpk != '' %}<twig:Molecules:UserFromNpub ident="{{ cpk }}" />{% else %}<span class="text-subtle">Unknown</span>{% endif %} |
|
</p> |
|
<small> |
|
{% if cts is not null and cts != '' %}{{ cts|date('F j Y') }}{% endif %} |
|
{% if cid != '' %} |
|
<span class="comments-quotes__sep">·</span> |
|
<a href="https://jumble.imwald.eu/feed/notes/{{ cid }}" class="nostr-jumble-outlink" target="_blank" rel="noopener noreferrer">View event</a> |
|
{% endif %} |
|
</small> |
|
</div> |
|
<div class="card-body"> |
|
<twig:Atoms:Content content="{{ item.content|default('') }}" /> |
|
</div> |
|
{% if cid != '' and quoteLinks[cid] is defined and quoteLinks[cid]|length > 0 %} |
|
<div class="card-footer nostr-previews mt-3"> |
|
<div class="preview-container"> |
|
{% for link in quoteLinks[cid] %} |
|
<div> |
|
<twig:Molecules:NostrPreview preview="{{ link }}" /> |
|
</div> |
|
{% endfor %} |
|
</div> |
|
</div> |
|
{% endif %} |
|
</div> |
|
{% endfor %} |
|
</div> |
|
{% endif %}
|
|
|