From f80f5b58a818dfcbbf984fc3e580df5fbf04917b Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 4 Dec 2011 10:24:42 -0600 Subject: [PATCH] Removing the conditional that checks if there's a media in media.html If there isn't a media, we shouldn't hit that template! The view should ensure that. --- .../mediagoblin/user_pages/media.html | 246 +++++++++--------- 1 file changed, 121 insertions(+), 125 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 7434664c..caa99eb7 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -23,143 +23,139 @@ {% block title %}{{ media.title }} — {{ super() }}{% endblock %} {% block mediagoblin_content %} - {% if media %} -
-
- {% block mediagoblin_media %} - {% set display_media = request.app.public_store.file_url( - media.get_display_media(media.media_files)) %} +
+
+ {% block mediagoblin_media %} + {% set display_media = request.app.public_store.file_url( + media.get_display_media(media.media_files)) %} - {# if there's a medium file size, that means the medium size - # isn't the original... so link to the original! - #} - {% if media['media_files'].has_key('medium') %} - - Image for {{ media.title }} - - {% else %} + {# if there's a medium file size, that means the medium size + # isn't the original... so link to the original! + #} + {% if media['media_files'].has_key('medium') %} + Image for {{ media.title }} - {% endif %} - {% endblock %} -
+ + {% else %} + Image for {{ media.title }} + {% endif %} + {% endblock %} +
-

- {{ media.title }} -

- {% autoescape False %} -

{{ media.description_html }}

- {% endautoescape %} -

- {% trans date=media.created.strftime("%Y-%m-%d"), - user_url=request.urlgen( - 'mediagoblin.user_pages.user_home', - user=media.get_uploader().username), - username=media.get_uploader().username -%} - By {{ username }} on {{ date }} - {%- endtrans %} -

-

- {% if request.user and comments.count() %} -

{% trans %}Post a comment{% endtrans %}

- {% endif %} - {% if comments %} - {% for comment in comments %} - {% set comment_author = comment.author() %} - {% if pagination.active_id == comment._id %} -
- - {% else %} -
- {% endif %} +

+ {{ media.title }} +

+ {% autoescape False %} +

{{ media.description_html }}

+ {% endautoescape %} +

+ {% trans date=media.created.strftime("%Y-%m-%d"), + user_url=request.urlgen( + 'mediagoblin.user_pages.user_home', + user=media.get_uploader().username), + username=media.get_uploader().username -%} + By {{ username }} on {{ date }} + {%- endtrans %} +

+

+ {% if request.user and comments.count() %} +

{% trans %}Post a comment{% endtrans %}

+ {% endif %} + {% if comments %} + {% for comment in comments %} + {% set comment_author = comment.author() %} + {% if pagination.active_id == comment._id %} +
+ + {% else %} +
+ {% endif %} -
{% autoescape False %}{{ comment.content_html }} - {% endautoescape %} - - - {{ comment_author['username'] }} - {% trans %}at{% endtrans %} - - {{ comment.created.strftime("%I:%M%p %Y-%m-%d") }} - -
+
{% autoescape False %}{{ comment.content_html }} + {% endautoescape %} + + + {{ comment_author['username'] }} + {% trans %}at{% endtrans %} + + {{ comment.created.strftime("%I:%M%p %Y-%m-%d") }} +
- {% endfor %} +
+ {% endfor %} - {% if request.user %} -
- {{ wtforms_util.render_divs(comment_form) }} -
- - {{ csrf_token }} -
-
- {% endif %} + {% if request.user %} +
+ {{ wtforms_util.render_divs(comment_form) }} +
+ + {{ csrf_token }} +
+
+ {% endif %} - {{ render_pagination(request, pagination, - request.urlgen('mediagoblin.user_pages.media_home', - user = media.get_uploader().username, - media = media._id)) }} -
- {% endif %} + {{ render_pagination(request, pagination, + request.urlgen('mediagoblin.user_pages.media_home', + user = media.get_uploader().username, + media = media._id)) }} +
+ {% endif %} -
- {% include "mediagoblin/utils/prev_next.html" %} +
+ {% include "mediagoblin/utils/prev_next.html" %} - {% if media['uploader'] == request.user._id or - request.user['is_admin'] %} -

- {% set edit_url = request.urlgen('mediagoblin.edit.edit_media', - user= media.get_uploader().username, - media= media._id) %} - {% trans %}Edit{% endtrans %} -

-

- {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', - user= media.get_uploader().username, - media= media._id) %} - {% trans %}Delete{% endtrans %} -

- {% endif %} + {% if media['uploader'] == request.user._id or + request.user['is_admin'] %} +

+ {% set edit_url = request.urlgen('mediagoblin.edit.edit_media', + user= media.get_uploader().username, + media= media._id) %} + {% trans %}Edit{% endtrans %} +

+

+ {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', + user= media.get_uploader().username, + media= media._id) %} + {% trans %}Delete{% endtrans %} +

+ {% endif %} - {% if media.attachment_files|count %} -

Attachments

- - {% endif %} + {% if media.attachment_files|count %} +

Attachments

+ + {% endif %} - {% if app_config['allow_attachments'] - and (media['uploader'] == request.user._id - or request.user['is_admin']) %} -

- Add attachment -

- {% endif %} + {% if app_config['allow_attachments'] + and (media['uploader'] == request.user._id + or request.user['is_admin']) %} +

+ Add attachment +

+ {% endif %} - {% if media.tags %} - {% include "mediagoblin/utils/tags.html" %} - {% endif %} -
- {% else %} -

{% trans %}Sorry, no such media found.{% endtrans %}

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

{% endblock %} -- 2.25.1