Commit | Line | Data |
---|---|---|
9a16e16f SS |
1 | {# |
2 | # GNU MediaGoblin -- federated, autonomous media hosting | |
3 | # Copyright (C) 2011 Free Software Foundation, Inc | |
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 CAW |
26 | <div class="media_image_container"> |
27 | <img class="media_image" | |
28 | src="{{ request.app.public_store.file_url( | |
29 | media.get_display_media(media.media_files)) }}" /> | |
30 | </div> | |
f645bde8 | 31 | |
74596110 | 32 | <h2 class="media_title"> |
f645bde8 | 33 | {{ media.title }} |
b611476c | 34 | </h2> |
f645bde8 | 35 | |
74596110 | 36 | <p class="media_uploader"> |
58b79b15 CAW |
37 | {% trans date="%4d-%02d-%02d"|format( |
38 | media.created.year, | |
39 | media.created.month, media.created.day), | |
40 | user_url=request.urlgen( | |
41 | 'mediagoblin.user_pages.user_home', | |
42 | user=media.uploader().username), | |
43 | username=media.uploader().username -%} | |
74596110 | 44 | Uploaded on {{ date }} by <a href="{{ user_url }}">{{ username }}</a> |
58b79b15 | 45 | {%- endtrans %} |
b611476c | 46 | </p> |
f645bde8 | 47 | |
74596110 JS |
48 | {% autoescape False %} |
49 | <p>{{ media.description_html }}</p> | |
50 | {% endautoescape %} | |
f645bde8 | 51 | |
24df76fa | 52 | <br /> |
8f4c9b81 | 53 | <h3>{% trans %}Comments{% endtrans %}</h3> |
f645bde8 | 54 | |
a86e66b5 CAW |
55 | {% if request.user %} |
56 | <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', | |
57 | user= media.uploader().username, | |
58 | media=media._id) }}" method="POST"> | |
d9204d3a | 59 | {{ wtforms_util.render_divs(comment_form) }} |
a86e66b5 | 60 | <div class="form_submit_buttons"> |
8f4c9b81 | 61 | <input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" /> |
a86e66b5 CAW |
62 | </div> |
63 | </form> | |
64 | {% endif %} | |
f6c49c5e | 65 | |
a86e66b5 | 66 | {% if comments %} |
a86e66b5 | 67 | {% for comment in comments %} |
2110408f | 68 | {% set comment_author = comment.author() %} |
af2fcba5 JW |
69 | {% if pagination.active_id == comment._id %} |
70 | <div class="comment_wrapper comment_active" id="comment-{{ comment['_id'] }}"> | |
71 | <a name="comment" id="comment"></a> | |
72 | {% else %} | |
73 | <div class="comment_wrapper" id="comment-{{ comment['_id'] }}"> | |
74 | {% endif %} | |
f645bde8 | 75 | |
270dca58 JS |
76 | <div class="comment_content"> |
77 | {% autoescape False %} | |
78 | {{ comment.content_html }} | |
79 | {% endautoescape %} | |
c13ce79a | 80 | </div> |
f645bde8 | 81 | |
c13ce79a JS |
82 | <div class="comment_author">— |
83 | <a href="{{ request.urlgen('mediagoblin.user_pages.user_home', | |
29beee8c CAW |
84 | user = comment_author['username']) }}"> |
85 | {{ comment_author['username'] }}</a> | |
86 | {% trans %}at{% endtrans %} | |
af2fcba5 JW |
87 | <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', |
88 | comment = comment['_id'], | |
89 | user = media.uploader().username, | |
90 | media = media._id) }}#comment"> | |
c13ce79a JS |
91 | {{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year, |
92 | comment.created.month, | |
93 | comment.created.day, | |
94 | comment.created.hour, | |
95 | comment.created.minute) }} | |
96 | </a> | |
97 | </div> | |
6f65e9eb | 98 | </div> |
a86e66b5 | 99 | {% endfor %} |
6f65e9eb | 100 | |
af2fcba5 JW |
101 | {{ render_pagination(request, pagination, |
102 | request.urlgen('mediagoblin.user_pages.media_home', | |
103 | user = media.uploader().username, | |
104 | media = media._id)) }} | |
a86e66b5 | 105 | </div> |
aa7d1a2f | 106 | {% endif %} |
5d900647 | 107 | |
18d9287a | 108 | <div class="grid_5 omega"> |
9c0fe63f | 109 | {% include "mediagoblin/utils/prev_next.html" %} |
e192d7b7 CFD |
110 | {% if media['uploader'] == request.user['_id'] or |
111 | request.user['is_admin'] %} | |
aaa46f5a | 112 | <h3>Temporary button holder</h3> |
ab6fffed CAW |
113 | <p> |
114 | <a href="{{ request.urlgen('mediagoblin.edit.edit_media', | |
115 | user= media.uploader().username, | |
116 | media= media._id) }}" | |
117 | ><img src="{{ request.staticdirect('/images/icon_edit.png') }}" | |
118 | class="media_icon" />edit</a> | |
119 | </p> | |
120 | <p> | |
121 | <img src="{{ request.staticdirect('/images/icon_delete.png') }}" | |
8f4c9b81 | 122 | class="media_icon" />{% trans %}delete{% endtrans %} |
ab6fffed | 123 | </p> |
b611476c | 124 | {% endif %} |
5d900647 | 125 | |
6f2e4585 | 126 | {% if media.tags %} |
0712a06d | 127 | {% include "mediagoblin/utils/tags.html" %} |
6f2e4585 | 128 | {% endif %} |
a54e5be7 | 129 | </div> |
9a16e16f | 130 | {% else %} |
8f4c9b81 | 131 | <p>{% trans %}Sorry, no such media found.{% endtrans %}<p/> |
9a16e16f | 132 | {% endif %} |
d3060210 | 133 | {% endblock %} |