core&ui: solution: get link

This commit is contained in:
undefined committed 2022-08-29 13:05:15 +08:00
1 parent 7d67bd3993
commit e3dd65c690
4 files changed
+38 -4

No files matched your search

@@ -0,0 +1,17 @@
import Clipboard from 'clipboard';
import Notification from 'vj/components/notification';
import { AutoloadPage } from 'vj/misc/Page';
import i18n from 'vj/utils/i18n';
export default new AutoloadPage('clipboard', () => {
$('[data-copy]').each(function () {
const clip = new Clipboard(this, { text: () => this.dataset.copy });
clip.on('success', () => Notification.success(i18n('Copied to clipboard!')));
clip.on('error', () => Notification.error(i18n('Copy failed :(')));
});
$('[data-copylink]').each(function () {
const clip = new Clipboard(this, { text: () => new URL(this.dataset.copylink, document.location.href).toString() });
clip.on('success', () => Notification.success(i18n('Link copied to clipboard!')));
clip.on('error', () => Notification.error(i18n('Copy failed :(')));
});
});
@@ -112,6 +112,9 @@
{{ user.render_inline(udoc) }} @ {{ datetimeSpan(doc._id)|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
<a href="javascript:;" data-tooltip="{{ _('Copy Link') }}" data-copylink="{{ url('problem_solution_detail', pid=pdoc.pid|default(pdoc.docId), sid=doc._id) }}">
<span class="icon icon-link"></span>
</a>
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" data-op="reply" data-type="comment"
data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}"
@@ -33,12 +33,19 @@
reply_delete_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY,
reply_delete_self_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF
) }}
{{ paginator.render(page, pcount) }}
{% if not sid %}
{{ paginator.render(page, pcount) }}
{% endif %}
{% if drcount == 0 %}
{{ nothing.render('No solutions so far...') }}
{% endif %}
</div>
</div>
{% if sid %}
<div class="section">
<a href="{{ url('problem_solution', pid=pdoc.pid|default(pdoc.docId)) }}" class="menu__link" style="width: 100%">{{ _('View all {0} solutions').format(pscount) }}</a>
</div>
{% endif %}
</div>
<div class="medium-3 columns">
{% set owner_udoc = udict[pdoc.owner] %}