From ab4cbb103ebcb00b7473c4344b1d3a5da2770824 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 28 May 2013 16:34:47 -0500 Subject: [PATCH] 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! --- .../mediagoblin/media_displays/image.html | 17 +++++++++++++++++ .../templates/mediagoblin/user_pages/media.html | 15 ++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/media_displays/image.html b/mediagoblin/templates/mediagoblin/media_displays/image.html index 158dd67f..d0050f50 100644 --- a/mediagoblin/templates/mediagoblin/media_displays/image.html +++ b/mediagoblin/templates/mediagoblin/media_displays/image.html @@ -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 %} +

{% trans %}Created{% endtrans %}

+ +

+ {%- trans formatted_time=timesince(original_date) -%} + {{ formatted_time }} ago + {%- endtrans -%} +

+ {%- endif %} + {% endif %} +{% endblock %} + diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 92c01c48..fb892fd7 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -154,19 +154,8 @@ {%- endtrans -%}

- {% if app_config['original_date_visible'] %} - {% set original_date = media.media_manager.get_original_date() %} - - {% if original_date %} -

{% trans %}Created{% endtrans %}

- -

- {%- trans formatted_time=timesince(original_date) -%} - {{ formatted_time }} ago - {%- endtrans -%} -

- {%- endif %} - {% endif %} + {% block mediagoblin_after_added_sidebar %} + {% endblock %} {% if media.tags %} {% include "mediagoblin/utils/tags.html" %} -- 2.25.1