Added comment preview functionality to user pages. It works by passing the comment...
[mediagoblin.git] / mediagoblin / templates / mediagoblin / utils / object_gallery.html
CommitLineData
ae85ed0f
BK
1{#
2# GNU MediaGoblin -- federated, autonomous media hosting
cf29e8a8 3# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
ae85ed0f
BK
4#
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.
9#
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.
14#
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/>.
17#}
18
5949be9a
CAW
19{% from "mediagoblin/utils/pagination.html" import render_pagination %}
20
02e100ea 21{% macro media_grid(request, media_entries, col_number=5) %}
b01a3b93 22 <table class="thumb_gallery">
2222278d 23 {% for row in media_entries|batch(col_number) %}
b01a3b93
JS
24 <tr class="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 <td class="media_thumbnail thumb_entry
30 {%- if loop.first %} thumb_entry_first
31 {%- elif loop.last %} thumb_entry_last{% endif %}">
32 <a href="{{ entry_url }}">
2e4ad359 33 <img src="{{ entry.thumb_url }}" />
b01a3b93
JS
34 </a>
35 {% if entry.title %}
1c66750a 36 <a class="thumb_entry_title" href="{{ entry_url }}">{{ entry.title }}</a>
b01a3b93
JS
37 {% endif %}
38 </td>
39 {% endfor %}
40 </tr>
035c976f 41 {% endfor %}
b01a3b93 42 </table>
035c976f
KR
43{%- endmacro %}
44
38bf03c6
CAW
45{#
46 Render a media gallery with pagination.
47
48 Args:
49 - request: Request
bc142abc 50 - media_entries: db cursor of media entries
38bf03c6
CAW
51 - pagination: Paginator object
52 - pagination_base_url: If you want the pagination to point to a
53 different URL, point it here
54 - col_number: How many columns per row (default 5)
55#}
56{% macro object_gallery(request, media_entries, pagination,
02e100ea 57 pagination_base_url=None, col_number=5) %}
77bc1c28 58 {% if media_entries and media_entries.count() %}
38bf03c6 59 {{ media_grid(request, media_entries, col_number=col_number) }}
db2b07ee 60 <div class="clear"></div>
51ca54a8
CAW
61 {% if pagination_base_url %}
62 {# different url, so set that and don't keep the get params #}
63 {{ render_pagination(request, pagination, pagination_base_url, False) }}
64 {% else %}
65 {{ render_pagination(request, pagination) }}
5949be9a 66 {% endif %}
7b32ba9a
CAW
67 {% else %}
68 <p>
0c0ab322
E
69 <i>
70 {%- trans -%}
71 There doesn't seem to be any media here yet...
72 {%- endtrans -%}
73 </i>
7b32ba9a 74 </p>
51ca54a8 75 {% endif %}
38bf03c6 76{% endmacro %}