From 3e34d0a5f964bb7931cccdd58b7a360187d35a4d Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 6 May 2021 09:32:11 +0300 Subject: add blogs blueprint --- wqflask/wqflask/__init__.py | 2 ++ wqflask/wqflask/markdown_routes.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py index a2bf3085..bf5e094b 100644 --- a/wqflask/wqflask/__init__.py +++ b/wqflask/wqflask/__init__.py @@ -12,6 +12,7 @@ from wqflask.markdown_routes import links_blueprint from wqflask.markdown_routes import policies_blueprint from wqflask.markdown_routes import environments_blueprint from wqflask.markdown_routes import facilities_blueprint +from wqflask.markdown_routes import blogs_blueprint app = Flask(__name__) @@ -29,6 +30,7 @@ app.register_blueprint(links_blueprint, url_prefix="/links") app.register_blueprint(policies_blueprint, url_prefix="/policies") app.register_blueprint(environments_blueprint, url_prefix="/environments") app.register_blueprint(facilities_blueprint, url_prefix="/facilities") +app.register_blueprint(blogs_blueprint, url_prefix="/blogs") @app.before_request diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py index c27ff143..b9a6f8ce 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/markdown_routes.py @@ -20,6 +20,8 @@ links_blueprint = Blueprint("links_blueprint", __name__) policies_blueprint = Blueprint("policies_blueprint", __name__) facilities_blueprint = Blueprint("facilities_blueprint", __name__) +blogs_blueprint = Blueprint("blogs_blueprint", __name__) + def render_markdown(file_name, is_remote_file=True): """Try to fetch the file name from Github and if that fails, try to @@ -124,3 +126,36 @@ def policies(): @facilities_blueprint.route("/") def facilities(): return render_template("facilities.html", rendered_markdown=render_markdown("general/help/facilities.md")), 200 + + +@blogs_blueprint.route("/") +def display_blog(blog_title): + # should use the blog title path + + return render_template("blogs.html", rendered_markdown=render_markdown("blog/2021/proteome/Wang_WIlliams_Rat_Brain_Proteome_For_Blog.md")) + + +@blogs_blueprint.route("/") +def blogs_list(): + + # should fetch this from github + + blogs = {"2021": [ + { + "title": "proteome", + "subtitle": "Wang_WIlliams_Rat_Brain_Proteome_For_Blog" + }, + { + "title":"xxx", + "subtitle":"blog 2" + } + ], + "2020": [ + { + "title": "other", + "subtitle": "other" + } + ] + } + + return render_template("blogs_list.html", blogs=blogs) -- cgit v1.2.3 From 2e2e4601f4cebc767854e66af2d2ca8c3e8123c9 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 6 May 2021 09:32:35 +0300 Subject: add template for blogs --- wqflask/wqflask/templates/base.html | 1 + wqflask/wqflask/templates/blogs.html | 24 ++++++++++++ wqflask/wqflask/templates/blogs_list.html | 61 +++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 wqflask/wqflask/templates/blogs.html create mode 100644 wqflask/wqflask/templates/blogs_list.html (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index e6f22deb..ddb1d272 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -69,6 +69,7 @@