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:
Christopher Allan Webber 2013-05-28 16:34:47 -05:00
parent f9e032212d
commit ab4cbb103e
2 changed files with 19 additions and 13 deletions

View File

@ -27,3 +27,20 @@
{{ super() }}
{% template_hook("image_sideinfo") %}
{% 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 %}

View File

@ -154,19 +154,8 @@
{%- endtrans -%}
</span></p>
{% 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 %}
{% block mediagoblin_after_added_sidebar %}
{% endblock %}
{% if media.tags %}
{% include "mediagoblin/utils/tags.html" %}