2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C)
2011,
2012 MediaGoblin contributors. See AUTHORS.
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.
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.
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
/>.
18 {%- extends
"mediagoblin/base.html" %}
20 {% import
"/mediagoblin/utils/wtforms.html" as wtforms_util %}
21 {% from
"mediagoblin/utils/pagination.html" import render_pagination %}
23 {% block title %}{{ media.title }}
— {{ super() }}{% endblock %}
25 {% block mediagoblin_head %}
26 <!--[if lte IE 8]><link rel="stylesheet"
27 href="{{ request.staticdirect('/extlib/leaflet/leaflet.ie.css') }}" /><![endif]-->
28 <script type=
"text/javascript"
29 src=
"{{ request.staticdirect('/js/comment_show.js') }}"></script>
30 <script type=
"text/javascript"
31 src=
"{{ request.staticdirect('/js/keyboard_navigation.js') }}"></script>
33 {% template_hook(
"location_head") %}
34 {% template_hook(
"media_head") %}
35 {% endblock mediagoblin_head %}
36 {% block mediagoblin_content %}
37 <div class=
"row foot">
38 <p class=
"eleven columns context">
39 {%- trans user_url=request.urlgen(
40 'mediagoblin.user_pages.user_home',
41 user=media.get_actor.username),
42 username=media.get_actor.username -%}
43 ❖ Browsing media by
<a href=
"{{user_url}}">{{username}}
</a>
46 <div class=
"five columns">
47 {% include
"mediagoblin/utils/prev_next.html" %}
50 <div class=
"media_pane eleven columns">
51 {% block mediagoblin_media %}
52 <div class=
"media_image_container">
53 {% set display_media = request.app.public_store.file_url(
54 media.get_display_media()[
1]) %}
55 {# if there's a medium file size, that means the medium size
56 # isn't the original... so link to the original!
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 }}"
63 alt=
"{% trans media_title=media.title -%}
64 Image for {{ media_title }}{% endtrans %}" />
67 <img class=
"media_image"
68 src=
"{{ display_media }}"
69 alt=
"{% trans media_title=media.title -%}
70 Image for {{ media_title }}{% endtrans %}" />
74 <div class=
"row head foot">
75 <h2 class=
"media_title">
78 {% if request.user and
79 (media.actor == request.user.id or
80 request.user.has_privilege('admin')) %}
81 <div class=
"pull-right" style=
"padding-top:20px;">
82 {% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
83 user= media.get_actor.username,
85 <a class=
"button_action" href=
"{{ edit_url }}">{% trans %}Edit{% endtrans %}
</a>
86 {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
87 user= media.get_actor.username,
89 <a class=
"button_action button_warning" href=
"{{ delete_url }}">{% trans %}Delete{% endtrans %}
</a>
92 {% autoescape False %}
93 <p>{{ media.description_html }}
</p>
96 {% if request.user and request.user.has_privilege('commenter') %}
97 <div class=
"media_comments">
98 {% if app_config['allow_comments'] %}
100 {% if not request.user %}
101 href=
"{{ request.urlgen('mediagoblin.auth.login') }}?next={{
102 request.base_url|urlencode }}"
104 class=
"button_action" id=
"button_addcomment" title=
"Add a comment">
105 {% trans %}Add a comment{% endtrans %}
107 {% include
"mediagoblin/utils/comment-subscription.html" %}
110 {% if request.user %}
111 <form action=
"{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
112 user= media.get_actor.username,
113 media_id=media.id) }}" method=
"POST" id=
"form_comment">
114 {{ wtforms_util.render_divs(comment_form) }}
115 <div class=
"form_submit_buttons">
116 <input type=
"submit" value=
"{% trans %}Add this comment{% endtrans %}" class=
"button_action" />
119 <input type=
"hidden" value=
"{{ request.urlgen('mediagoblin.user_pages.media_preview_comment') }}" id=
"previewURL" />
120 <input type=
"hidden" value=
"{% trans %}Comment Preview{% endtrans %}" id=
"previewText"/>
122 <div id=
"comment_preview"></div>
124 <ul style=
"list-style:none">
125 {% for comment in comments %}
126 {% set comment_object = comment.comment() %}
127 {% set comment_author = comment_object.get_actor %}
128 <li id=
"comment-{{ comment.id }}"
129 {%- if pagination.active_id == comment.id %}
130 class=
"comment_wrapper comment_active">
131 <a name=
"comment" id=
"comment"></a>
133 class=
"comment_wrapper">
135 <div class=
"comment_author">
136 <img src=
"{{ request.staticdirect('/images/icon_comment.png') }}" />
137 <a href=
"{{ request.urlgen('mediagoblin.user_pages.user_home',
138 user=comment_author.username) }}"
139 class=
"comment_authorlink">
140 {{- comment_author.username -}}
142 <a href=
"{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
144 user=media.get_actor.username,
145 media=media.slug_or_id) }}#comment"
146 class=
"comment_whenlink">
147 <span title='{{- comment_object.created.strftime(
"%I:%M%p %Y-%m-%d") -}}'
>
148 {%- trans formatted_time=timesince(comment_object.created) -%}
149 {{ formatted_time }} ago
153 <div class=
"comment_content">
154 {% autoescape False -%}
155 {{ comment_object.content_html }}
159 {% if app_config.allow_reporting %}
160 <a href=
"{{ request.urlgen('mediagoblin.user_pages.media_home.report_comment',
161 user=media.get_actor.username,
162 media=media.slug_or_id,
163 comment=comment.id) }}">
164 {% trans %}Report{% endtrans %}
</a>
170 {{ render_pagination(request, pagination,
171 media.url_for_self(request.urlgen)) }}
173 <div class=
"empty_space no_background">
180 <div class=
"five columns media_sidebar">
181 <h3>{% trans %}Added{% endtrans %}
</h3>
182 <p><span title=
"{{ media.created.strftime("%I:%M%p %Y-%m-%d
") }}">
183 {%- trans formatted_time=timesince(media.created) -%}
184 {{ formatted_time }} ago
188 {% block mediagoblin_after_added_sidebar %}
192 {% include
"mediagoblin/utils/tags.html" %}
195 {% include
"mediagoblin/utils/collections.html" %}
197 {% if app_config.allow_reporting %}
198 {% include
"mediagoblin/utils/report.html" %}
201 {% include
"mediagoblin/utils/license.html" %}
203 {% include
"mediagoblin/utils/exif.html" %}
205 {%- if media.attachment_files|count %}
206 <h3>{% trans %}Attachments{% endtrans %}
</h3>
208 {%- for attachment in media.attachment_files %}
210 <a href=
"{{ request.app.public_store.file_url(attachment.filepath) }}">
211 {{- attachment.name -}}
217 {%- if app_config['allow_attachments']
219 and (media.actor == request.user.id
220 or request.user.has_privilege('admin')) %}
221 {%- if not media.attachment_files|count %}
222 <h3>{% trans %}Attachments{% endtrans %}
</h3>
225 <a href=
"{{ request.urlgen('mediagoblin.edit.attachments',
226 user=media.get_actor.username,
227 media_id=media.id) }}">
228 {%- trans %}Add attachment{% endtrans -%}
232 {% if
"video.html" in media.media_manager.display_template or
"audio.html" in media.media_manager.display_template %}
233 {%- if media.subtitle_files|count %}
234 <h3>{% trans %}Subtitles{% endtrans %}
</h3>
236 {%- for subtitle in media.subtitle_files %}
238 <a href=
"{{ request.urlgen('mediagoblin.edit.custom_subtitles',
239 user=media.get_actor.username,
241 path=subtitle.filepath) }}">
242 {{- subtitle.name -}}
247 {%- if app_config['allow_subtitles']
249 and (media.actor == request.user.id
250 or request.user.has_privilege('admin')) %}
251 {%- if not media.subtitle_files|count %}
252 <h3>{% trans %}Subtitles{% endtrans %}
</h3>
255 <a href=
"{{ request.urlgen('mediagoblin.edit.subtitles',
256 user=media.get_actor.username,
257 media_id=media.id) }}">
258 {%- trans %}Add subtitle {% endtrans -%}
264 {% block mediagoblin_sidebar %}
267 {%- set model = media %}
268 {% template_hook(
"location_info") %}
269 {% template_hook(
"media_sideinfo") %}
271 </div><!--end media_sidebar-->
273 <div class=
"clear"></div>