From 546de9bc658b817f7c2ea273e94479e4d1226bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 3 Nov 2016 17:29:14 +0100 Subject: [PATCH] Use correct aspect-ratio for shot thumbnails. --- attract/shots/routes.py | 5 +++++ src/templates/attract/shots/for_project.jade | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/attract/shots/routes.py b/attract/shots/routes.py index c5b3b47..3ca58ad 100644 --- a/attract/shots/routes.py +++ b/attract/shots/routes.py @@ -45,6 +45,11 @@ def for_project(project, attract_props, task_id=None, shot_id=None): else: shot._thumbnail = thumb_placeholder + # The placeholder can be shown quite small, but otherwise the aspect ratio of + # the actual thumbnail should be taken into account. Since it's different for + # each project, we can't hard-code a proper height. + shot._thumbnail_height = '30px' if shot._thumbnail is thumb_placeholder else 'auto' + tasks_for_shots = current_attract.shot_manager.tasks_for_shots( shots, attract_props.task_types.attract_shot, diff --git a/src/templates/attract/shots/for_project.jade b/src/templates/attract/shots/for_project.jade index ba6c621..e4814c0 100644 --- a/src/templates/attract/shots/for_project.jade +++ b/src/templates/attract/shots/for_project.jade @@ -36,7 +36,8 @@ href="{{ url_for('attract.shots.perproject.view_shot', project_url=project.url, shot_id=shot._id) }}", class="status-{{ shot.properties.status }} shot-link") img(src="{{ shot._thumbnail }}", - alt="Thumbnail",width="110",height='60') + alt="Thumbnail", + style='width: 110px; height: {{ shot._thumbnail_height }}') .table-cell.shot-name a( data-shot-id="{{ shot._id }}",