flask/flask_website/templates/snippets/show.html

48 lines
1.7 KiB
HTML
Raw Normal View History

2010-05-03 11:20:52 +02:00
{% extends "snippets/layout.html" %}
{% block title %}{{ snippet.title }}{% endblock %}
2010-05-05 17:26:28 +02:00
{% block head %}
{{ super() }}
<link href="{{ url_for('comments_feed', id=snippet.id) }}" rel="alternate" title="Snippet Comments" type="application/atom+xml">
{% endblock %}
2010-05-03 11:20:52 +02:00
{% block body %}
<h2>{{ snippet.title }}</h2>
<p class=snippet-author>By {{ snippet.author.name }}
filed in <a href="{{ snippet.category.url }}">{{ snippet.category.name }}</a>
2010-05-15 23:19:13 +02:00
{% if snippet.author == g.user or g.user.is_admin %}
(<a href="{{ url_for('edit', id=snippet.id) }}">edit</a>)
2010-05-03 11:20:52 +02:00
{% endif %}
{{ snippet.rendered_body }}
<p><small>This snippet by {{ snippet.author.name }} can be used freely for
anything you like. Consider it public domain.</small>
2010-05-03 11:20:52 +02:00
{% if snippet.comments or g.user %}
<div id=comment-box>
{% if snippet.comments %}
<h2>Comments</h2>
<ul class=comments>
{% for comment in snippet.comments %}
<li>
<p class=title>
{{ comment.title or "Comment" }}
by {{ comment.author.name }}
on {{ comment.pub_date.strftime('%Y-%m-%d @ %H:%M') }}
{% if g.user.is_admin %}
(<a href="{{ url_for('edit_comment', id=comment.id) }}">edit</a>)
{% endif %}
2010-05-03 11:20:52 +02:00
<div class=body>{{ comment.rendered_text }}</div></li>
{% endfor %}
</ul>
{% endif %}
2010-05-03 11:20:52 +02:00
{% if g.user %}
<div id=add-comment>
<h2>Add Comment</h2>
<form action="" method=post>
2010-05-03 11:20:52 +02:00
<p>Title: <input type=text name=title value="{{ request.form.title }}" size=30>
<p><textarea name=text cols=40 rows=8>{{ request.form.text }}</textarea>
<p><input type=submit value="Add Comment">
</form>
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}