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"]
|
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
|
@cached_property
|
||||||
def media_manager(self):
|
def media_manager(self):
|
||||||
"""Returns the MEDIA_MANAGER of the media's media_type
|
"""Returns the MEDIA_MANAGER of the media's media_type
|
||||||
@ -449,7 +458,7 @@ class CollectionMixin(GenerateSlugMixin, GeneratePublicIDMixin):
|
|||||||
""" Adds an object to the collection """
|
""" Adds an object to the collection """
|
||||||
# It's here to prevent cyclic imports
|
# It's here to prevent cyclic imports
|
||||||
from mediagoblin.db.models import CollectionItem
|
from mediagoblin.db.models import CollectionItem
|
||||||
|
|
||||||
# Need the ID of this collection for this so check we've got one.
|
# Need the ID of this collection for this so check we've got one.
|
||||||
self.save(commit=False)
|
self.save(commit=False)
|
||||||
|
|
||||||
@ -457,16 +466,16 @@ class CollectionMixin(GenerateSlugMixin, GeneratePublicIDMixin):
|
|||||||
item = CollectionItem()
|
item = CollectionItem()
|
||||||
item.collection = self.id
|
item.collection = self.id
|
||||||
item.get_object = obj
|
item.get_object = obj
|
||||||
|
|
||||||
if content is not None:
|
if content is not None:
|
||||||
item.note = content
|
item.note = content
|
||||||
|
|
||||||
self.num_items = self.num_items + 1
|
self.num_items = self.num_items + 1
|
||||||
|
|
||||||
# Save both!
|
# Save both!
|
||||||
self.save(commit=commit)
|
self.save(commit=commit)
|
||||||
item.save(commit=commit)
|
item.save(commit=commit)
|
||||||
return item
|
return item
|
||||||
|
|
||||||
class CollectionItemMixin(object):
|
class CollectionItemMixin(object):
|
||||||
@property
|
@property
|
||||||
|
@ -28,6 +28,7 @@ class VideoMediaManager(MediaManagerBase):
|
|||||||
human_readable = "Video"
|
human_readable = "Video"
|
||||||
display_template = "mediagoblin/media_displays/video.html"
|
display_template = "mediagoblin/media_displays/video.html"
|
||||||
default_thumb = "images/media_thumbs/video.jpg"
|
default_thumb = "images/media_thumbs/video.jpg"
|
||||||
|
type_icon = "images/type_icons/video.jpg"
|
||||||
|
|
||||||
# Used by the media_entry.get_display_media method
|
# Used by the media_entry.get_display_media method
|
||||||
media_fetch_order = [u'webm_video', u'original']
|
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-color: #0D0D0D;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px 1px 2px;
|
border-width: 1px 1px 2px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media_thumbnail a {
|
.media_thumbnail a {
|
||||||
@ -607,12 +608,11 @@ a.thumb_entry_title {
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For now, this is commented out since our thumbnails are actually 180px high.
|
.entry_type_icon {
|
||||||
*
|
position: absolute;
|
||||||
* .media_thumbnail img {
|
top: 0;
|
||||||
* max-height: 135px;
|
right: 0;
|
||||||
* }
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
.thumb_entry_last {
|
.thumb_entry_last {
|
||||||
margin-right: 0px;
|
margin-right: 0px;
|
||||||
|
@ -30,10 +30,14 @@
|
|||||||
{%- if loop.first %} thumb_entry_first
|
{%- if loop.first %} thumb_entry_first
|
||||||
{%- elif loop.last %} thumb_entry_last{% endif %}">
|
{%- elif loop.last %} thumb_entry_last{% endif %}">
|
||||||
<a href="{{ entry_url }}">
|
<a href="{{ entry_url }}">
|
||||||
|
{% if entry.icon_url %}
|
||||||
|
<img class="entry_type_icon" src="{{ entry.icon_url }}" />
|
||||||
|
{% endif %}
|
||||||
<img src="{{ entry.thumb_url }}" />
|
<img src="{{ entry.thumb_url }}" />
|
||||||
</a>
|
</a>
|
||||||
{% if entry.title %}
|
{% 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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user