Display type icon in thumbnails
This commit is contained in:
parent
3b6b009077
commit
654d7cf94f
@ -301,6 +301,15 @@ class MediaEntryMixin(GenerateSlugMixin, GeneratePublicIDMixin):
|
||||
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
|
||||
@ -449,7 +458,7 @@ class CollectionMixin(GenerateSlugMixin, GeneratePublicIDMixin):
|
||||
""" 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)
|
||||
|
||||
@ -457,16 +466,16 @@ class CollectionMixin(GenerateSlugMixin, GeneratePublicIDMixin):
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ class VideoMediaManager(MediaManagerBase):
|
||||
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']
|
||||
|
@ -590,6 +590,7 @@ ul#action_to_resolve {list-style:none; margin-left:10px;}
|
||||
border-color: #0D0D0D;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 2px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.media_thumbnail a {
|
||||
@ -607,12 +608,11 @@ a.thumb_entry_title {
|
||||
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;
|
||||
|
@ -30,10 +30,14 @@
|
||||
{%- 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 %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user