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]-->
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>
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>
50 <div class=
"five columns">
51 {% include
"mediagoblin/utils/prev_next.html" %}
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!
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 %}" />
71 <img class=
"media_image"
72 src=
"{{ display_media }}"
73 alt=
"{% trans media_title=media.title -%}
74 Image for {{ media_title }}{% endtrans %}" />
78 <div class=
"row head foot">
79 <h2 class=
"media_title">
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,
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,
93 <a class=
"button_action button_warning" href=
"{{ delete_url }}">{% trans %}Delete{% endtrans %}
</a>
96 {% autoescape False %}
97 <p>{{ media.description_html }}
</p>
100 {% if request.user and request.user.has_privilege('commenter') %}
101 <div class=
"media_comments">
102 {% if app_config['allow_comments'] %}
104 {% if not request.user %}
105 href=
"{{ request.urlgen('mediagoblin.auth.login') }}?next={{
106 request.base_url|urlencode }}"
108 class=
"button_action" id=
"button_addcomment" title=
"Add a comment">
109 {% trans %}Add a comment{% endtrans %}
111 {% include
"mediagoblin/utils/comment-subscription.html" %}
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" />
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"/>
126 <div id=
"comment_preview"></div>
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>
137 class=
"comment_wrapper">
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 -}}
146 <a href=
"{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
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
157 <div class=
"comment_content">
158 {% autoescape False -%}
159 {{ comment_object.content_html }}
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>
174 {{ render_pagination(request, pagination,
175 media.url_for_self(request.urlgen)) }}
177 <div class=
"empty_space no_background">
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
192 {% block mediagoblin_after_added_sidebar %}
196 {% include
"mediagoblin/utils/tags.html" %}
199 {% include
"mediagoblin/utils/collections.html" %}
201 {% if app_config.allow_reporting %}
202 {% include
"mediagoblin/utils/report.html" %}
205 {% include
"mediagoblin/utils/license.html" %}
207 {% include
"mediagoblin/utils/exif.html" %}
209 {%- if media.attachment_files|count %}
210 <h3>{% trans %}Attachments{% endtrans %}
</h3>
212 {%- for attachment in media.attachment_files %}
214 <a href=
"{{ request.app.public_store.file_url(attachment.filepath) }}">
215 {{- attachment.name -}}
221 {%- if app_config['allow_attachments']
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>
229 <a href=
"{{ request.urlgen('mediagoblin.edit.attachments',
230 user=media.get_actor.username,
231 media_id=media.id) }}">
232 {%- trans %}Add attachment{% endtrans -%}
236 {%- if media.subtitle_files|count %}
237 <h3>{% trans %}Subtitles{% endtrans %}
</h3>
239 {%- for subtitle in media.subtitle_files %}
241 <a href=
"{{ request.app.public_store.file_url(subtitle.filepath) }}">
242 {{- subtitle.name -}}
248 {%- if app_config['allow_subtitles']
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>
256 <a href=
"{{ request.urlgen('mediagoblin.edit.subtitles',
257 user=media.get_actor.username,
258 media_id=media.id) }}">
259 {%- 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>