diff --git a/app.py b/app.py index e950c94..6a2839b 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, request, redirect, url_for +from flask import Flask, render_template, request, redirect, url_for, send_from_directory from content.posts import BLOG_POSTS from flask_logic.logic import get_enriched_post, get_comments_for_post, save_comment @@ -117,8 +117,16 @@ def post_detail(post_id): return "Post not found", 404 comments = get_comments_for_post(post_id) + if post_id == 2: + return render_template('post_detail_test.html', post=post, comments=comments, blog_title = TITLE) return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE) + + +@app.route('/content/image/') +def content_image_files(filename): + return send_from_directory('content/image', filename) + if __name__ == '__main__': app.run(debug=True) \ No newline at end of file diff --git a/content b/content index 93b20a3..5dcd5bd 160000 --- a/content +++ b/content @@ -1 +1 @@ -Subproject commit 93b20a38f86ae04dca7604baf0995c3ecbb94ce9 +Subproject commit 5dcd5bdcee80548c8f4bdb399ea684d04413f339 diff --git a/templates/components/post_renderer.html b/templates/components/post_renderer.html index a76bd81..94c6c6a 100644 --- a/templates/components/post_renderer.html +++ b/templates/components/post_renderer.html @@ -1,3 +1,12 @@ {% macro render_post(post) %}
{{ post.content | safe }}
-{% if post.template %} {% include post.template %} {% endif %} {% endmacro %} +{% if post.template %} {% include post.template %} {% endif %} {% endmacro %} {% +macro render_test(post) %} +
+ {% for block in post.content %} {% if block.type == "image" %} {% include + "components/image.html" with src=url_for('content_image_files', + filename=block.src) %} {% elif block.type == "text" %} +

{{ block.value }}

+ {% endif %} {% endfor %} +
+{% endmacro %} diff --git a/templates/posts/post_5.html b/templates/posts/post_5.html deleted file mode 100644 index 3c0360b..0000000 --- a/templates/posts/post_5.html +++ /dev/null @@ -1,3 +0,0 @@ -

Project Timeline

- -{% include "components/timeline.html" %}