Simplify/Robustify the thumbnail URL usage in templates
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Fri, 9 Nov 2012 09:13:04 +0000 (10:13 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 15 Nov 2012 11:01:31 +0000 (12:01 +0100)
commit2e4ad359623916f5ca9f6ec11f5353a1a85a77d2
tree30458eceed7b36f938566d317210fcd7b85bca75
parentee62c51d797ab317366fa099f5e012f33f42857f
Simplify/Robustify the thumbnail URL usage in templates

So far templates required a very complex blurb to simply insert a
thumbnail URL, exposing much of the internal logic to the template
designer. In addition, we would fail with an error if for some
reason the media_files['thumb'] entry was never populated.

This adds the MediaEntry.thumb_url property that template designers
can simply use. It will do the right thing, either fetching the proper
thumbnail or hand back a generic icon specified in a media's
MEDIA_MANAGER as "default_thumb".

Add an image default fallback icon (stolen from Tangos, which are
Public Domain since version 0.8.90 as I understand) since the one
we referred to was not existing. Perhaps, a "broken image" icon
would be better, but I'll leave that to our capable designers.

All templates have been modified to make use of the new thumb_url
function.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/db/mixin.py
mediagoblin/media_types/image/__init__.py
mediagoblin/static/images/media_thumbs/image.png [new file with mode: 0644]
mediagoblin/templates/mediagoblin/edit/attachments.html
mediagoblin/templates/mediagoblin/edit/edit.html
mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html
mediagoblin/templates/mediagoblin/user_pages/media_collect.html
mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
mediagoblin/templates/mediagoblin/utils/collection_gallery.html
mediagoblin/templates/mediagoblin/utils/object_gallery.html