aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-06-29 01:21:46 +0200
committerJoar Wandborg <git@wandborg.com>2011-06-29 01:21:46 +0200
commitaa7d1a2fb6148f6e899d7f8756e6c481dab3f532 (patch)
treeffd1c6bafa85108cff4d9ec9f7f49dd6af05cd4a
parent7bd8197f32f17466f14d730546a06166ed6da67a (diff)
downloadmediagoblin-aa7d1a2fb6148f6e899d7f8756e6c481dab3f532.tar.lz
mediagoblin-aa7d1a2fb6148f6e899d7f8756e6c481dab3f532.tar.xz
mediagoblin-aa7d1a2fb6148f6e899d7f8756e6c481dab3f532.zip
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
-rw-r--r--mediagoblin/templates/mediagoblin/user_pages/media.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index 97ff8e51..cd0bb764 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -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 %}