diff --git a/mediagoblin/templates/mediagoblin/utils/object_gallery.html b/mediagoblin/templates/mediagoblin/utils/object_gallery.html index 03b85b17..c5e890fc 100644 --- a/mediagoblin/templates/mediagoblin/utils/object_gallery.html +++ b/mediagoblin/templates/mediagoblin/utils/object_gallery.html @@ -18,15 +18,46 @@ {% from "mediagoblin/utils/pagination.html" import render_pagination %} +{% macro media_grid(media_list, col_number=5) %} + {% set num_items = media_list.count() %} + {% set col_counter = 0 %} + {% set row_counter = 0 %} + {% set item_counter = 0 %} + + {% set num_rows = num_items // col_number %} + {% if num_items % col_number != 0 %} + {% set num_rows = num_rows + 1 %} + {% endif %} + + +{%- endmacro %} + {% block object_gallery_content -%} {% if media_entries and media_entries.count() %} - {% for entry in media_entries %} -
- - -
- {% endfor %} + {{ media_grid(media_entries) }}
{% if pagination_base_url %} {# different url, so set that and don't keep the get params #}