Added tag listing views.
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
CommitLineData
9a16e16f
SS
1{#
2# GNU MediaGoblin -- federated, autonomous media hosting
3# Copyright (C) 2011 Free Software Foundation, Inc
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{% extends "mediagoblin/base.html" %}
aa7d1a2f
JW
19
20{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
5949be9a 21{% from "mediagoblin/utils/pagination.html" import render_pagination %}
aa7d1a2f 22
9a16e16f 23{% block mediagoblin_content %}
9a16e16f 24 {% if media %}
18d9287a 25 <div class="grid_11 alpha">
2c9e635a
JW
26 <img class="media_image" src="{{ request.app.public_store.file_url(
27 media.get_display_media(media.media_files)) }}" />
d8db3f11 28
b611476c
JS
29 <h2>
30 {{media.title}}
31 </h2>
6f65e9eb 32
b611476c
JS
33 {% autoescape False %}
34 <p>{{ media.description_html }}</p>
35 {% endautoescape %}
6f65e9eb 36
a54e5be7 37 <p>
b611476c 38 &mdash;&nbsp;uploaded on
a54e5be7
JS
39 {{ "%4d-%02d-%02d"|format(media.created.year,
40 media.created.month, media.created.day) }}
41 by
42 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
43 user= media.uploader().username) }}">
44 {{- media.uploader().username }}</a>
b611476c 45 </p>
24df76fa 46 <br />
6f65e9eb 47
b611476c 48 <h3>Comments</h3>
a86e66b5
CAW
49 {% if request.user %}
50 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
51 user= media.uploader().username,
52 media=media._id) }}" method="POST">
f646f5d3 53 {{ wtforms_util.render_field_div(comment_form.comment_content) }}
a86e66b5 54 <div class="form_submit_buttons">
b611476c 55 <input type="submit" value="Post comment!" class="button" />
a86e66b5
CAW
56 </div>
57 </form>
58 {% endif %}
f6c49c5e 59
a86e66b5 60 {% if comments %}
a86e66b5 61 {% for comment in comments %}
2110408f 62 {% set comment_author = comment.author() %}
af2fcba5
JW
63 {% if pagination.active_id == comment._id %}
64 <div class="comment_wrapper comment_active" id="comment-{{ comment['_id'] }}">
65 <a name="comment" id="comment"></a>
66 {% else %}
67 <div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
68 {% endif %}
270dca58
JS
69 <div class="comment_content">
70 {% autoescape False %}
71 {{ comment.content_html }}
72 {% endautoescape %}
c13ce79a
JS
73 </div>
74 <div class="comment_author">&mdash;
75 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
2110408f
CAW
76 user = comment_author['username']) }}">
77 {{ comment_author['username'] }}</a> at
6f65e9eb
CAW
78 <!--</div>
79 <div class="comment_datetime">-->
af2fcba5
JW
80 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
81 comment = comment['_id'],
82 user = media.uploader().username,
83 media = media._id) }}#comment">
c13ce79a
JS
84 {{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year,
85 comment.created.month,
86 comment.created.day,
87 comment.created.hour,
88 comment.created.minute) }}
89 </a>
90 </div>
6f65e9eb 91 </div>
a86e66b5 92 {% endfor %}
6f65e9eb 93
af2fcba5
JW
94 {{ render_pagination(request, pagination,
95 request.urlgen('mediagoblin.user_pages.media_home',
96 user = media.uploader().username,
97 media = media._id)) }}
a86e66b5 98 </div>
aa7d1a2f 99 {% endif %}
18d9287a 100 <div class="grid_5 omega">
9c0fe63f 101 {% include "mediagoblin/utils/prev_next.html" %}
b611476c
JS
102 <h3>Sidebar content here!</h3>
103 <p>
e192d7b7
CFD
104 {% if media['uploader'] == request.user['_id'] or
105 request.user['is_admin'] %}
ab6fffed
CAW
106 <p>
107 <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
108 user= media.uploader().username,
109 media= media._id) }}"
110 ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
111 class="media_icon" />edit</a>
112 </p>
113 <p>
114 <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
082a675f 115 class="media_icon" />delete
ab6fffed 116 </p>
b611476c
JS
117 {% endif %}
118 </p>
6f2e4585 119 {% if media.tags %}
0712a06d 120 {% include "mediagoblin/utils/tags.html" %}
6f2e4585 121 {% endif %}
a54e5be7 122 </div>
9a16e16f 123 {% else %}
6f65e9eb 124 <p>Sorry, no such media found.<p/>
9a16e16f 125 {% endif %}
d3060210 126{% endblock %}