The main motivation here is that this lets us pass in a specific number of col_number
#}
{% extends "mediagoblin/base.html" %}
+{% from "mediagoblin/utils/object_gallery.html" import object_gallery %}
+
{% block mediagoblin_head %}
<link rel="alternate" type="application/atom+xml"
href="{{ request.urlgen(
</h1>
<div class="container_16 media_gallery">
- {% include "mediagoblin/utils/object_gallery.html" %}
+ {{ object_gallery(request, media_entries, pagination) }}
</div>
<div class="grid_16">
#}
{% extends "mediagoblin/base.html" %}
+{% from "mediagoblin/utils/object_gallery.html" import object_gallery %}
+
{% block mediagoblin_content %}
<h1>{% trans %}Welcome to GNU MediaGoblin!{% endtrans %}</h1>
{% endif %}
{% endif %}
- {# temporarily, an "image gallery" that isn't one really ;) #}
-
- {% include "mediagoblin/utils/object_gallery.html" %}
+ {{ object_gallery(request, media_entries, pagination) }}
{% endblock %}
#}
{% extends "mediagoblin/base.html" %}
+{% from "mediagoblin/utils/object_gallery.html" import object_gallery %}
+
{% block mediagoblin_head %}
<link rel="alternate" type="application/atom+xml"
href="{{ request.urlgen(
</div>
<div class="container_16 media_gallery">
- {% include "mediagoblin/utils/object_gallery.html" %}
+ {{ object_gallery(request, media_entries, pagination) }}
</div>
<div class="grid_16">
<a href="{{ request.urlgen(
#}
{% extends "mediagoblin/base.html" %}
+{% from "mediagoblin/utils/object_gallery.html" import object_gallery %}
+
{% block mediagoblin_head %}
<link rel="alternate" type="application/atom+xml"
href="{{ request.urlgen(
</div>
<div class="grid_10 omega">
- {% set pagination_base_url = user_gallery_url %}
+ {{ object_gallery(request, media_entries, pagination,
+ pagination_base_url=user_gallery_url, col_number=3) }}
{% include "mediagoblin/utils/object_gallery.html" %}
<div class="clear"></div>
<p>
{% from "mediagoblin/utils/pagination.html" import render_pagination %}
-{% macro media_grid(media_list, col_number=5) %}
+{% macro media_grid(request, media_list, col_number=5) %}
{% set num_items = media_list.count() %}
{% set col_counter = 0 %}
{% set row_counter = 0 %}
</div>
{%- endmacro %}
-{% block object_gallery_content -%}
+
+{#
+ 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(media_entries) }}
+ {{ media_grid(request, media_entries, col_number=col_number) }}
<div class="clear"></div>
{% if pagination_base_url %}
{# different url, so set that and don't keep the get params #}
<i>There doesn't seem to be any media here yet...</i>
</p>
{% endif %}
-{% endblock %}
+{% endmacro %}