+ 'confirm' section for confirmation dialogues
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
CommitLineData
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 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>
f645bde8 46
74596110 47 <h2 class="media_title">
f645bde8 48 {{ media.title }}
b611476c 49 </h2>
f645bde8 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
74596110
JS
61 {% autoescape False %}
62 <p>{{ media.description_html }}</p>
63 {% endautoescape %}
f645bde8 64
24df76fa 65 <br />
8f4c9b81 66 <h3>{% trans %}Comments{% endtrans %}</h3>
f645bde8 67
a86e66b5
CAW
68 {% if request.user %}
69 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
70 user= media.uploader().username,
71 media=media._id) }}" method="POST">
d9204d3a 72 {{ wtforms_util.render_divs(comment_form) }}
a86e66b5 73 <div class="form_submit_buttons">
8f4c9b81 74 <input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" />
a86e66b5
CAW
75 </div>
76 </form>
77 {% endif %}
f6c49c5e 78
a86e66b5 79 {% if comments %}
a86e66b5 80 {% for comment in comments %}
2110408f 81 {% set comment_author = comment.author() %}
af2fcba5
JW
82 {% if pagination.active_id == comment._id %}
83 <div class="comment_wrapper comment_active" id="comment-{{ comment['_id'] }}">
84 <a name="comment" id="comment"></a>
85 {% else %}
86 <div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
87 {% endif %}
f645bde8 88
270dca58
JS
89 <div class="comment_content">
90 {% autoescape False %}
91 {{ comment.content_html }}
92 {% endautoescape %}
c13ce79a 93 </div>
f645bde8 94
c13ce79a
JS
95 <div class="comment_author">&mdash;
96 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
29beee8c
CAW
97 user = comment_author['username']) }}">
98 {{ comment_author['username'] }}</a>
99 {% trans %}at{% endtrans %}
af2fcba5
JW
100 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
101 comment = comment['_id'],
102 user = media.uploader().username,
103 media = media._id) }}#comment">
ff9ad461 104 {{ comment.created.strftime("%Y-%m-%d %I:%M%p") }}
c13ce79a
JS
105 </a>
106 </div>
6f65e9eb 107 </div>
a86e66b5 108 {% endfor %}
6f65e9eb 109
af2fcba5
JW
110 {{ render_pagination(request, pagination,
111 request.urlgen('mediagoblin.user_pages.media_home',
112 user = media.uploader().username,
113 media = media._id)) }}
a86e66b5 114 </div>
aa7d1a2f 115 {% endif %}
5d900647 116
18d9287a 117 <div class="grid_5 omega">
9c0fe63f 118 {% include "mediagoblin/utils/prev_next.html" %}
e192d7b7
CFD
119 {% if media['uploader'] == request.user['_id'] or
120 request.user['is_admin'] %}
aaa46f5a 121 <h3>Temporary button holder</h3>
ab6fffed
CAW
122 <p>
123 <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
124 user= media.uploader().username,
125 media= media._id) }}"
126 ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
127 class="media_icon" />edit</a>
128 </p>
129 <p>
08750772
MH
130 <a href="{{ request.urlgen('mediagoblin.confirm.confirm_delete',
131 user= media.uploader().username,
132 media= media._id) }}"
133 ><img src="{{ request.staticdirect('/images/icon_delete.png') }}"
134 class="media_icon" />{% trans %}delete{% endtrans %}</a>
ab6fffed 135 </p>
b611476c 136 {% endif %}
5d900647 137
6f2e4585 138 {% if media.tags %}
0712a06d 139 {% include "mediagoblin/utils/tags.html" %}
6f2e4585 140 {% endif %}
a54e5be7 141 </div>
9a16e16f 142 {% else %}
8f4c9b81 143 <p>{% trans %}Sorry, no such media found.{% endtrans %}<p/>
9a16e16f 144 {% endif %}
d3060210 145{% endblock %}