self.media_files[u"original"]
)
+ @property
+ def icon_url(self):
+ '''Return the icon URL (for usage in templates) if it exists'''
+ try:
+ return self._app.staticdirector(
+ self.media_manager['type_icon'])
+ except AttributeError:
+ return None
+
@cached_property
def media_manager(self):
"""Returns the MEDIA_MANAGER of the media's media_type
""" Adds an object to the collection """
# It's here to prevent cyclic imports
from mediagoblin.db.models import CollectionItem
-
+
# Need the ID of this collection for this so check we've got one.
self.save(commit=False)
item = CollectionItem()
item.collection = self.id
item.get_object = obj
-
+
if content is not None:
item.note = content
self.num_items = self.num_items + 1
-
+
# Save both!
self.save(commit=commit)
item.save(commit=commit)
- return item
+ return item
class CollectionItemMixin(object):
@property
human_readable = "Video"
display_template = "mediagoblin/media_displays/video.html"
default_thumb = "images/media_thumbs/video.jpg"
+ type_icon = "images/type_icons/video.jpg"
# Used by the media_entry.get_display_media method
media_fetch_order = [u'webm_video', u'original']
border-color: #0D0D0D;
border-style: solid;
border-width: 1px 1px 2px;
+ position: relative;
}
.media_thumbnail a {
padding: 8px;
}
-/* For now, this is commented out since our thumbnails are actually 180px high.
- *
- * .media_thumbnail img {
- * max-height: 135px;
- * }
- */
+.entry_type_icon {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
.thumb_entry_last {
margin-right: 0px;
{%- if loop.first %} thumb_entry_first
{%- elif loop.last %} thumb_entry_last{% endif %}">
<a href="{{ entry_url }}">
+ {% if entry.icon_url %}
+ <img class="entry_type_icon" src="{{ entry.icon_url }}" />
+ {% endif %}
<img src="{{ entry.thumb_url }}" />
</a>
{% if entry.title %}
- <a class="thumb_entry_title" href="{{ entry_url }}">{{ entry.title }}</a>
+ <a class="thumb_entry_title" href="{{ entry_url }}">{{ entry.title }}</a>
+ {{ entry.icon_url }}
{% endif %}
</div>
{% endfor %}