Fixing bug where non-image types might break if app_config['original_date_visible'] is true
Not all media managers have the .get_original_date attribute, so of course break. This is fixed by making a new space where individual media types can define this if they like. This commit sponsored by Matthieu Dupont de Dinechin. Thank you!
This commit is contained in:
parent
f9e032212d
commit
ab4cbb103e
@ -27,3 +27,20 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% template_hook("image_sideinfo") %}
|
{% template_hook("image_sideinfo") %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block mediagoblin_after_added_sidebar %}
|
||||||
|
{% if app_config['original_date_visible'] %}
|
||||||
|
{% set original_date = media.media_manager.get_original_date() %}
|
||||||
|
|
||||||
|
{% if original_date %}
|
||||||
|
<h3>{% trans %}Created{% endtrans %}</h3>
|
||||||
|
|
||||||
|
<p><span title="{{ original_date.strftime("%I:%M%p %Y-%m-%d") }}">
|
||||||
|
{%- trans formatted_time=timesince(original_date) -%}
|
||||||
|
{{ formatted_time }} ago
|
||||||
|
{%- endtrans -%}
|
||||||
|
</span></p>
|
||||||
|
{%- endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -154,19 +154,8 @@
|
|||||||
{%- endtrans -%}
|
{%- endtrans -%}
|
||||||
</span></p>
|
</span></p>
|
||||||
|
|
||||||
{% if app_config['original_date_visible'] %}
|
{% block mediagoblin_after_added_sidebar %}
|
||||||
{% set original_date = media.media_manager.get_original_date() %}
|
{% endblock %}
|
||||||
|
|
||||||
{% if original_date %}
|
|
||||||
<h3>{% trans %}Created{% endtrans %}</h3>
|
|
||||||
|
|
||||||
<p><span title="{{ original_date.strftime("%I:%M%p %Y-%m-%d") }}">
|
|
||||||
{%- trans formatted_time=timesince(original_date) -%}
|
|
||||||
{{ formatted_time }} ago
|
|
||||||
{%- endtrans -%}
|
|
||||||
</span></p>
|
|
||||||
{%- endif %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if media.tags %}
|
{% if media.tags %}
|
||||||
{% include "mediagoblin/utils/tags.html" %}
|
{% include "mediagoblin/utils/tags.html" %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user