don't display a broken thumbnail image if a thumbnail is not available

This commit is contained in:
Chris Dodge
2012-10-13 15:43:50 -04:00
parent f1517fefa6
commit 2e43d2ebcc
2 changed files with 8 additions and 4 deletions

View File

@@ -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)

View File

@@ -26,7 +26,11 @@
% for asset in assets:
<tr>
<td class="thumb-col">
<div class="thumb"><img src="${asset['thumb_url']}"></div>
<div class="thumb">
% if asset['thumb_url'] is not None:
<img src="${asset['thumb_url']}">
% endif
</div>
</td>
<td class="name-col">
<a href="${asset['url']}" class="filename">${asset['displayname']}</a>