Fix #5484 - Add video icon to collection thumbnail
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
CommitLineData
9a16e16f
SS
1{#
2# GNU MediaGoblin -- federated, autonomous media hosting
cf29e8a8 3# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
9a16e16f
SS
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#}
954b407c 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
688f56c2
CAW
23{% block title %}{{ media.title }} &mdash; {{ super() }}{% endblock %}
24
75a12d63 25{% block mediagoblin_head %}
e8e444a8
JW
26<!--[if lte IE 8]><link rel="stylesheet"
27 href="{{ request.staticdirect('/extlib/leaflet/leaflet.ie.css') }}" /><![endif]-->
ada0642e
JS
28 <script type="text/javascript"
29 src="{{ request.staticdirect('/js/comment_show.js') }}"></script>
64327824
JS
30 <script type="text/javascript"
31 src="{{ request.staticdirect('/js/keyboard_navigation.js') }}"></script>
cd1b836e 32
c0434db4 33 {% template_hook("location_head") %}
cac17c15 34 {% template_hook("media_head") %}
75a12d63 35{% endblock mediagoblin_head %}
9a16e16f 36{% block mediagoblin_content %}
4a9a796a 37<div class="row foot">
45842f84 38 <p class="eleven columns context">
0dedf3f2 39 {%- trans user_url=request.urlgen(
ee9a0e3c 40 'mediagoblin.user_pages.user_home',
0f3bf8d4
JT
41 user=media.get_actor.username),
42 username=media.get_actor.username -%}
0dedf3f2
E
43 ❖ Browsing media by <a href="{{user_url}}">{{username}}</a>
44 {%- endtrans -%}
45 </p>
45842f84 46 <div class="five columns">
47 {% include "mediagoblin/utils/prev_next.html" %}
48 </div>
49</div>
5cdf3a0a 50 <div class="media_pane eleven columns">
03ff0b36 51 {% block mediagoblin_media %}
52 <div class="media_image_container">
38816c66 53 {% set display_media = request.app.public_store.file_url(
ddbf6af1 54 media.get_display_media()[1]) %}
38816c66
CAW
55 {# if there's a medium file size, that means the medium size
56 # isn't the original... so link to the original!
57 #}
58 {% if media.media_files.has_key('medium') %}
59 <a href="{{ request.app.public_store.file_url(
60 media.media_files['original']) }}">
61 <img class="media_image"
62 src="{{ display_media }}"
4a5b97ba
CAW
63 alt="{% trans media_title=media.title -%}
64 Image for {{ media_title }}{% endtrans %}" />
38816c66
CAW
65 </a>
66 {% else %}
9b424b17
CAW
67 <img class="media_image"
68 src="{{ display_media }}"
4a5b97ba
CAW
69 alt="{% trans media_title=media.title -%}
70 Image for {{ media_title }}{% endtrans %}" />
38816c66 71 {% endif %}
03ff0b36 72 </div>
73 {% endblock %}
4a9a796a 74 <div class="row head foot">
f80f5b58
CAW
75 <h2 class="media_title">
76 {{ media.title }}
77 </h2>
2baad043 78 {% template_hook("media_titleinfo") %}
ee9a0e3c 79 {% if request.user and
0f3bf8d4 80 (media.actor == request.user.id or
8394febb 81 request.user.has_privilege('admin')) %}
da4d97e0 82 <div class="pull-right" style="padding-top:20px;">
ee9a0e3c 83 {% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
0f3bf8d4 84 user= media.get_actor.username,
461dd971 85 media_id=media.id) %}
ee9a0e3c
JS
86 <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a>
87 {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
0f3bf8d4 88 user= media.get_actor.username,
461dd971 89 media_id=media.id) %}
da4d97e0 90 <a class="button_action button_warning" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
91 </div>
ee9a0e3c 92 {% endif %}
f80f5b58
CAW
93 {% autoescape False %}
94 <p>{{ media.description_html }}</p>
ee9a0e3c 95 {% endautoescape %}
da4d97e0 96 </div>
64a456a4 97 {% if request.user and request.user.has_privilege('commenter') %}
da4d97e0 98 <div class="media_comments">
8154ecaf
CAW
99 {% if app_config['allow_comments'] %}
100 <a
101 {% if not request.user %}
8fc57eaa
RE
102 href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
103 request.base_url|urlencode }}"
8154ecaf
CAW
104 {% endif %}
105 class="button_action" id="button_addcomment" title="Add a comment">
106 {% trans %}Add a comment{% endtrans %}
107 </a>
0c7fa755
JW
108 {% include "mediagoblin/utils/comment-subscription.html" %}
109
8154ecaf 110 {% endif %}
e360a992 111 {% if request.user %}
aa4f958a 112 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
0f3bf8d4 113 user= media.get_actor.username,
461dd971 114 media_id=media.id) }}" method="POST" id="form_comment">
f80f5b58
CAW
115 {{ wtforms_util.render_divs(comment_form) }}
116 <div class="form_submit_buttons">
75a12d63 117 <input type="submit" value="{% trans %}Add this comment{% endtrans %}" class="button_action" />
f80f5b58
CAW
118 {{ csrf_token }}
119 </div>
5ab60299 120 <input type="hidden" value="{{ request.urlgen('mediagoblin.user_pages.media_preview_comment') }}" id="previewURL" />
3bd62dc4 121 <input type="hidden" value="{% trans %}Comment Preview{% endtrans %}" id="previewText"/>
f80f5b58 122 </form>
5ab60299 123 <div id="comment_preview"></div>
e360a992 124 {% endif %}
5bae4af1 125 <ul style="list-style:none">
694e965f 126 {% for comment in comments %}
161bc6b2
JT
127 {% set comment_object = comment.comment() %}
128 {% set comment_author = comment_object.get_actor %}
5bae4af1
E
129 <li id="comment-{{ comment.id }}"
130 {%- if pagination.active_id == comment.id %}
131 class="comment_wrapper comment_active">
132 <a name="comment" id="comment"></a>
133 {%- else %}
134 class="comment_wrapper">
135 {%- endif %}
136 <div class="comment_author">
694e965f
JS
137 <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
138 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
64308aca
CAW
139 user=comment_author.username) }}"
140 class="comment_authorlink">
4637d50c 141 {{- comment_author.username -}}
694e965f 142 </a>
694e965f 143 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
397c22d1 144 comment=comment.id,
0f3bf8d4 145 user=media.get_actor.username,
64308aca
CAW
146 media=media.slug_or_id) }}#comment"
147 class="comment_whenlink">
161bc6b2
JT
148 <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
149 {%- trans formatted_time=timesince(comment_object.created) -%}
eac52ac1
CAW
150 {{ formatted_time }} ago
151 {%- endtrans -%}
152 </span></a>:
55dbaa9b
JS
153 </div>
154 <div class="comment_content">
4637d50c 155 {% autoescape False -%}
161bc6b2 156 {{ comment_object.content_html }}
4637d50c 157 {%- endautoescape %}
6f65e9eb 158 </div>
30a9fe7c 159 <div>
6483b370 160 {% if app_config.allow_reporting %}
161 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_comment',
0f3bf8d4 162 user=media.get_actor.username,
30a9fe7c 163 media=media.slug_or_id,
690597ef 164 comment=comment.id) }}">
6483b370 165 {% trans %}Report{% endtrans %}</a>
166 {% endif %}
30a9fe7c 167 </div>
5bae4af1 168 </li>
694e965f 169 {% endfor %}
5bae4af1 170 </ul>
0eb649ff
E
171 {{ render_pagination(request, pagination,
172 media.url_for_self(request.urlgen)) }}
da4d97e0 173 {% else %}
174 <div class="empty_space no_background">
aa7d1a2f 175 {% endif %}
da4d97e0 176 </div>
da4d97e0 177
5cdf3a0a 178 </div>
179
180
181 <div class="five columns media_sidebar">
34d30444 182 <h3>{% trans %}Added{% endtrans %}</h3>
05ad187b 183 <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
dc31cd1b 184 {%- trans formatted_time=timesince(media.created) -%}
eac52ac1
CAW
185 {{ formatted_time }} ago
186 {%- endtrans -%}
187 </span></p>
058226d0 188
ab4cbb10
CAW
189 {% block mediagoblin_after_added_sidebar %}
190 {% endblock %}
058226d0 191
f80f5b58
CAW
192 {% if media.tags %}
193 {% include "mediagoblin/utils/tags.html" %}
aa7d1a2f 194 {% endif %}
5d900647 195
44004c17 196 {% include "mediagoblin/utils/collections.html" %}
be5be115 197
6483b370 198 {% if app_config.allow_reporting %}
199 {% include "mediagoblin/utils/report.html" %}
200 {% endif %}
3ce0c611 201
99a270e9 202 {% include "mediagoblin/utils/license.html" %}
6d9ce47f 203
cc7ca4da 204 {% include "mediagoblin/utils/exif.html" %}
aa4f958a 205
954b407c 206 {%- if media.attachment_files|count %}
62b7d1b2
JK
207 <h3>{% trans %}Attachments{% endtrans %}</h3>
208 <ul>
954b407c 209 {%- for attachment in media.attachment_files %}
62b7d1b2
JK
210 <li>
211 <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
13ab48a7 212 {{- attachment.name -}}
62b7d1b2
JK
213 </a>
214 </li>
954b407c 215 {%- endfor %}
62b7d1b2 216 </ul>
954b407c
E
217 {%- endif %}
218 {%- if app_config['allow_attachments']
62b7d1b2 219 and request.user
0f3bf8d4 220 and (media.actor == request.user.id
8394febb 221 or request.user.has_privilege('admin')) %}
954b407c 222 {%- if not media.attachment_files|count %}
62b7d1b2 223 <h3>{% trans %}Attachments{% endtrans %}</h3>
954b407c 224 {%- endif %}
62b7d1b2
JK
225 <p>
226 <a href="{{ request.urlgen('mediagoblin.edit.attachments',
0f3bf8d4 227 user=media.get_actor.username,
954b407c
E
228 media_id=media.id) }}">
229 {%- trans %}Add attachment{% endtrans -%}
230 </a>
62b7d1b2 231 </p>
954b407c 232 {%- endif %}
62b7d1b2 233
8db3277c
RRS
234 {% block mediagoblin_sidebar %}
235 {% endblock %}
236
c0434db4
JT
237 {%- set model = media %}
238 {% template_hook("location_info") %}
927be5e8 239 {% template_hook("media_sideinfo") %}
1c2d01ae 240
da4d97e0 241 </div><!--end media_sidebar-->
242
85778e79 243 <div class="clear"></div>
d3060210 244{% endblock %}