Commit 272d9282 authored by Seb's avatar Seb
Browse files

Fix video chooser panel, small other layout fixes

parent fa8916ec
from django.db import models from django.db import models
from modelcluster.fields import ParentalKey from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import StreamFieldPanel from wagtail.admin.edit_handlers import FieldPanel
from wagtail.core.fields import StreamField from wagtail.core.fields import StreamField
from wagtail.core.models import Page from wagtail.core.models import Page
...@@ -51,5 +51,5 @@ class TestPage(Page): ...@@ -51,5 +51,5 @@ class TestPage(Page):
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
VideoChooserPanel('video_field'), VideoChooserPanel('video_field'),
StreamFieldPanel('video_streamfield'), FieldPanel('video_streamfield'),
] ]
...@@ -4,11 +4,7 @@ from .widgets import AdminVideoChooser ...@@ -4,11 +4,7 @@ from .widgets import AdminVideoChooser
class VideoChooserPanel(FieldPanel): class VideoChooserPanel(FieldPanel):
model = None
field_name = None
_target_model = None
object_type_name = "video" def __init__(self, field_name, disable_comments=None, permission=None, **kwargs):
kwargs['widget'] = AdminVideoChooser
def widget_overrides(self): super().__init__(field_name, disable_comments=disable_comments, permission=permission, **kwargs)
return {self.field_name: AdminVideoChooser}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
title="{{ video.title }}" title="{{ video.title }}"
href="{% url 'wagtailvideos_chooser:chosen' video.id %}" href="{% url 'wagtailvideos_chooser:chosen' video.id %}"
> >
<div class="image"> <figure>
{% if video.thumbnail %} {% if video.thumbnail %}
<img <img
src="{{ video.thumbnail.url }}" src="{{ video.thumbnail.url }}"
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
alt="" alt=""
/> />
{% endif %} {% endif %}
</div> <figcaption>{{ video.title|ellipsistrim:60 }}</figcaption>
<h3>{{ video.title|ellipsistrim:60 }}</h3> </figure>
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<figure> <figure>
{% if video.thumbnail %} {% if video.thumbnail %}
<img src="{{ video.thumbnail.url }}" height="165" width="165" class="show-transparency" alt="{% trans 'Video thumbnail' %}"/> <img src="{{ video.thumbnail.url }}" height="165" width="165" class="show-transparency" alt="{% trans 'Video thumbnail' %}"/>
{% else %}
<img width="165" height="165" class="show-transparency" alt="" />
{% endif %} {% endif %}
<figcaption>{{ video.title|ellipsistrim:60 }}</figcaption> <figcaption>{{ video.title|ellipsistrim:60 }}</figcaption>
</figure> </figure>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment