Issue #362 - Updated media.html with things necessary for the simple comment feature

*   `media.html` now imports `wtforms.html` for use in comment form rendering
*   `media.html` now outputs a commenting form if `request.user` evals to `True`
*   `media.html` now outputs `MediaComments` if `comments` evals to `True`
*   `media.html` now includes `pagination.html` to handle comment pagination
This commit is contained in:
Joar Wandborg 2011-06-29 01:21:46 +02:00
parent 7bd8197f32
commit aa7d1a2fb6

View File

@ -16,6 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "mediagoblin/base.html" %}
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
{% block mediagoblin_content %}
{# temporarily, an "image gallery" that isn't one really ;) #}
@ -42,6 +45,49 @@
user= media.uploader().username,
media= media._id) }}">Edit</a></p>
{% endif %}
{% if request.user %}
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
user= media.uploader().username,
media=media._id) }}" method="POST">
<h3>Post a comment!</h3>
{{ wtforms_util.render_field_div(comment_form.comment) }}
<div class="form_submit_buttons">
<input type="submit" value="Submit" class="button" />
</div>
</form>
{% endif %}
{#
{{ wtforms_util.render_textarea_div(submit_form.description) }}
{{ wtforms_util.render_field_div(submit_form.file) }}
#}
{% if comments %}
<h3>Comments</h3>
{% for comment in comments %}
<div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
<div class="comment_author">By:
<a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
user = comment['author']['username']) }}">
{{ comment['author']['username'] }}
</a>
</div>
<div class="comment_datetime">
<a href="#comment-{{ comment['_id'] }}">
{{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year,
comment.created.month,
comment.created.day,
comment.created.hour,
comment.created.minute) }}
</a>
</div>
<div class="comment_content">
{% autoescape False %}
{{ comment.content_html }}
{% endautoescape %}
</div>
</div>
{% endfor %}
{% include "mediagoblin/utils/pagination.html" %}
{% endif %}
{% else %}
<p>Sorry, no such media found.<p/>
{% endif %}