Skip to content

Commit

Permalink
feat(djangocms_video): responsive template (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar authored Jan 10, 2023
1 parent 0331b8b commit bfefab1
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ def get_subdirs_as_module_names(path):
'autoParagraph': False
}

# https://github.com/django-cms/djangocms-video
DJANGOCMS_VIDEO_TEMPLATES = [
('responsive-16by9', _('Responsive - 16 by 9')),
('responsive-4by3', _('Responsive - 4 by 3')),
('responsive-1by1', _('Responsive - 1 by 1')),
('responsive-21by9', _('Responsive - 21 by 9')),
]

########################
# IMPORT & EXPORT
########################
Expand Down
38 changes: 38 additions & 0 deletions taccsite_cms/templates/djangocms_video/default/video_player.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{# https://github.com/django-cms/djangocms-video/blob/3.0.0/djangocms_video/templates/djangocms_video/default/video_player.html #}
{% load i18n cms_tags %}

{# TACC: #}
{% block content_video %}
{# /TACC #}

{% if instance.embed_link %}
{# show iframe if embed_link is provided #}
<iframe src="{{ instance.embed_link_with_parameters }}" {{ instance.attributes_str }} frameborder="0" allowfullscreen="true"></iframe>
{% with disabled=instance.embed_link %}
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% endwith %}
{% else %}
{# render <source> or <track> plugins #}
<video controls {{ instance.attributes_str }}
{% if instance.poster %} poster="{{ instance.poster.url }}"{% endif %}>
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% trans "Your browser doesn't support this video format." %}
</video>
{% endif %}

{% comment %}
# Available variables:
{{ instance.template }}
{{ instance.label }}
{{ instance.embed_link }}
{{ instance.poster }}
{{ instance.attributes_str }}
{% endcomment %}

{# TACC: #}
{% endblock content_video %}
{# /TACC #}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "djangocms_video/default/video_player.html" %}

{% block content_video %}
<div class="embed-responsive embed-responsive-16by9">
{{ block.super }}
</div>
{% endblock content_video %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "djangocms_video/default/video_player.html" %}

{% block content_video %}
<div class="embed-responsive embed-responsive-1by1">
{{ block.super }}
</div>
{% endblock content_video %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "djangocms_video/default/video_player.html" %}

{% block content_video %}
<div class="embed-responsive embed-responsive-21by9">
{{ block.super }}
</div>
{% endblock content_video %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "djangocms_video/default/video_player.html" %}

{% block content_video %}
<div class="embed-responsive embed-responsive-4by3">
{{ block.super }}
</div>
{% endblock content_video %}

0 comments on commit bfefab1

Please sign in to comment.