ui: add discussion reaction (#369)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
pandaandundefined authored and GitHub committed 2022-05-30 14:41:24 +08:00
1 parent 1fa5eef2e0
commit dc7d53b59c
7 files changed
+136 -111

No files matched your search

@@ -112,11 +112,9 @@
</div>
<div class="typo" data-emoji-enabled data-drid="{{ doc.docId }}" data-raw-url="{{ url('discussion_reply_raw', did=doc.parentId, drid=doc._id) }}">
{{ doc['content']|markdown|safe }}
<div class="reactions list">
{% for key in Object.keys(doc.react or {}) %}
{% if doc.react[key] %}
<div class="reaction{% if reactions[doc.docId][key] %} active{% endif %}"><span class="emoji">{{ key }}</span> {{ doc.react[key] }}</div>
{% endif %}
<div class="reactions list" data-type="drid" data-drid="{{ doc._id }}">
{% for e in Object.entries(doc.react or {})|sort(true, false, 1)|selectattr(1) %}
<div class="reaction{% if reactions[doc.docId][e[0]] %} active{% endif %}"><span class="emoji">{{ e[0] }}</span> {{ e[1] }}</div>
{% endfor %}
</div>
</div>
@@ -59,6 +59,16 @@
<li><a href="{{ url('wiki_help', anchor='contact') }}">
<span class="icon icon-warning"></span> {{ _('Report') }}
</a></li>
{% if handler.user.hasPerm(perm.PERM_ADD_REACTION) %}
<li><a href="javascript:;" data-op="react" data-type="discuss" data-form="{{ {operation: 'reaction', type:'did', id: ddoc._id }|json }}">
<span class="icon icon-emoji"></span>
</a></li>
{% endif %}
<div class="reactions list" data-type="did" data-did="{{ ddoc._id }}">
{% for e in Object.entries(ddoc.react or {})|sort(true, false, 1)|selectattr(1) %}
<div class="reaction{% if reactions[ddoc.docId][e[0]] %} active{% endif %}"><span class="emoji">{{ e[0] }}</span> {{ e[1] }}</div>
{% endfor %}
</div>
</ul>
</div>
<div class="section">