2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C)
2011,
2012 MediaGoblin contributors. See AUTHORS.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version
3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see
<http://www.gnu.org/licenses
/>.
19 {% from
"mediagoblin/utils/pagination.html" import render_pagination %}
21 {% macro media_grid(request, media_entries, col_number=
5) %}
22 <div class=
"thumb_gallery">
23 {% for row in media_entries|batch(col_number) %}
24 <div class=
"row thumb_row
25 {%- if loop.first %} thumb_row_first
26 {%- elif loop.last %} thumb_row_last{% endif %}">
27 {% for entry in row %}
28 {% set entry_url = entry.url_for_self(request.urlgen) %}
29 <div class=
"three columns media_thumbnail thumb_entry
30 {%- if loop.first %} thumb_entry_first
31 {%- elif loop.last %} thumb_entry_last{% endif %}">
32 <a href=
"{{ entry_url }}">
33 {% if entry.icon_url %}
34 <img class=
"entry_type_icon" src=
"{{ entry.icon_url }}" />
36 <img src=
"{{ entry.thumb_url }}" />
39 <a class=
"thumb_entry_title" href=
"{{ entry_url }}">{{ entry.title }}
</a>
49 Render a media gallery with pagination.
53 - media_entries: db cursor of media entries
54 - pagination: Paginator object
55 - pagination_base_url: If you want the pagination to point to a
56 different URL, point it here
57 - col_number: How many columns per row (default
5)
59 {% macro object_gallery(request, media_entries, pagination,
60 pagination_base_url=None, col_number=
5) %}
61 {% if media_entries and media_entries.count() %}
62 {{ media_grid(request, media_entries, col_number=col_number) }}
63 <div class=
"clear"></div>
64 {% if pagination_base_url %}
65 {# different url, so set that and don't keep the get params #}
66 {{ render_pagination(request, pagination, pagination_base_url, False) }}
68 {{ render_pagination(request, pagination) }}
74 There doesn't seem to be any media here yet...
79 <a class=
"button_action" href=
"{{ request.urlgen('mediagoblin.submit.start') }}">
80 {%- trans %}Add media{% endtrans -%}