From 38228b4fe8155d32fdd6dde0965e3076194a5639 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 24 Dec 2018 14:13:47 -0400 Subject: [PATCH] Control the height of thumbnails in table view Since tables row height can't be controlled using CSS (they will always resize to the size of their elements), this commit adds a table cell container whose size can be controlled from the view. This way big thumbnail images won't break the appearance of the table. Signed-off-by: Roberto Rosario --- mayan/apps/appearance/static/appearance/css/base.css | 4 ++++ .../templates/appearance/generic_list_subtemplate.html | 7 ++++++- .../documents/forms/widgets/document_page_image.html | 2 +- .../templates/documents/widgets/document_thumbnail.html | 4 +++- mayan/apps/documents/views/document_page_views.py | 1 + mayan/apps/documents/views/document_version_views.py | 1 + mayan/apps/documents/views/document_views.py | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mayan/apps/appearance/static/appearance/css/base.css b/mayan/apps/appearance/static/appearance/css/base.css index 1cbb8851b8..3e7d71667c 100644 --- a/mayan/apps/appearance/static/appearance/css/base.css +++ b/mayan/apps/appearance/static/appearance/css/base.css @@ -483,3 +483,7 @@ body { border: 2px solid #18bc9c; box-shadow: 10px 10px 20px #000000; } + +.td-container-thumbnail { + height: 100px; +} diff --git a/mayan/apps/appearance/templates/appearance/generic_list_subtemplate.html b/mayan/apps/appearance/templates/appearance/generic_list_subtemplate.html index 31babe902e..1ce4431b29 100644 --- a/mayan/apps/appearance/templates/appearance/generic_list_subtemplate.html +++ b/mayan/apps/appearance/templates/appearance/generic_list_subtemplate.html @@ -118,7 +118,12 @@ {% if not hide_columns %} {% get_source_columns source=object exclude_identifier=True as source_columns %} {% for column in source_columns %} - {% source_column_resolve column=column as column_value %}{{ column_value }}{# Use explicit 'as column_value ' to force date rendering #} + +
+ {% source_column_resolve column=column as column_value %}{{ column_value }} + {# Use explicit 'as column_value ' to force date rendering #} +
+ {% endfor %} {% endif %} {% for column in extra_columns %} diff --git a/mayan/apps/documents/templates/documents/forms/widgets/document_page_image.html b/mayan/apps/documents/templates/documents/forms/widgets/document_page_image.html index 89b3ed4e9a..5fcb5e1788 100644 --- a/mayan/apps/documents/templates/documents/forms/widgets/document_page_image.html +++ b/mayan/apps/documents/templates/documents/forms/widgets/document_page_image.html @@ -13,7 +13,7 @@ class="thin_border {{ image_classes }}" data-url="{{ image_url|default:'' }}" src="#" - style="{% if image_max_height %}max-height: {{ image_max_height }}; {% endif %}" + style="{% if image_style_height %}height: {{ image_style_height }};{% endif %} {% if image_style_max_height %}max-height: {{ image_style_max_height }};{% endif %}" /> diff --git a/mayan/apps/documents/templates/documents/widgets/document_thumbnail.html b/mayan/apps/documents/templates/documents/widgets/document_thumbnail.html index ac777f7433..cbd72f06ff 100644 --- a/mayan/apps/documents/templates/documents/widgets/document_thumbnail.html +++ b/mayan/apps/documents/templates/documents/widgets/document_thumbnail.html @@ -12,7 +12,8 @@ {% if gallery_name %}data-fancybox="{{ gallery_name }}"{% endif %} > {% with 'lazy-load thin_border-thumbnail' as image_classes %} - {% with '200px' as image_max_height %} + {% with '200px' as image_style_max_height %} + {% with '100%' as image_style_height %} {% with size_thumbnail_width as image_width %} {% with size_thumbnail_height as image_height %} {% include 'documents/forms/widgets/document_page_image.html' %} @@ -20,4 +21,5 @@ {% endwith %} {% endwith %} {% endwith %} + {% endwith %} diff --git a/mayan/apps/documents/views/document_page_views.py b/mayan/apps/documents/views/document_page_views.py index 3696ab421f..b3ef5dc66a 100644 --- a/mayan/apps/documents/views/document_page_views.py +++ b/mayan/apps/documents/views/document_page_views.py @@ -86,6 +86,7 @@ class DocumentPageListView(SingleObjectListView): 'column_class': 'col-xs-12 col-sm-6 col-md-4 col-lg-3', 'list_as_items': True, 'object': self.get_document(), + 'table_cell_container_classes': 'td-container-thumbnail', 'title': _('Pages for document: %s') % self.get_document(), } diff --git a/mayan/apps/documents/views/document_version_views.py b/mayan/apps/documents/views/document_version_views.py index 11da7a0244..42e599a2ed 100644 --- a/mayan/apps/documents/views/document_version_views.py +++ b/mayan/apps/documents/views/document_version_views.py @@ -45,6 +45,7 @@ class DocumentVersionListView(SingleObjectListView): 'hide_object': True, 'list_as_items': True, 'object': self.get_document(), + 'table_cell_container_classes': 'td-container-thumbnail', 'title': _('Versions of document: %s') % self.get_document(), } diff --git a/mayan/apps/documents/views/document_views.py b/mayan/apps/documents/views/document_views.py index dd82fed1fd..269988d5d2 100644 --- a/mayan/apps/documents/views/document_views.py +++ b/mayan/apps/documents/views/document_views.py @@ -93,6 +93,7 @@ class DocumentListView(SingleObjectListView): 'permission for any document or document type.' ), 'no_results_title': _('No documents available'), + 'table_cell_container_classes': 'td-container-thumbnail', 'title': _('All documents'), }