From 2e43d2ebcc6d14bf030d27d975c6fb69d860f3a3 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sat, 13 Oct 2012 15:43:50 -0400 Subject: [PATCH] don't display a broken thumbnail image if a thumbnail is not available --- cms/djangoapps/contentstore/views.py | 6 +++--- cms/templates/asset_index.html | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 78cda2e00c..15edd68aa1 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -848,9 +848,9 @@ def asset_index(request, org, course, name): display_info['url'] = StaticContent.get_url_path_from_location(asset_location) # note, due to the schema change we may not have a 'thumbnail_location' in the result set - thumbnail_location = Location(asset.get('thumbnail_location', None)) - - display_info['thumb_url'] = StaticContent.get_url_path_from_location(thumbnail_location) + _thumbnail_location = asset.get('thumbnail_location', None) + thumbnail_location = Location(_thumbnail_location) if _thumbnail_location is not None else None + display_info['thumb_url'] = StaticContent.get_url_path_from_location(thumbnail_location) if thumbnail_location is not None else None asset_display.append(display_info) diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index ad58819b62..1b3ffb6d5d 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -26,7 +26,11 @@ % for asset in assets: -
+
+ % if asset['thumb_url'] is not None: + + % endif +
${asset['displayname']}