about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLei Yan2014-12-01 17:18:54 +0000
committerLei Yan2014-12-01 17:18:54 +0000
commite03a5919a2c8755fd4efd20e78ca79381dec3075 (patch)
treed017cb62e350e5800e1af2f61afefa1395564e8a
parent67c916e8dcf3833f42cb000c0f1016dedd1af254 (diff)
downloadgenenetwork2-e03a5919a2c8755fd4efd20e78ca79381dec3075.tar.gz
Committer: Lei Yan <lei@penguin.uthsc.edu>
On branch master
-rwxr-xr-xwqflask/wqflask/docs.py15
-rwxr-xr-xwqflask/wqflask/templates/base.html9
-rwxr-xr-xwqflask/wqflask/templates/docs.html10
-rwxr-xr-xwqflask/wqflask/views.py43
4 files changed, 57 insertions, 20 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py
new file mode 100755
index 00000000..65255987
--- /dev/null
+++ b/wqflask/wqflask/docs.py
@@ -0,0 +1,15 @@
+from __future__ import absolute_import, print_function, division
+
+from flask import g
+
+class Docs(object):
+
+    def __init__(self, entry):
+        sql = """
+            SELECT Docs.title, Docs.content
+            FROM Docs
+            WHERE Docs.entry LIKE '%s'
+            """
+        result = g.db.execute(sql % (entry)).fetchone()
+        self.title = result[0]
+        self.content = result[1]
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index b989294a..73b27131 100755
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -89,13 +89,13 @@
                             </ul>
                         </li>-->
                         <li class="">
-                            <a href="#">Help</a>
+                            <a href="/help">Help</a>
                         </li>
                         <li class="">
-                            <a href="/whats_new">News</a>
+                            <a href="/news">News</a>
                         </li>
                         <li class="">
-                            <a href="/reference">References</a>
+                            <a href="/references">References</a>
                         </li>
                         <li class="">
                             <a href="/policies">Policies</a>
@@ -103,6 +103,9 @@
                         <li class="">
                             <a href="/links">Links</a>
                         </li>
+						<li class="">
+                            <a href="/environments">Environments</a>
+                        </li>
                         <li class="">
                             <a href="/collections/list">Collections
                                 {% if g.user_session.user_ob %}
diff --git a/wqflask/wqflask/templates/docs.html b/wqflask/wqflask/templates/docs.html
new file mode 100755
index 00000000..cbaf1e70
--- /dev/null
+++ b/wqflask/wqflask/templates/docs.html
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+
+{% block title %}{{title}}{% endblock %}
+
+{% block content %}
+<div class="container">
+	<h3>{{title}}</h3>
+	{{content|safe}}
+</div>
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 55066f77..b89b2aeb 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -29,6 +29,7 @@ from flask import (render_template, request, make_response, Response,
                    Flask, g, config, jsonify, redirect, url_for)
 
 from wqflask import search_results
+from wqflask import docs
 from base.data_set import DataSet    # Used by YAML in marker_regression
 from base.data_set import create_datasets_list
 from wqflask.show_trait import show_trait
@@ -133,9 +134,17 @@ def search_page():
         else:
             return render_template("search_result_page.html", **result)
 
+@app.route("/testhtmleditor")
+def testhtmleditor_page():
+    return render_template("testhtmleditor.html")
+
+@app.route("/help")
+def help():
+    doc = docs.Docs("help")
+    return render_template("docs.html", **doc.__dict__)
 
-@app.route("/whats_new")
-def whats_new_page():
+@app.route("/news")
+def news():
     #variables = whats_new.whats_new()
     with open("/home/sam/gene/wqflask/wqflask/yaml_data/whats_new.yaml") as fh:
         contents = fh.read()
@@ -145,25 +154,25 @@ def whats_new_page():
         print("\nnews_item is: %s\n" % (news_item))
     return render_template("whats_new.html", news_items=news_items)
 
-@app.route("/testhtmleditor")
-def testhtmleditor_page():
-    return render_template("testhtmleditor.html")
-
-@app.route("/environments")
-def environments():
-    return render_template("environments.html")
-
-@app.route("/reference")
-def reference_page():
-    return render_template("reference.html")
+@app.route("/references")
+def references():
+    doc = docs.Docs("references")
+    return render_template("docs.html", **doc.__dict__)
 
 @app.route("/policies")
-def policies_page():
-    return render_template("policies.html")
+def policies():
+    doc = docs.Docs("policies")
+    return render_template("docs.html", **doc.__dict__)
 
 @app.route("/links")
-def links_page():
-    return render_template("links.html")
+def links():
+    doc = docs.Docs("links")
+    return render_template("docs.html", **doc.__dict__)
+
+@app.route("/environments")
+def environments():
+    doc = docs.Docs("environments")
+    return render_template("docs.html", **doc.__dict__)
 
 @app.route('/export_trait_csv', methods=('POST',))
 def export_trait_excel():