Fix #5433 - Typo in decorators
[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>
ee9a0e3c 78 {% if request.user and
0f3bf8d4 79 (media.actor == request.user.id or
8394febb 80 request.user.has_privilege('admin')) %}
da4d97e0 81 <div class="pull-right" style="padding-top:20px;">
ee9a0e3c 82 {% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
0f3bf8d4 83 user= media.get_actor.username,
461dd971 84 media_id=media.id) %}
ee9a0e3c
JS
85 <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a>
86 {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
0f3bf8d4 87 user= media.get_actor.username,
461dd971 88 media_id=media.id) %}
da4d97e0 89 <a class="button_action button_warning" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
90 </div>
ee9a0e3c 91 {% endif %}
f80f5b58
CAW
92 {% autoescape False %}
93 <p>{{ media.description_html }}</p>
ee9a0e3c 94 {% endautoescape %}
da4d97e0 95 </div>
64a456a4 96 {% if request.user and request.user.has_privilege('commenter') %}
da4d97e0 97 <div class="media_comments">
8154ecaf
CAW
98 {% if app_config['allow_comments'] %}
99 <a
100 {% if not request.user %}
8fc57eaa
RE
101 href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
102 request.base_url|urlencode }}"
8154ecaf
CAW
103 {% endif %}
104 class="button_action" id="button_addcomment" title="Add a comment">
105 {% trans %}Add a comment{% endtrans %}
106 </a>
0c7fa755
JW
107 {% include "mediagoblin/utils/comment-subscription.html" %}
108
8154ecaf 109 {% endif %}
e360a992 110 {% if request.user %}
aa4f958a 111 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
0f3bf8d4 112 user= media.get_actor.username,
461dd971 113 media_id=media.id) }}" method="POST" id="form_comment">
f80f5b58
CAW
114 {{ wtforms_util.render_divs(comment_form) }}
115 <div class="form_submit_buttons">
75a12d63 116 <input type="submit" value="{% trans %}Add this comment{% endtrans %}" class="button_action" />
f80f5b58
CAW
117 {{ csrf_token }}
118 </div>
5ab60299 119 <input type="hidden" value="{{ request.urlgen('mediagoblin.user_pages.media_preview_comment') }}" id="previewURL" />
3bd62dc4 120 <input type="hidden" value="{% trans %}Comment Preview{% endtrans %}" id="previewText"/>
f80f5b58 121 </form>
5ab60299 122 <div id="comment_preview"></div>
e360a992 123 {% endif %}
5bae4af1 124 <ul style="list-style:none">
694e965f 125 {% for comment in comments %}
0f3bf8d4 126 {% set comment_author = comment.get_actor %}
5bae4af1
E
127 <li id="comment-{{ comment.id }}"
128 {%- if pagination.active_id == comment.id %}
129 class="comment_wrapper comment_active">
130 <a name="comment" id="comment"></a>
131 {%- else %}
132 class="comment_wrapper">
133 {%- endif %}
134 <div class="comment_author">
694e965f
JS
135 <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
136 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
64308aca
CAW
137 user=comment_author.username) }}"
138 class="comment_authorlink">
4637d50c 139 {{- comment_author.username -}}
694e965f 140 </a>
694e965f 141 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
397c22d1 142 comment=comment.id,
0f3bf8d4 143 user=media.get_actor.username,
64308aca
CAW
144 media=media.slug_or_id) }}#comment"
145 class="comment_whenlink">
f1c3807d 146 <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
eac52ac1
CAW
147 {%- trans formatted_time=timesince(comment.created) -%}
148 {{ formatted_time }} ago
149 {%- endtrans -%}
150 </span></a>:
55dbaa9b
JS
151 </div>
152 <div class="comment_content">
4637d50c 153 {% autoescape False -%}
55dbaa9b 154 {{ comment.content_html }}
4637d50c 155 {%- endautoescape %}
6f65e9eb 156 </div>
30a9fe7c 157 <div>
6483b370 158 {% if app_config.allow_reporting %}
159 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_comment',
0f3bf8d4 160 user=media.get_actor.username,
30a9fe7c 161 media=media.slug_or_id,
6483b370 162 comment=comment.id) }}">
163 {% trans %}Report{% endtrans %}</a>
164 {% endif %}
30a9fe7c 165 </div>
5bae4af1 166 </li>
694e965f 167 {% endfor %}
5bae4af1 168 </ul>
0eb649ff
E
169 {{ render_pagination(request, pagination,
170 media.url_for_self(request.urlgen)) }}
da4d97e0 171 {% else %}
172 <div class="empty_space no_background">
aa7d1a2f 173 {% endif %}
da4d97e0 174 </div>
da4d97e0 175
5cdf3a0a 176 </div>
177
178
179 <div class="five columns media_sidebar">
34d30444 180 <h3>{% trans %}Added{% endtrans %}</h3>
05ad187b 181 <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
dc31cd1b 182 {%- trans formatted_time=timesince(media.created) -%}
eac52ac1
CAW
183 {{ formatted_time }} ago
184 {%- endtrans -%}
185 </span></p>
058226d0 186
ab4cbb10
CAW
187 {% block mediagoblin_after_added_sidebar %}
188 {% endblock %}
058226d0 189
f80f5b58
CAW
190 {% if media.tags %}
191 {% include "mediagoblin/utils/tags.html" %}
aa7d1a2f 192 {% endif %}
5d900647 193
44004c17 194 {% include "mediagoblin/utils/collections.html" %}
be5be115 195
6483b370 196 {% if app_config.allow_reporting %}
197 {% include "mediagoblin/utils/report.html" %}
198 {% endif %}
3ce0c611 199
99a270e9 200 {% include "mediagoblin/utils/license.html" %}
6d9ce47f 201
cc7ca4da 202 {% include "mediagoblin/utils/exif.html" %}
aa4f958a 203
954b407c 204 {%- if media.attachment_files|count %}
62b7d1b2
JK
205 <h3>{% trans %}Attachments{% endtrans %}</h3>
206 <ul>
954b407c 207 {%- for attachment in media.attachment_files %}
62b7d1b2
JK
208 <li>
209 <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
13ab48a7 210 {{- attachment.name -}}
62b7d1b2
JK
211 </a>
212 </li>
954b407c 213 {%- endfor %}
62b7d1b2 214 </ul>
954b407c
E
215 {%- endif %}
216 {%- if app_config['allow_attachments']
62b7d1b2 217 and request.user
0f3bf8d4 218 and (media.actor == request.user.id
8394febb 219 or request.user.has_privilege('admin')) %}
954b407c 220 {%- if not media.attachment_files|count %}
62b7d1b2 221 <h3>{% trans %}Attachments{% endtrans %}</h3>
954b407c 222 {%- endif %}
62b7d1b2
JK
223 <p>
224 <a href="{{ request.urlgen('mediagoblin.edit.attachments',
0f3bf8d4 225 user=media.get_actor.username,
954b407c
E
226 media_id=media.id) }}">
227 {%- trans %}Add attachment{% endtrans -%}
228 </a>
62b7d1b2 229 </p>
954b407c 230 {%- endif %}
62b7d1b2 231
8db3277c
RRS
232 {% block mediagoblin_sidebar %}
233 {% endblock %}
234
c0434db4
JT
235 {%- set model = media %}
236 {% template_hook("location_info") %}
927be5e8 237 {% template_hook("media_sideinfo") %}
1c2d01ae 238
da4d97e0 239 </div><!--end media_sidebar-->
240
85778e79 241 <div class="clear"></div>
d3060210 242{% endblock %}