Subtitle built over attachments : working
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
1 {#
2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
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 title %}{{ media.title }} &mdash; {{ super() }}{% endblock %}
24
25 {% block mediagoblin_head %}
26 <!--[if lte IE 8]><link rel="stylesheet"
27 href="{{ request.staticdirect('/extlib/leaflet/leaflet.ie.css') }}" /><![endif]-->
28
29 <link rel="stylesheet" type="text/css" href="{{ request.staticdirect('/css/lightbox.css') }}">
30 <script type="text/javascript"
31 src="{{ request.staticdirect('/js/comment_show.js') }}"></script>
32 <script type="text/javascript"
33 src="{{ request.staticdirect('/js/keyboard_navigation.js') }}"></script>
34 <script type="text/javascript"
35 src="{{ request.staticdirect('/js/lightbox.js') }}"></script>
36
37 {% template_hook("location_head") %}
38 {% template_hook("media_head") %}
39 {% endblock mediagoblin_head %}
40 {% block mediagoblin_content %}
41 <div class="row foot">
42 <p class="eleven columns context">
43 {%- trans user_url=request.urlgen(
44 'mediagoblin.user_pages.user_home',
45 user=media.get_actor.username),
46 username=media.get_actor.username -%}
47 ❖ Browsing media by <a href="{{user_url}}">{{username}}</a>
48 {%- endtrans -%}
49 </p>
50 <div class="five columns">
51 {% include "mediagoblin/utils/prev_next.html" %}
52 </div>
53 </div>
54 <div class="media_pane eleven columns">
55 {% block mediagoblin_media %}
56 <div class="media_image_container">
57 {% set display_media = request.app.public_store.file_url(
58 media.get_display_media()[1]) %}
59 {# if there's a medium file size, that means the medium size
60 # isn't the original... so link to the original!
61 #}
62 {% if media.media_files.has_key('medium') %}
63 <a href="{{ request.app.public_store.file_url(
64 media.media_files['original']) }}" class="lightbox">
65 <img class="media_image"
66 src="{{ display_media }}"
67 alt="{% trans media_title=media.title -%}
68 Image for {{ media_title }}{% endtrans %}" />
69 </a>
70 {% else %}
71 <img class="media_image"
72 src="{{ display_media }}"
73 alt="{% trans media_title=media.title -%}
74 Image for {{ media_title }}{% endtrans %}" />
75 {% endif %}
76 </div>
77 {% endblock %}
78 <div class="row head foot">
79 <h2 class="media_title">
80 {{ media.title }}
81 </h2>
82 {% if request.user and
83 (media.actor == request.user.id or
84 request.user.has_privilege('admin')) %}
85 <div class="pull-right" style="padding-top:20px;">
86 {% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
87 user= media.get_actor.username,
88 media_id=media.id) %}
89 <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a>
90 {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
91 user= media.get_actor.username,
92 media_id=media.id) %}
93 <a class="button_action button_warning" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
94 </div>
95 {% endif %}
96 {% autoescape False %}
97 <p>{{ media.description_html }}</p>
98 {% endautoescape %}
99 </div>
100 {% if request.user and request.user.has_privilege('commenter') %}
101 <div class="media_comments">
102 {% if app_config['allow_comments'] %}
103 <a
104 {% if not request.user %}
105 href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
106 request.base_url|urlencode }}"
107 {% endif %}
108 class="button_action" id="button_addcomment" title="Add a comment">
109 {% trans %}Add a comment{% endtrans %}
110 </a>
111 {% include "mediagoblin/utils/comment-subscription.html" %}
112
113 {% endif %}
114 {% if request.user %}
115 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
116 user= media.get_actor.username,
117 media_id=media.id) }}" method="POST" id="form_comment">
118 {{ wtforms_util.render_divs(comment_form) }}
119 <div class="form_submit_buttons">
120 <input type="submit" value="{% trans %}Add this comment{% endtrans %}" class="button_action" />
121 {{ csrf_token }}
122 </div>
123 <input type="hidden" value="{{ request.urlgen('mediagoblin.user_pages.media_preview_comment') }}" id="previewURL" />
124 <input type="hidden" value="{% trans %}Comment Preview{% endtrans %}" id="previewText"/>
125 </form>
126 <div id="comment_preview"></div>
127 {% endif %}
128 <ul style="list-style:none">
129 {% for comment in comments %}
130 {% set comment_object = comment.comment() %}
131 {% set comment_author = comment_object.get_actor %}
132 <li id="comment-{{ comment.id }}"
133 {%- if pagination.active_id == comment.id %}
134 class="comment_wrapper comment_active">
135 <a name="comment" id="comment"></a>
136 {%- else %}
137 class="comment_wrapper">
138 {%- endif %}
139 <div class="comment_author">
140 <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
141 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
142 user=comment_author.username) }}"
143 class="comment_authorlink">
144 {{- comment_author.username -}}
145 </a>
146 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
147 comment=comment.id,
148 user=media.get_actor.username,
149 media=media.slug_or_id) }}#comment"
150 class="comment_whenlink">
151 <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
152 {%- trans formatted_time=timesince(comment_object.created) -%}
153 {{ formatted_time }} ago
154 {%- endtrans -%}
155 </span></a>:
156 </div>
157 <div class="comment_content">
158 {% autoescape False -%}
159 {{ comment_object.content_html }}
160 {%- endautoescape %}
161 </div>
162 <div>
163 {% if app_config.allow_reporting %}
164 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_comment',
165 user=media.get_actor.username,
166 media=media.slug_or_id,
167 comment=comment.id) }}">
168 {% trans %}Report{% endtrans %}</a>
169 {% endif %}
170 </div>
171 </li>
172 {% endfor %}
173 </ul>
174 {{ render_pagination(request, pagination,
175 media.url_for_self(request.urlgen)) }}
176 {% else %}
177 <div class="empty_space no_background">
178 {% endif %}
179 </div>
180
181 </div>
182
183
184 <div class="five columns media_sidebar">
185 <h3>{% trans %}Added{% endtrans %}</h3>
186 <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
187 {%- trans formatted_time=timesince(media.created) -%}
188 {{ formatted_time }} ago
189 {%- endtrans -%}
190 </span></p>
191
192 {% block mediagoblin_after_added_sidebar %}
193 {% endblock %}
194
195 {% if media.tags %}
196 {% include "mediagoblin/utils/tags.html" %}
197 {% endif %}
198
199 {% include "mediagoblin/utils/collections.html" %}
200
201 {% if app_config.allow_reporting %}
202 {% include "mediagoblin/utils/report.html" %}
203 {% endif %}
204
205 {% include "mediagoblin/utils/license.html" %}
206
207 {% include "mediagoblin/utils/exif.html" %}
208
209 {%- if media.attachment_files|count %}
210 <h3>{% trans %}Attachments{% endtrans %}</h3>
211 <ul>
212 {%- for attachment in media.attachment_files %}
213 <li>
214 <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
215 {{- attachment.name -}}
216 </a>
217 </li>
218 {%- endfor %}
219 </ul>
220 {%- endif %}
221 {%- if app_config['allow_attachments']
222 and request.user
223 and (media.actor == request.user.id
224 or request.user.has_privilege('admin')) %}
225 {%- if not media.attachment_files|count %}
226 <h3>{% trans %}Attachments{% endtrans %}</h3>
227 {%- endif %}
228 <p>
229 <a href="{{ request.urlgen('mediagoblin.edit.attachments',
230 user=media.get_actor.username,
231 media_id=media.id) }}">
232 {%- trans %}Add attachment{% endtrans -%}
233 </a>
234 </p>
235 {%- endif %}
236 {%- if media.subtitle_files|count %}
237 <h3>{% trans %}Subtitles{% endtrans %}</h3>
238 <ul>
239 {%- for subtitle in media.subtitle_files %}
240 <li>
241 <a href="{{ request.app.public_store.file_url(subtitle.filepath) }}">
242 {{- subtitle.name -}}
243 </a>
244 </li>
245 {%- endfor %}
246 </ul>
247 {%- endif %}
248 {%- if app_config['allow_subtitles']
249 and request.user
250 and (media.actor == request.user.id
251 or request.user.has_privilege('admin')) %}
252 {%- if not media.subtitle_files|count %}
253 <h3>{% trans %}Subtitles{% endtrans %}</h3>
254 {%- endif %}
255 <p>
256 <a href="{{ request.urlgen('mediagoblin.edit.subtitles',
257 user=media.get_actor.username,
258 media_id=media.id) }}">
259 {%- trans %}Add subtitle{% endtrans -%}
260 </a>
261 </p>
262 {%- endif %}
263
264 {% block mediagoblin_sidebar %}
265 {% endblock %}
266
267 {%- set model = media %}
268 {% template_hook("location_info") %}
269 {% template_hook("media_sideinfo") %}
270
271 </div><!--end media_sidebar-->
272
273 <div class="clear"></div>
274 {% endblock %}