From e03a5919a2c8755fd4efd20e78ca79381dec3075 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Mon, 1 Dec 2014 17:18:54 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/docs.py | 15 +++++++++++++ wqflask/wqflask/templates/base.html | 9 +++++--- wqflask/wqflask/templates/docs.html | 10 +++++++++ wqflask/wqflask/views.py | 43 ++++++++++++++++++++++--------------- 4 files changed, 57 insertions(+), 20 deletions(-) create mode 100755 wqflask/wqflask/docs.py create mode 100755 wqflask/wqflask/templates/docs.html 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,19 +89,22 @@ -->
  • - Help + Help
  • - News + News
  • - References + References
  • Policies
  • Links +
  • +
  • + Environments
  • Collections 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 %} +
    +

    {{title}}

    + {{content|safe}} +
    +{% 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(): -- cgit 1.4.1