Commit | Line | Data |
---|---|---|
9a16e16f SS |
1 | {# |
2 | # GNU MediaGoblin -- federated, autonomous media hosting | |
12a100e4 | 3 | # Copyright (C) 2011 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 | #} | |
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 | |
9a16e16f | 23 | {% block mediagoblin_content %} |
9a16e16f | 24 | {% if media %} |
18d9287a | 25 | <div class="grid_11 alpha"> |
92ed2892 | 26 | <div class="media_image_container"> |
9b424b17 CAW |
27 | {% set display_media = request.app.public_store.file_url( |
28 | media.get_display_media(media.media_files)) %} | |
29 | ||
30 | {# if there's a medium file size, that means the medium size | |
31 | # isn't the original... so link to the original! | |
32 | #} | |
33 | {% if media['media_files'].has_key('medium') %} | |
34 | <a href="{{ request.app.public_store.file_url( | |
35 | media['media_files']['original']) }}"> | |
36 | <img class="media_image" | |
37 | src="{{ display_media }}" | |
38 | alt="Image for {{ media.title }}" /> | |
39 | </a> | |
40 | {% else %} | |
41 | <img class="media_image" | |
42 | src="{{ display_media }}" | |
43 | alt="Image for {{ media.title }}" /> | |
44 | {% endif %} | |
92ed2892 | 45 | </div> |
d8db3f11 | 46 | |
74596110 | 47 | <h2 class="media_title"> |
f645bde8 | 48 | {{ media.title }} |
b611476c | 49 | </h2> |
6f65e9eb | 50 | |
74596110 | 51 | <p class="media_uploader"> |
ff9ad461 | 52 | {% trans date=media.created.strftime("%Y-%m-%d"), |
58b79b15 CAW |
53 | user_url=request.urlgen( |
54 | 'mediagoblin.user_pages.user_home', | |
55 | user=media.uploader().username), | |
56 | username=media.uploader().username -%} | |
74596110 | 57 | Uploaded on {{ date }} by <a href="{{ user_url }}">{{ username }}</a> |
58b79b15 | 58 | {%- endtrans %} |
b611476c | 59 | </p> |
f645bde8 | 60 | |
b611476c JS |
61 | {% autoescape False %} |
62 | <p>{{ media.description_html }}</p> | |
63 | {% endautoescape %} | |
6f65e9eb | 64 | |
24df76fa | 65 | <br /> |
8f4c9b81 | 66 | <h3>{% trans %}Comments{% endtrans %}</h3> |
6f65e9eb | 67 | |
e360a992 CAW |
68 | {% if request.user %} |
69 | <p><a href="#comment_form">{% trans %}Post a comment{% endtrans %}</a></p> | |
70 | {% endif %} | |
f6c49c5e | 71 | |
a86e66b5 | 72 | {% if comments %} |
a86e66b5 | 73 | {% for comment in comments %} |
2110408f | 74 | {% set comment_author = comment.author() %} |
af2fcba5 JW |
75 | {% if pagination.active_id == comment._id %} |
76 | <div class="comment_wrapper comment_active" id="comment-{{ comment['_id'] }}"> | |
77 | <a name="comment" id="comment"></a> | |
78 | {% else %} | |
79 | <div class="comment_wrapper" id="comment-{{ comment['_id'] }}"> | |
80 | {% endif %} | |
f645bde8 | 81 | |
270dca58 JS |
82 | <div class="comment_content"> |
83 | {% autoescape False %} | |
84 | {{ comment.content_html }} | |
85 | {% endautoescape %} | |
c13ce79a | 86 | </div> |
f645bde8 | 87 | |
c13ce79a JS |
88 | <div class="comment_author">— |
89 | <a href="{{ request.urlgen('mediagoblin.user_pages.user_home', | |
29beee8c CAW |
90 | user = comment_author['username']) }}"> |
91 | {{ comment_author['username'] }}</a> | |
92 | {% trans %}at{% endtrans %} | |
af2fcba5 JW |
93 | <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', |
94 | comment = comment['_id'], | |
95 | user = media.uploader().username, | |
96 | media = media._id) }}#comment"> | |
ff9ad461 | 97 | {{ comment.created.strftime("%Y-%m-%d %I:%M%p") }} |
c13ce79a JS |
98 | </a> |
99 | </div> | |
6f65e9eb | 100 | </div> |
a86e66b5 | 101 | {% endfor %} |
6f65e9eb | 102 | |
b06e4f3b | 103 | {% if request.user %} |
b06e4f3b E |
104 | <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', |
105 | user= media.uploader().username, | |
106 | media=media._id) }}" method="POST"> | |
107 | {{ wtforms_util.render_divs(comment_form) }} | |
108 | <div class="form_submit_buttons"> | |
109 | <input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" /> | |
110 | {{ csrf_token }} | |
111 | </div> | |
112 | </form> | |
113 | {% endif %} | |
b7206469 | 114 | |
af2fcba5 JW |
115 | {{ render_pagination(request, pagination, |
116 | request.urlgen('mediagoblin.user_pages.media_home', | |
117 | user = media.uploader().username, | |
118 | media = media._id)) }} | |
a86e66b5 | 119 | </div> |
aa7d1a2f | 120 | {% endif %} |
5d900647 | 121 | |
18d9287a | 122 | <div class="grid_5 omega"> |
9c0fe63f | 123 | {% include "mediagoblin/utils/prev_next.html" %} |
894fa564 CAW |
124 | |
125 | {% if media['uploader'] == request.user['_id'] or | |
126 | request.user['is_admin'] %} | |
ecc56c0a | 127 | <h3>{% trans %}Actions{% endtrans %}</h3> |
894fa564 | 128 | <p> |
15144d06 | 129 | {% set edit_url = request.urlgen('mediagoblin.edit.edit_media', |
894fa564 | 130 | user= media.uploader().username, |
15144d06 CAW |
131 | media= media._id) %} |
132 | <a href="{{ edit_url }}" | |
894fa564 | 133 | ><img src="{{ request.staticdirect('/images/icon_edit.png') }}" |
15144d06 CAW |
134 | class="media_icon" /></a> |
135 | <a href="{{ edit_url }}">{% trans %}edit{% endtrans %}</a> | |
894fa564 CAW |
136 | </p> |
137 | <p> | |
15144d06 | 138 | {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', |
7dc3a66f | 139 | user= media.uploader().username, |
15144d06 CAW |
140 | media= media._id) %} |
141 | <a href="{{ delete_url }}" | |
7dc3a66f | 142 | ><img src="{{ request.staticdirect('/images/icon_delete.png') }}" |
15144d06 CAW |
143 | class="media_icon" /></a> |
144 | <a href="{{ delete_url }}">{% trans %}delete{% endtrans %}</a> | |
894fa564 CAW |
145 | </p> |
146 | {% endif %} | |
5d900647 | 147 | |
3a8c3a38 | 148 | {% if media.attachment_files|count %} |
894fa564 CAW |
149 | <h3>Attachments</h3> |
150 | <ul> | |
151 | {% for attachment in media.attachment_files %} | |
152 | <li> | |
153 | <a href="{{ request.app.public_store.file_url(attachment.filepath) }}"> | |
154 | {{ attachment.name }} | |
155 | </a> | |
156 | </li> | |
157 | {% endfor %} | |
158 | </ul> | |
3a8c3a38 | 159 | {% endif %} |
894fa564 CAW |
160 | |
161 | {% if app_config['allow_attachments'] | |
162 | and (media['uploader'] == request.user['_id'] | |
163 | or request.user['is_admin']) %} | |
a28f0726 CAW |
164 | <p> |
165 | <a href="{{ request.urlgen('mediagoblin.edit.attachments', | |
166 | user=media.uploader().username, | |
167 | media=media._id) }}">Add attachment</a> | |
168 | </p> | |
3a8c3a38 JW |
169 | {% endif %} |
170 | ||
6f2e4585 | 171 | {% if media.tags %} |
0712a06d | 172 | {% include "mediagoblin/utils/tags.html" %} |
6f2e4585 | 173 | {% endif %} |
25b48323 AW |
174 | |
175 | {% include "mediagoblin/utils/license.html" %} | |
a54e5be7 | 176 | </div> |
9a16e16f | 177 | {% else %} |
8f4c9b81 | 178 | <p>{% trans %}Sorry, no such media found.{% endtrans %}<p/> |
9a16e16f | 179 | {% endif %} |
d3060210 | 180 | {% endblock %} |