1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-26 03:57:36 +02:00

Finish script, finish view, make some progress on template

This commit is contained in:
quark
2025-02-16 18:10:53 +01:00
parent 19d1ecfc66
commit 5f1b698d58
20 changed files with 1211 additions and 68 deletions

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from django.utils import timezone
from django.utils.html import escape
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from note_kfet.middlewares import get_current_request
@ -66,6 +66,24 @@ class WrappedTable(tables.Table):
},
)
share = tables.Column(
accessor="pk",
orderable=False,
attrs={
"td": {
"class": 'col-sm-2',
"title": _("Click to copy the link in the press paper"),
}
},
)
def render_share(self, value, record):
val = '<a class="btn btn-sm btn-primary" data-turbolinks="false" '
val += 'onclick="copylink(' + str(record.id) + ')">'
val += _('Copy link')
val += '</a>'
return format_html(val)
def render_public(self, value, record):
val = "" if record.public else ""
return val