Edward
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
29 additions and
2 deletions
-
sapl/base/templatetags/common_tags.py
-
sapl/templates/base.html
-
sapl/templates/crud/detail.html
|
|
@ -198,6 +198,19 @@ def url(value): |
|
|
|
return True |
|
|
|
return False |
|
|
|
|
|
|
|
@register.filter |
|
|
|
def audio_url(value): |
|
|
|
return True if url(value) and value.endswith("mp3") else False |
|
|
|
|
|
|
|
|
|
|
|
@register.filter |
|
|
|
def video_url(value): |
|
|
|
return True if url(value) and value.endswith("mp4") else False |
|
|
|
|
|
|
|
@register.filter |
|
|
|
def file_extension(value): |
|
|
|
import pathlib |
|
|
|
return pathlib.Path(value).suffix.replace('.', '') |
|
|
|
|
|
|
|
@register.filter |
|
|
|
def cronometro_to_seconds(value): |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
<!DOCTYPE html> |
|
|
|
{% load i18n staticfiles sass_tags menus %} |
|
|
|
{% load common_tags %} |
|
|
|
<!DOCTYPE html> |
|
|
|
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> |
|
|
|
<!--[if gt IE 8]><!--> |
|
|
|
<html class="no-js" lang="pt-br"> |
|
|
|
|
|
@ -65,7 +65,21 @@ |
|
|
|
<div id="div_id_{{ column.id }}" class="form-group"> |
|
|
|
<p class="control-label">{{ column.verbose_name }}</p> |
|
|
|
<div class="controls"> |
|
|
|
{% if column.text|url %} |
|
|
|
{% if column.text|audio_url %} |
|
|
|
<div class="form-control-static"> |
|
|
|
<audio controls> |
|
|
|
<source src="{{ column.text|safe }}" type="audio/{{ column.text|file_extension }}"> |
|
|
|
<p>Este navegador não suporta o elemento áudio.</p> |
|
|
|
</audio> |
|
|
|
</div> |
|
|
|
{% elif column.text|video_url %} |
|
|
|
<div class="form-control-static"> |
|
|
|
<video width="320" height="120" controls> |
|
|
|
<source src="{{ column.text|safe }}" type="video/{{ column.text|file_extension }}"> |
|
|
|
<p>Este navegador não suporta o elemento vídeo.</p> |
|
|
|
</video> |
|
|
|
</div> |
|
|
|
{% elif column.text|url %} |
|
|
|
<div class="form-control-static"><a href="{{ column.text|safe }}"> {{ column.text|safe|default:"" }} </a></div> |
|
|
|
{% else %} |
|
|
|
<div class="form-control-static">{{ column.text|safe|default:"" }}</div> |
|
|
|