Show thumbnails and previews for deleted documents.
This commit is contained in:
@@ -154,6 +154,16 @@ class DocumentsApp(MayanAppConfig):
|
|||||||
func=lambda context: two_state_template(context['object'].enabled)
|
func=lambda context: two_state_template(context['object'].enabled)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SourceColumn(
|
||||||
|
source=DeletedDocument, label=_('Thumbnail'),
|
||||||
|
func=lambda context: document_thumbnail(
|
||||||
|
context['object'],
|
||||||
|
gallery_name='documents:delete_document_list',
|
||||||
|
size=setting_thumbnail_size.value,
|
||||||
|
title=getattr(context['object'], 'label', None),
|
||||||
|
disable_title_link=True
|
||||||
|
)
|
||||||
|
)
|
||||||
SourceColumn(
|
SourceColumn(
|
||||||
source=DeletedDocument, label=_('Type'), attribute='document_type'
|
source=DeletedDocument, label=_('Type'), attribute='document_type'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ def document_multiple_document_type_edit(request):
|
|||||||
|
|
||||||
# TODO: Get rid of this view and convert widget to use API and base64 only images
|
# TODO: Get rid of this view and convert widget to use API and base64 only images
|
||||||
def get_document_image(request, document_id, size=setting_preview_size.value):
|
def get_document_image(request, document_id, size=setting_preview_size.value):
|
||||||
document = get_object_or_404(Document, pk=document_id)
|
document = get_object_or_404(Document.passthrough, pk=document_id)
|
||||||
try:
|
try:
|
||||||
Permission.check_permissions(request.user, (permission_document_view,))
|
Permission.check_permissions(request.user, (permission_document_view,))
|
||||||
except PermissionDenied:
|
except PermissionDenied:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ def document_link(document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def document_html_widget(document_page, click_view=None, click_view_arguments=None, zoom=DEFAULT_ZOOM_LEVEL, rotation=DEFAULT_ROTATION, gallery_name=None, fancybox_class='fancybox', image_class='lazy-load', title=None, size=setting_thumbnail_size.value, nolazyload=False, post_load_class=None):
|
def document_html_widget(document_page, click_view=None, click_view_arguments=None, zoom=DEFAULT_ZOOM_LEVEL, rotation=DEFAULT_ROTATION, gallery_name=None, fancybox_class='fancybox', image_class='lazy-load', title=None, size=setting_thumbnail_size.value, nolazyload=False, post_load_class=None, disable_title_link=False):
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
alt_text = _('Document page image')
|
alt_text = _('Document page image')
|
||||||
@@ -131,10 +131,15 @@ def document_html_widget(document_page, click_view=None, click_view_arguments=No
|
|||||||
)
|
)
|
||||||
|
|
||||||
if title:
|
if title:
|
||||||
preview_click_link = document.get_absolute_url()
|
if not disable_title_link:
|
||||||
title_template = 'data-caption="<a class=\'a-caption\' href=\'{url}\'>{title}</a>"'.format(
|
preview_click_link = document.get_absolute_url()
|
||||||
title=strip_tags(title), url=preview_click_link or '#'
|
title_template = 'data-caption="<a class=\'a-caption\' href=\'{url}\'>{title}</a>"'.format(
|
||||||
)
|
title=strip_tags(title), url=preview_click_link or '#'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
title_template = 'data-caption="{title}"'.format(
|
||||||
|
title=strip_tags(title),
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
title_template = ''
|
title_template = ''
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user