Display a placeholder error document image for documents with no pages.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -82,10 +82,15 @@ class DocumentPagesCarouselWidget(forms.widgets.Widget):
|
|||||||
|
|
||||||
|
|
||||||
def document_thumbnail(document, **kwargs):
|
def document_thumbnail(document, **kwargs):
|
||||||
return document_html_widget(
|
if document.latest_version:
|
||||||
document.latest_version.pages.first(),
|
return document_html_widget(
|
||||||
click_view='documents:document_display', **kwargs
|
document.latest_version.pages.first(),
|
||||||
)
|
click_view='documents:document_display', **kwargs
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return mark_safe(
|
||||||
|
'<span class="fa-stack fa-lg"><i class="fa fa-file-o fa-stack-2x"></i><i class="fa fa-close fa-stack-1x text-danger"></i></span>'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def document_link(document):
|
def document_link(document):
|
||||||
|
|||||||
Reference in New Issue
Block a user