aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-05-06 09:32:11 +0300
committerBonfaceKilz2021-05-07 12:01:15 +0300
commit3e34d0a5f964bb7931cccdd58b7a360187d35a4d (patch)
treeae3bd518f5d0936df7bfab9142d5aba2c6f116b3
parenta2627777d51b969869d8647624ce008fc9454c7b (diff)
downloadgenenetwork2-3e34d0a5f964bb7931cccdd58b7a360187d35a4d.tar.gz
add blogs blueprint
-rw-r--r--wqflask/wqflask/__init__.py2
-rw-r--r--wqflask/wqflask/markdown_routes.py35
2 files changed, 37 insertions, 0 deletions
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("/<blog_title>")
+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)