X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=mediagoblin%2Ftemplates%2Fmediagoblin%2Futils%2Fobject_gallery.html;h=e1b8cc9bafc93b0295c9558adc022cbc594006a1;hb=b9e1fa280edfff4daf424bbcf51bd651ed00f411;hp=03b85b17463ef154e1c26cfa79cf181bba92fe9e;hpb=db2b07eeb7f162ec1d0d75ae20d2b19215020c7e;p=mediagoblin.git diff --git a/mediagoblin/templates/mediagoblin/utils/object_gallery.html b/mediagoblin/templates/mediagoblin/utils/object_gallery.html index 03b85b17..e1b8cc9b 100644 --- a/mediagoblin/templates/mediagoblin/utils/object_gallery.html +++ b/mediagoblin/templates/mediagoblin/utils/object_gallery.html @@ -1,6 +1,6 @@ {# # GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011 Free Software Foundation, Inc +# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -18,15 +18,47 @@ {% from "mediagoblin/utils/pagination.html" import render_pagination %} -{% block object_gallery_content -%} - {% if media_entries and media_entries.count() %} - {% for entry in media_entries %} -
- - -
+{% macro media_grid(request, media_entries, col_number=5) %} + + {% for row in gridify_cursor(media_entries, col_number) %} + + {% for entry in row %} + {% set entry_url = entry.url_for_self(request.urlgen) %} + + {% endfor %} + {% endfor %} + +{%- endmacro %} + +{# + Render a media gallery with pagination. + + Args: + - request: Request + - media_entries: pymongo cursor of media entries + - pagination: Paginator object + - pagination_base_url: If you want the pagination to point to a + different URL, point it here + - col_number: How many columns per row (default 5) +#} +{% macro object_gallery(request, media_entries, pagination, + pagination_base_url=None, col_number=5) %} + {% if media_entries and media_entries.count() %} + {{ media_grid(request, media_entries, col_number=col_number) }}
{% if pagination_base_url %} {# different url, so set that and don't keep the get params #} @@ -39,4 +71,4 @@ There doesn't seem to be any media here yet...

{% endif %} -{% endblock %} +{% endmacro %}