Reorganize media.html, comment part
[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 %}
21
9a16e16f 22{% block mediagoblin_content %}
9a16e16f
SS
23 {# temporarily, an "image gallery" that isn't one really ;) #}
24 {% if media %}
a54e5be7 25 <div class="grid_8 alpha media_image">
a86e66b5 26 <h1>
a54e5be7 27 {{media.title}}
a86e66b5 28 </h1>
f1e053e0 29 <img src="{{ request.app.public_store.file_url(
a86e66b5 30 media.media_files.main) }}" />
a54e5be7
JS
31 <p>
32 Uploaded on
33 {{ "%4d-%02d-%02d"|format(media.created.year,
34 media.created.month, media.created.day) }}
35 by
36 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
37 user= media.uploader().username) }}">
38 {{- media.uploader().username }}</a>
a86e66b5
CAW
39 </p>
40
a54e5be7
JS
41 {% autoescape False %}
42 <p>{{ media.description_html }}</p>
43 {% endautoescape %}
a86e66b5 44
a54e5be7
JS
45 {% if media['uploader'] == request.user['_id'] %}
46 <p><a href="{{ request.urlgen('mediagoblin.edit.edit_media',
47 user= media.uploader().username,
48 media= media._id) }}">Edit</a></p>
49 {% endif %}
a86e66b5
CAW
50 {% if request.user %}
51 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
52 user= media.uploader().username,
53 media=media._id) }}" method="POST">
54 <h3>Post a comment!</h3>
55 {{ wtforms_util.render_field_div(comment_form.comment) }}
56 <div class="form_submit_buttons">
57 <input type="submit" value="Submit" class="button" />
58 </div>
59 </form>
60 {% endif %}
a86e66b5
CAW
61 {#
62 {{ wtforms_util.render_textarea_div(submit_form.description) }}
63 {{ wtforms_util.render_field_div(submit_form.file) }}
64 #}
a86e66b5
CAW
65 {% if comments %}
66 <h3>Comments</h3>
67 {% for comment in comments %}
68 <div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
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',
76 user = comment['author']['username']) }}">
77 {{ comment['author']['username'] }}</a> at
78 <!--</div>
79 <div class="comment_datetime">-->
80 <a href="#comment-{{ comment['_id'] }}">
81 {{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year,
82 comment.created.month,
83 comment.created.day,
84 comment.created.hour,
85 comment.created.minute) }}
86 </a>
87 </div>
88 </div>
a86e66b5
CAW
89 {% endfor %}
90 {% include "mediagoblin/utils/pagination.html" %}
91 </div>
aa7d1a2f 92 {% endif %}
a54e5be7
JS
93 <div class="grid_4 omega media_sidebar">
94 <p>This is a sidebar! Yay!</p>
95 </div>
9a16e16f
SS
96 {% else %}
97 <p>Sorry, no such media found.<p/>
98 {% endif %}
d3060210 99{% endblock %}