summaryrefslogtreecommitdiffstats
path: root/flaskr/templates/blog/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'flaskr/templates/blog/index.html')
-rw-r--r--flaskr/templates/blog/index.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/flaskr/templates/blog/index.html b/flaskr/templates/blog/index.html
new file mode 100644
index 0000000..0d3ed17
--- /dev/null
+++ b/flaskr/templates/blog/index.html
@@ -0,0 +1,30 @@
+{% extends 'base.html' %}
+
+
+{% block header %}
+ <h1>{% block title %}Posts{% endblock %}</h1>
+ {% if g.user %}
+ <a class="action" href="{{ url_for('blog.create') }}">New</a>
+ {% endif %}
+{% endblock %}
+
+{% block content %}
+ {% for post in posts %}
+ <article class="post">
+ <header>
+ <div>
+ <h1>{{ post['title'] }}</h1>
+ <div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
+ </div>
+ {% if g.user['id'] == post['author_id'] %}
+ <a class="action" href="{{ url_for('blog.update', id=post['id']) }}">Edit</a>
+ {% endif %}
+ </header>
+ <p class="body">{{ post['body'] }}</p>
+ </article>
+ {% if not loop.last %}
+ {# Separate posts with a line #}
+ <hr>
+ {% endif %}
+ {% endfor %}
+{% endblock %} \ No newline at end of file