Merge remote branch 'remotes/gullydwarf-cfdv/b372_rmdbfield_thumbnail_file'
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
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" %}
19
20 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
21 {% from "mediagoblin/utils/pagination.html" import render_pagination %}
22
23 {% block mediagoblin_content %}
24 {% if media %}
25 <div class="grid_11 alpha">
26 <div class="media_image_container">
27 <img class="media_image"
28 src="{{ request.app.public_store.file_url(
29 media.get_display_media(media.media_files)) }}" />
30 </div>
31
32 <h2>
33 {{media.title}}
34 </h2>
35
36 {% autoescape False %}
37 <p>{{ media.description_html }}</p>
38 {% endautoescape %}
39
40 <p>
41 {% trans date="%4d-%02d-%02d"|format(
42 media.created.year,
43 media.created.month, media.created.day),
44 user_url=request.urlgen(
45 'mediagoblin.user_pages.user_home',
46 user=media.uploader().username),
47 username=media.uploader().username -%}
48 &mdash;&nbsp;uploaded on {{ date }} by <a href="{{ user_url }}">{{ username }}</a>
49 {%- endtrans %}
50 </p>
51 <br />
52
53 <h3>{% trans %}Comments{% endtrans %}</h3>
54 {% if request.user %}
55 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
56 user= media.uploader().username,
57 media=media._id) }}" method="POST">
58 {{ wtforms_util.render_divs(comment_form) }}
59 <div class="form_submit_buttons">
60 <input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" />
61 </div>
62 </form>
63 {% endif %}
64
65 {% if comments %}
66 {% for comment in comments %}
67 {% set comment_author = comment.author() %}
68 {% if pagination.active_id == comment._id %}
69 <div class="comment_wrapper comment_active" id="comment-{{ comment['_id'] }}">
70 <a name="comment" id="comment"></a>
71 {% else %}
72 <div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
73 {% endif %}
74 <div class="comment_content">
75 {% autoescape False %}
76 {{ comment.content_html }}
77 {% endautoescape %}
78 </div>
79 <div class="comment_author">&mdash;
80 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
81 user = comment_author['username']) }}">
82 {{ comment_author['username'] }}</a> {% trans %}at{% endtrans %}
83 <!--</div>
84 <div class="comment_datetime">-->
85 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
86 comment = comment['_id'],
87 user = media.uploader().username,
88 media = media._id) }}#comment">
89 {{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year,
90 comment.created.month,
91 comment.created.day,
92 comment.created.hour,
93 comment.created.minute) }}
94 </a>
95 </div>
96 </div>
97 {% endfor %}
98
99 {{ render_pagination(request, pagination,
100 request.urlgen('mediagoblin.user_pages.media_home',
101 user = media.uploader().username,
102 media = media._id)) }}
103 </div>
104 {% endif %}
105
106 <div class="grid_5 omega">
107 {% include "mediagoblin/utils/prev_next.html" %}
108 {% if media['uploader'] == request.user['_id'] or
109 request.user['is_admin'] %}
110 <h3>Temporary button holder</h3>
111 <p>
112 <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
113 user= media.uploader().username,
114 media= media._id) }}"
115 ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
116 class="media_icon" />edit</a>
117 </p>
118 <p>
119 <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
120 class="media_icon" />{% trans %}delete{% endtrans %}
121 </p>
122 {% endif %}
123
124 {% if media.tags %}
125 {% include "mediagoblin/utils/tags.html" %}
126 {% endif %}
127 </div>
128 {% else %}
129 <p>{% trans %}Sorry, no such media found.{% endtrans %}<p/>
130 {% endif %}
131 {% endblock %}